BMP文件格式

来源:互联网 发布:淘宝卖家信誉1 啥意思 编辑:程序博客网 时间:2024/06/01 07:12
typedef struct tagBITMAPINFOHEADER{  DWORD  biSize;   LONG   biWidth;   LONG   biHeight;   WORD   biPlanes;   WORD   biBitCount;   DWORD  biCompression;   DWORD  biSizeImage;   LONG   biXPelsPerMeter;   LONG   biYPelsPerMeter;   DWORD  biClrUsed;   DWORD  biClrImportant; } BITMAPINFOHEADER, *PBITMAPINFOHEADER; 


biHeight
Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner. IfbiHeight is negative, the bitmap is a top-down DIB and its origin is the upper-left corner.

If biHeight is negative, indicating a top-down DIB, biCompression must be either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed.

Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, thebiHeight member specifies the height of the decompressed JPEG or PNG image file, respectively. 

DIB位图也有两种形式,即:底到上型DIB(bottom-up),和顶到下型DIB(top-down)。底到上型DIB的原点(origin)在图像的左下角,而顶到下型DIB的原点在图像的左上角。如果DIB的高度值(由BITMAPINFOHEADER结构中的biHeight成员标识)是一个正值,那么就表明这个DIB是一个底到上型DIB,如果高度值是一个负值,那么它就是一个顶到下型DIB。注意:顶到下型的DIB位图是不能被压缩的。