BMP

Search this archive.

From: Pierre Aubry (pierre.aubry@bluewin.ch)
Date: Sat 19 Jan 2002 - 12:05:43 IST


 the following is a part of an old program of mine
 to read and show BMP-Files (Borland C). I guess it
 could be easyly adapted to linux.

void main()
{
  clrscr();
  gotoxy(1,1);
  printf("[ BMPSHO]   ***   SHOW  *.BMP - FILES   ***");
  gotoxy(1,4);
  printf("INPUT  BMP - FILENAME :   ");
  gets(instr);
  if(instr[0] == '\0') { clrscr(); exit(0); }
  sprintf(filename,"%s.bmp",instr);
  gotoxy(1,6);
  printf("->   %s",filename);
  In = fopen(filename,"rb");
                                               /* read 118-byte - header, discard */
  for(i = 0;i < 118;i++) ww = getc(In);
  initgraph(&driver,&mode,"");               // VGA
  for(y = 479;y > -1;y--)
  {
    for(x = 0;x < 640;x = x+2)
    {
       ww = getc(In);
       pix1 = ww >> 4;                          // Bits 4,5,6,7
       pix2 = ww - (ww & 240);                  // Bits 0,1,2,3
       putpixel(x,y,pix1);
       putpixel(x+1,y,pix2);
    }
  }
  getch();
  closegraph();
}





------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:24 IST