Searching \ for '[OT]: Dissecting a .BMP file' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=dissecting+bmp+file
Search entire site for: 'Dissecting a .BMP file'.

Exact match. Not showing close matches.
PICList Thread
'[OT]: Dissecting a .BMP file'
2002\03\19@125454 by Quentin

flavicon
face
Hi all
Can anybody explain to me what all the codes in a .BMP file are for? So
far I have figured out which bytes represents the picture code and how,
and I have also figured out that some of the code gives you the size of
the picture. But there are a whole bunch of other bytes at the start of
the file that that makes no sense to me.

Using PSP to create the bit map and UltraEdit to view the code.
Figured I can dump the whole bit map to COMM>>PIC>>EEPROM>>PIC>>LCD
instead of converting it first as in my previous emails (DUH!)

Quentin

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\03\19@131539 by Paul Hutchinson

flavicon
face
This page and its links should help. Warning long URL may get split.

msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps
_4v1h.asp

Paul

> Can anybody explain to me what all the codes in a .BMP file are for? So
> far I have figured out which bytes represents the picture code and how,
> and I have also figured out that some of the code gives you the size of
> the picture. But there are a whole bunch of other bytes at the start of
> the file that that makes no sense to me.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\03\19@132807 by Barry Gershenfeld

picon face
At 07:51 PM 3/19/02 +0200, you wrote:
>Hi all
>Can anybody explain to me what all the codes in a .BMP file are for?
>Using PSP to create the bit map and UltraEdit to view the code.

1.  http://www.wotsit.org/   has file formats for "everything"!

2. PSP can make raw images without any headers (unless you want
  to decode the header for size, etc. as a feature...more work...)

Barry

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\03\20@145314 by Peter L. Peres

picon face
You NEED the relevant Microsoft documentation to make sense of BMP files
because there are several dozens of BMP file formats. Decoding this on a
micro is probably not a good idea. The bytes you saw at the start are a
header and one or more color tables represented in one of several formats.
Check the PPM (binary) and PGM formats for an easier format. Also the
format used by the WAP protocol for sending images.

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\03\21@104518 by ted_rossin

flavicon
face
source= http://www.piclist.com/postbot.asp?id=piclist\2002\03\19\125454a

Here is one description of it.

http://www.fortunecity.com/skyscraper/windows/364/bmpffrmt.html


Here is a C++ class I wrote to read and write bmp files.  There is also a
compressed format that my code supports for reads.  Not many programs
support it so you will probably never see files that use it.

   Ted.

-------------------------------------------------------------


Header file:

// CDIB.H: Header file for the DIB class.
///////////////////////////////////////////////////////////

#ifndef __CDIB_H
#define __CDIB_H


typedef struct tagRGBQUADother

   unsigned char    rgbBlue;
   unsigned char    rgbGreen;
   unsigned char    rgbRed;
   unsigned char    rgbReserved;
} RGBQUADother;


typedef struct tagBITMAPFILEHEADERother

   unsigned short    bfType;
   unsigned short   bfSize1;
   unsigned short   bfSize2;
   short    bfReserved1;
   short    bfReserved2;
   unsigned short   bfOffBits1;
   unsigned short   bfOffBits2;
} BITMAPFILEHEADERother;

typedef struct
PINFOHEADERother{
   unsigned int  biSize;
   int   biWidth;
   int   biHeight;
   unsigned short   biPlanes;
   unsigned short   biBitCount;
   unsigned int  biCompression;
   unsigned int  biSizeImage;
   int   biXPelsPerMeter;
   int   biYPelsPerMeter;
   unsigned int  biClrUsed;
   unsigned int  biClrImportant;
} BITMAPINFOHEADERother;

typedef struct tagBITMAPINFOother {
   BITMAPINFOHEADERother bmiHeader;
   RGBQUADother          bmiColors[1];
} BITMAPINFOother;

class CDib
{
protected:
   BITMAPFILEHEADERother *m_pBmFileHeader;
   BITMAPINFOother *m_pBmInfo;
   BITMAPINFOHEADERother *m_pBmInfoHeader;
   RGBQUADother *m_pRGBTable;
   unsigned char* m_pDibBits;
   unsigned int m_numColors;
   int m_byteswap;
   int m_noflip;

