home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <conio.h>
- #include <graphics.h>
- #include <dos.h>
- FILE *fp,*fopen();
- int i,j,x,y;
- int driver,mode;
- char ch;
- int width;
-
- main()
- { char *tif_file;
- int x,y;
- x=0;
- y=0;
- tif_file="C:\\tc\\c\\x3.tif";
- do {
- show_tif(tif_file,x,y);
- settextstyle(3,0,4);
- outtextxy(10,1,"Q to end. Other key to show once more");
- ch=getch(); }
- while (ch!='q'&&ch!='Q');
- restorecrtmode();
- }
-
- show_tif(char *tif_file,int x,int y)
- { int xbak,widthh,widthl;
- xbak=x;
- driver=DETECT;
- mode=2;
- initgraph(&driver,&mode,"c:\\tc");
- setcolor(LIGHTRED);
- setbkcolor(WHITE);
- textcolor(YELLOW);
- fp=fopen(tif_file,"r");
- if (fp==NULL)
- { printf("Unable to open the file !\n");
- getch();
- exit(0);
- };
- fseek(fp,30,0);
- widthl=getc(fp);
- widthh=getc(fp);
- width=widthh*256+widthl;
- j=0xae;
- fseek(fp,j,0);
- while (!feof(fp))
- {
- ch=getc(fp);
- for (i=0;i<=7;i++)
- {
- if ((ch&0x80)==0) putpixel(x,y,GREEN);
- ch=ch<<1;
- x++;
- if (x>=xbak+width)
- {
- x=xbak;
- y++;
- };
- };
- };
-
- }
-
-