   unsigned char *m_buf;
   int m_width,m_height;
   int GetDibSizeImage();
   unsigned int GetDibNumColors();
   unsigned int GetDibNumBits();
   unsigned int swap_int(unsigned int in);
   unsigned short swap_short(unsigned short in);
   unsigned char *expand8(unsigned char *buf2);
// Win32 only
   unsigned char *mImage;
   BITMAPINFOHEADER m_bmInfoHeader;
   BITMAPINFO m_bmInfo;

public:
   CDib();
   ~CDib();
   unsigned char *Load(char *filename);
   int GetWidth(void);
   int GetHeight(void);
   int Save(char *fname,unsigned char *buf,int width,int height);
   void SetNoFlip(void);
// Win32 only
   int MakeDib(unsigned char *image,int width,int height);
   void DrawDib(CDC* pDC,int x,int y,int width,int height);
};

#endif


The guts:

///////////////////////////////////////////////////////////
// CDIB.C: Implementation file for the DIB class.
///////////////////////////////////////////////////////////

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include "Cdib.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


///////////////////////////////////////////////////////////
// CDib::CDib()
///////////////////////////////////////////////////////////
CDib::CDib()
{
   m_buf= NULL;
   m_width = 0;
   m_height = 0;
   m_byteswap = 0;
   m_noflip = 0;
   mImage = NULL;
}

///////////////////////////////////////////////////////////
// CDib::~CDib()
///////////////////////////////////////////////////////////
CDib::~CDib()
{
   if(mImage){
       free(mImage);  m_width = m_height=0;
   }
}

int CDib::Save(char *fname,unsigned char *buf,int width,int height)
{
   int i,j,index;
   FILE *fp;
   BITMAPFILEHEADERother bmFileHeader;
   BITMAPINFOHEADERother bmInfoHeader;
   unsigned char color_vals[4];
   unsigned int val,pad;
   union{
       unsigned short all;
       struct{
           unsigned char a,b;
       } p;
   } the_bytes;

   if((fp=fopen(fname,"wb"))==NULL){
       return
(-1);
   }

   m_byteswap = 0;
   the_bytes.all = 0x4d42;
   if(the_bytes.p.a==0x4d) m_byteswap = 1;

   pad = 4 - ((width*3) & 3);
   if(pad==4) pad=0;

   if(m_byteswap){
       bmFileHeader.bfType = swap_short(0x4d42);
       val=sizeof(bmFileHeader) + sizeof(bmInfoHeader) + (width+pad)*height*3;
       val = swap_int(val);
       bmFileHeader.bfSize2 = val & 0xFFFF;
       bmFileHeader.bfSize1 = (val>>16) & 0xFFFF;
       bmFileHeader.bfReserved1 = 0;
       bmFileHeader.bfReserved2 = 0;
       val = sizeof(bmFileHeader) + sizeof(bmInfoHeader);
       val = swap_int(val);
       bmFileHeader.bfOffBits2 = val & 0xffff;
       bmFileHeader.bfOffBits1 = (val>>16) & 0xffff;

       bmInfoHeader.biSize = swap_int(sizeof(bmInfoHeader));
       bmInfoHeader.biWidth = (int)swap_int(width);
       bmInfoHeader.biHeight = (int)swap_int(height);
       bmInfoHeader.biPlanes = swap_short(1);
       bmInfoHeader.biBitCount = swap_short(24);
       bmInfoHeader.biCompression = 0;
       bmInfoHeader.biSizeImage = swap_int((width+pad)*height*3);
       bmInfoHeader.biXPelsPerMeter = 0;
       bmInfoHeader.biYPelsPerMeter = 0;
       bmInfoHeader.biClrUsed = 0;
       bmInfoHeader.biClrImportant = 0;
   }
   else{
       bmFileHeader.bfType = 0x4d42;
       val=sizeof(bmFileHeader) + sizeof(bmInfoHeader) + (width+pad)*height*3;
       bmFileHeader.bfSize1 = val & 0xFFFF;
       bmFileHeader.bfSize2 = (val>>16) & 0xFFFF;
       bmFileHeader.bfReserved1 = 0;
       bmFileHeader.bfReserved2 = 0;
       val = sizeof(bmFileHeader) + sizeof(bmInfoHeader);
       bmFileHeader.bfOffBits1 = val & 0xffff;
       bmFileHeader.bfOffBits2 = (val>>16) & 0xffff;

       bmInfoHeader.biSize = sizeof(bmInfoHeader);
       bmInfoHeader.biWidth = width;
       bmInfoHeader.biHeight = height;
       bmInfoHeader.biPlanes = 1;
       bmInfoHeader.biBitCount = 24;
       bmInfoHeader.biCompression = 0;
       bmInfoHeader.biSizeImage = (width+pad)*height*3;
       bmInfoHeader.biXPelsPerMeter = 0;
       bmInfoHeader.biYPelsPerMeter = 0;
       bmInfoHeader.biClrUsed = 0;
       bmInfoHeader.biClrImportant = 0;
   }

   if(fwrite(&bmFileHeader,sizeof(bmFileHeader),1,fp)!=1){
       fclose(fp); return(-1);
   }

   if(fwrite(&bmInfoHeader,sizeof(bmInfoHeader),1,fp)!=1){
       fclose(fp); return(-1);
   }

   index = 0;
   for(i=height-1;i>=0;i--){
       index = i*width*3;
       for(j=0;j<width;j++){
           color_vals[2] = buf[index+0];
           color_vals[1] = buf[index+1];
           color_vals[0] = buf[index+2];
           index+=3;
           if(fwrite(color_vals,sizeof(color_vals[0]),3,fp)!=3){
               fclose(fp); return(-1);
           }
       }
       if(pad){
           color_vals[0] = 0;  color_vals[1] = 0;
           color_vals[2] = 0;  color_vals[3] = 0;
           if(fwrite(color_vals,sizeof(color_vals[0]),pad,fp)!=pad){
               fclose(fp); return(-1);
           }
       }
   }

   fclose(fp);
   return(0);
}

unsigned int CDib::swap_int(unsigned int in)
{
   union{
       unsigned int all;
       struct{
           unsigned char a,b,c,d;
       } p;
   } the_bytes_in,the_bytes_out;

   the_bytes_in.all = in;
   the_bytes_out.p.a = the_bytes_in.p.d;  the_bytes_out.p.b =
the_bytes_in.p.c;
   the_bytes_out.p.c = the_bytes_in.p.b;  the_bytes_out.p.d =
the_bytes_in.p.a;
   return(the_bytes_out.all);
}

unsigned short CDib::swap_short(unsigned short in)
{
   union{
       unsigned short all;
       struct{
           unsigned char a,b;
       } p;
   } the_bytes_in,the_bytes_out;

   the_bytes_in.all = in;
   the_bytes_out.p.a = the_bytes_in.p.b;  the_bytes_out.p.b =
the_bytes_in.p.a;
   return(the_bytes_out.all);
}

unsigned char *CDib::Load(char *filename)
{
   FILE *fp;
   int i,j,id,index,index2,pad,fileLength,dibSize;
   int clrTableSize,m_numColors;
   unsigned char *buf2,*colorbuf,*pDib,*expanded_buf=NULL;
   BITMAPFILEHEADERother bmFileHeader;

   if((fp=fopen(filename, "rb"))==NULL){
       return(NULL);
   }

   fseek(fp,0,SEEK_END);
   fileLength = (int)ftell(fp);
   rewind(fp);

   if(fread(&bmFileHeader,sizeof(bmFileHeader),1,fp)!=1){
       fclose(fp); return(NULL);
   }

       // Check whether the file is really a bitmap.

   m_byteswap = 0;
   if(bmFileHeader.bfType != 0x4d42){
       if(bmFileHeader.bfType != 0x424d){
           m_pBmFileHeader = 0;
           m_pBmInfo = 0;
           m_pBmInfoHeader = 0;
           m_pRGBTable = 0;
           m_pDibBits = 0;
           m_numColors = 0;
           return(NULL);
       }
       m_byteswap = 1;
   }

       // Calculate the size of the DIB, which is the
       // file size minus the size of the file header.


   dibSize = fileLength - sizeof(bmFileHeader);
   pDib = (unsigned char*)malloc(dibSize);
   if(pDib==NULL){
       fclose(fp);
       return(NULL);
   }

       // Read the bitmap into memory and close the file.

   if(fread(pDib,dibSize,1,fp)!=1){
       fclose(fp); free(pDib); return(NULL);
   }
   fclose(fp);

       // Initialize pointers to the bitmap's BITMAPINFO
       // and BITMAPINFOHEADER structures.

   m_pBmInfo = (BITMAPINFOother *) pDib;
   m_pBmInfoHeader = (BITMAPINFOHEADERother *) pDib;

   if(m_byteswap){
       m_pBmInfoHeader[0].biSize = swap_int(m_pBmInfoHeader[0].biSize);
       m_pBmInfoHeader[0].biWidth = (int)swap_int(m_pBmInfoHeader[0].biWidth);
       m_pBmInfoHeader[0].biHeight
               = (int)swap_int(m_pBmInfoHeader[0].biHeight);
       m_pBmInfoHeader[0].biPlanes = swap_short(m_pBmInfoHeader[0].biPlanes);
       m_pBmInfoHeader[0].biBitCount
               = swap_short(m_pBmInfoHeader[0].biBitCount);
       m_pBmInfoHeader[0].biCompression
               = swap_int(m_pBmInfoHeader[0].biCompression);
       m_pBmInfoHeader[0].biSizeImage
               = swap_int(m_pBmInfoHeader[0].biSizeImage);
       m_pBmInfoHeader[0].biXPelsPerMeter
               = (int)swap_int(m_pBmInfoHeader[0].biXPelsPerMeter);
       m_pBmInfoHeader[0].biYPelsPerMeter
               = (int)swap_int(m_pBmInfoHeader[0].biYPelsPerMeter);
       m_pBmInfoHeader[0].biClrUsed
               = swap_int(m_pBmInfoHeader[0].biClrUsed);
       m_pBmInfoHeader[0].biClrImportant
               = swap_int(m_pBmInfoHeader[0].biClrImportant);
   }

   m_width = m_pBmInfoHeader->biWidth;
   m_height = m_pBmInfoHeader->biHeight;

       // Calculate a pointer to the bitmap's color table.
   m_pRGBTable = (RGBQUADother *)(pDib + m_pBmInfoHeader->biSize);

       // Get the number of colors in the bitmap.
   m_numColors = GetDibNumColors();

       // Calculate the bitmap image's size.
   m_pBmInfoHeader->biSizeImage = GetDibSizeImage();

       // Make sure the biClrUsed field
       // is initialized properly.
   if(m_pBmInfoHeader->biClrUsed == 0)
       m_pBmInfoHeader->biClrUsed = m_numColors;

       // Calculate a pointer to the bitmap's actual data.
   clrTableSize = m_numColors * sizeof(RGBQUADother);
   m_pDibBits = pDib + m_pBmInfoHeader->biSize + clrTableSize;

   buf2 = m_pDibBits;
   colorbuf = (unsigned char*)m_pRGBTable;

   m_buf = (unsigned char *)malloc(m_width*m_height*3);
   if(m_buf == (unsigned char
ULL){
       free(pDib);
       return(NULL);
   }

   switch (m_pBmInfoHeader->biCompression){
       case 0:     // BI_RGB - no compression
           break;
       case 1:     // BI_RLE8 - 8 bit run length encoding
           expanded_buf = expand8(buf2);
           if(expanded_buf==NULL){
               free(m_buf);  m_buf=NULL;
               free(pDib);   return(m_buf);
           }
           buf2 = expanded_buf;
           break;
       case 2:     // BI_RLE4 - 4 bit run length encoding
           free(m_buf);  m_buf=NULL;
           free(pDib);   return(m_buf);
           break;
       case 3:  // BI_BITFIELDS - RGB bitmap with mask
           free(m_buf);  m_buf=NULL;
           free(pDib);   return(m_buf);
           break;
   }

   switch(GetDibNumBits()){
           // case 1:  /* Still need to do this one */
       case 4:
           index = 0; index2 = 0;
           pad = 8 - (m_width & 7);
           if(pad==8) pad=0;

           if(m_noflip){
               for(i=0;i<m_height;i++){
                   for(j=0;j<m_width;j++){
                       if(index&1){
                           id = (buf2[index>>1]&0xf)*4;
                           m_buf[index2++] = colorbuf[id+2];
                           m_buf[index2++] = colorbuf[id+1];
                           m_buf[index2++] = colorbuf[id+0];

       }
                       else{
                           id = (buf2[index>>1]>>4)*4;
                           m_buf[index2++] = colorbuf[id+2];
                           m_buf[index2++] = colorbuf[id+1];
                           m_buf[index2++] = colorbuf[id+0];
                       }
                       index++;
                   }
                   index+=pad;
               }
           }
           else{
               for(i=m_height-1;i>=0;i--){
                   index2 = i*m_width*3;
                   for(j=0;j<m_width;j++){
                       if(index&1){
                           id = (buf2[index>>1]&0xf)*4;
                           m_buf[index2++] = colorbuf[id+2];
                           m_buf[index2++] = colorbuf[id+1];
                           m_buf[index2++] = colorbuf[id+0];
                       }
                       else{
                           id = (buf2[index>>1]>>4)*4;
                           m_buf[index2++] = colorbuf[id+2];
                           m_buf[index2++] = colorbuf[id+1];
                           m_buf[index2++] = colorbuf[id+0];
                       }
                       index++;
                   }
                   index+=pad;
               }
           }
           break;

       case 8:
           index = 0;  index2 = 0;
           pad = 4 - (m_width & 3);
           if(pad==4) pad=0;

           if(m_noflip){
               for(i=0;i<m_height;i++){
                   for(j=0;j<m_width;j++){
                       id = buf2[index]*4;
                       m_buf[index2++] = colorbuf[id+2];
                       m_buf[index2++] = colorbuf[id+1];
                       m_buf[index2++] = colorbuf[id+0];
                       index++;
                   }
                   index+=pad;
               }
           }
           else{
               for(i=m_height-1;i>=0;i--){
                   index2 = i*m_width*3;
                   for(j=0;j<m_width;j++){
                       id = buf2[index]*4;
                       m_buf[index2++] = colorbuf[id+2];
                       m_buf[index2++] = colorbuf[id+1];
                       m_buf[index2++] = colorbuf[id+0];
                       index++;
                   }
                   index+=pad;
               }
           }
           break;

       case 24:
           index = 0;  index2 = 0;
           pad = 4 - ((m_width*3) & 3);
           if(pad==4) pad=0;

           if(m_noflip){
               for(i=0;i<m_height;i++){
                   for(j=0;j<m_width;j++){
                       m_buf[index2++] = buf2[index+2];
                       m_buf[index2++] = buf2[index+1];
                       m_buf[index2++] = buf2[index+0];
                       index+=3;
                   }
                   index+=pad;
               }
           }
           else{
               for(i=m_height-1;i>=0;i--){
                   index2 = i*m_width*3;
                   for(j=0;j<m_width;j++){
                       m_buf[index2++] = buf2[index+2];
                       m_buf[index2++] = buf2[index+1];
                       m_buf[index2++] = buf2[index+0];
                       index+=3;
                   }
                   index+=pad;
               }
           }
           break;

       default:
           free(m_buf); m_buf=NULL;
   }

   if(expanded_buf) free(expanded_buf);
   free(pDib);
   return(m_buf);
}

int CDib::GetWidth(void)
{
   return(m_width);
}

int CDib::GetHeight(void)
{
   return(m_height);
}

unsigned int CDib::GetDibNumBits()
{
   return(m_pBmInfoHeader->biBitCount);
}

unsigned int CDib::GetDibNumColors()
{
   if ((m_pBmInfoHeader->biClrUsed == 0) &&
         (m_pBmInfoHeader->biBitCount < 9))
       return (1 << m_pBmInfoHeader->biBitCount);
   else
       return (int) m_pBmInfoHeader->biClrUsed;
}

int CDib::GetDibSizeImage()
{
   if (m_pBmInfoHeader->biSizeImage == 0)
       return GetWidth()*GetHeight();
   else
       return m_pBmInfoHeader->biSizeImage;
}

void CDib::SetNoFlip(void)
{
   m_noflip = 1;
}

#define STATE_FETCH_COUNT   0
#define STATE_DONE          1
#define STATE_FETCH_VALUE   2
#define STATE_FETCH_ESCAPE  3

unsigned char *CDib::expand8(unsigned char *src)
{
   int x,y,i,index,limit,state=STATE_FETCH_COUNT,count,count2;
   unsigned char *buf,value;

   buf = (unsigned char *)malloc(m_width*(m_height+1));
   if(buf==NULL) return(NULL);

   limit = m_width*m_height;
   index = x = y = 0;

   while(state!=STATE_DONE){
       switch(state){
           case STATE_FETCH_COUNT:
               count = *src++;
               if(count==0)
                   state = STATE_FETCH_ESCAPE;
               else
                   state = STATE_FETCH_VALUE;
               break;

           case STATE_FETCH_VALUE:
               value = *src++;

(i=0;i<count;i++){
                   buf[index++] = value;
                   x++;
                   if(x>m_width){ x = 0; y++; }
               }
               if(index>limit) return(buf);
               state = STATE_FETCH_COUNT;
               break;

           case STATE_FETCH_ESCAPE:
               value = *src++;
               switch(value){
                   case 0: // End of line
                       if(x!=0){
                           for(;x<m_width;x++) buf[index++] = 0;
                           x = 0;  y++;
                       }
                       break;
                   case 1: //end of bitmap
                       return(buf);
                       break;
                   case 2: // Delta
                       count = *src++;
                       count2 = *src++;
                       count += (count
2*m_width);

(i=0;i<count;i++){
                           buf[index++] = 0;
                           x++;
                           if(x>m_width){ x = 0; y++; }
                           if(index>limit) return(buf);
                       }
                       break;

                   default: //  Absolute mode
                       for(i=0;i<value;i++){
                           buf[index++] = *src++;
                           x++;
                           if(x>m_width){ x = 0; y++; }
                           if(index>limit) return(buf);
                       }
                       if(value&1) src++;  // Must end on word boundary
                       break;
               }
               state = STATE_FETCH_COUNT;
               break;
       }
   }
   return(buf);
}


int CDib::MakeDib(unsigned char *image,int width,int height)
{
   int i,j,s_index,d_index,pad;

   if(mImage){
       free(mImage);  m_width = m_height=0;
   }
   mImage = (unsigned char *)malloc(height*(width+3)*3);
   if(mImage==NULL){  m_width = m_height=0;  return(-1); }

   pad = 4 - ((width*3) & 3);  if(pad==4) pad=0;

       // Convert RGB to BGR, flip and pad (Stupid Windows!)

   d_index = 0;
   for(i=height-1;i>=0;i--){
       s_index = i*width*3;
       for(j=0;j<width;j++){
           mImage[d_index+0] = image[s_index+2];
           mImage[d_index+1] = image[s_index+1];
           mImage[d_index+2] = image[s_index+0];
           d_index += 3;  s_index+=3;
       }
       d_index += pad;
   }

   m_bmInfoHeader.biSize = sizeof(m_bmInfoHeader);
   m_bmInfoHeader.biWidth = width;
   m_bmInfoHeader.biHeight = height;
   m_bmInfoHeader.biPlanes = 1;
   m_bmInfoHeader.biBitCount = 24;
   m_bmInfoHeader.biCompression = 0;
   m_bmInfoHeader.biSizeImage = (width+pad)*height*3;
   m_bmInfoHeader.biXPelsPerMeter = 0;
   m_bmInfoHeader.biYPelsPerMeter = 0;
   m_bmInfoHeader.biClrUsed = 0;
   m_bmInfoHeader.biClrImportant = 0;

   m_bmInfo.bmiHeader = m_bmInfoHeader;
       //m_bmInfo.bmiColors = NULL;

   m_width = width;  m_height = height;

   return(0);
}

void CDib::DrawDib(CDC* pDC,int x,int y,int width,int height)
{
   ::SetStretchBltMode(pDC->m_hDC,COLORONCOLOR);
   ::StretchDIBits( pDC->m_hDC
                   ,x               // DestX
                   ,y               // DestY
                   ,width           // nDestWidth
                   ,height          // nDestHeight
                   ,0               // SrcX
                   ,0               // SrcY
                   ,m_width         // wSrcWidth
                   ,m_height        // wSrcHeight
                   ,mImage          // lpBits
                   ,&m_bmInfo       // lpBitsInfo
                   ,DIB_RGB_COLORS  // wUsage
                   ,SRCCOPY);       // dwROP
}

---

www.piclist.com/member/ted_rossin-agilent-com
PIC/PICList FAQ: http://www.piclist.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\03\22@001126 by MegaBolt

flavicon
picon face
try

http://www.wotsit.org/search.asp?s=graphics

a source of computer file formats.

james

----- Original Message -----
From: "Peter L. Peres" <.....plpKILLspamspam@spam@ACTCOM.CO.IL>
To: <PICLISTspamKILLspamMITVMA.MIT.EDU>
Sent: Wednesday, March 20, 2002 12:14 PM
Subject: [OT]: Dissecting a .BMP file


{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu


2002\03\22@052054 by Quentin

flavicon
face
MegaBolt wrote:
>
> try
>
> http://www.wotsit.org/search.asp?s=graphics
>
> a source of computer file formats.
Somebody already send me this link and that is where I found my answers.
Thanks all.
(It is actually very easy to do...)

Quentin

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspam_OUTspamTakeThisOuTmitvma.mit.edu


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...