BITMAPINFO

The BITMAPINFO structure defines the dimensions and color information for a Win32 device-independent bitmap (DIB).

typedef struct tagBITMAPINFO { // bmi 
    BITMAPINFOHEADER bmiHeader; 
    RGBQUAD          bmiColors[1]; 
} BITMAPINFO; 

Members

bmiHeader
Specifies a bitmap information header structure that contains information about the dimensions of color format. The bitmap information header structure is version related.

Windows NT 3.51 and earlier: Use the BITMAPINFOHEADER structure.

Windows NT 4.0 and Windows 95: Use the BITMAPV4HEADER structure.

Windows 98, Windows NT 5.0 and later: Use BITMAPV5HEADER structure.

bmiColors
The bmiColors member contains one of the following:

Platform differences are listed in the following table.
Operating System Description
Windows NT 3.51 and earlier The number of entries in the array depends on the values of the biBitCount and biClrUsed members of the BITMAPINFOHEADER structure.
Windows NT 4.0 and Windows 95 The number of entries in the array depends on the values of the bV4BitCount and bV4ClrUsed members of the BITMAPV4HEADER structure.
Windows NT 5.0 and Windows 98 The number of entries in the array depends on the values of the bV5BitCount and bV5ClrUsed members of the BITMAPV5HEADER structure.

The colors in the bmiColors table appear in order of importance. For more information, see the following Remarks section.

Remarks

A device-independent bitmap consists of two distinct parts: a BITMAPINFO structure describing the dimensions and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in the array are packed together, but each scan line must be padded with zeroes to end on a LONG data-type boundary. If the height of the bitmap is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner. If the height is negative, the bitmap is a top-down DIB and its origin is the upper left corner.

A bitmap is packed when the bitmap array immediately follows the BITMAPINFO header. Packed bitmaps are referenced by a single pointer. For packed bitmaps, the ClrUsed member must be set to an even number when using the DIB_PAL_COLORS mode so the DIB bitmap array starts on a DWORD boundary.

Note  The bmiColors member should not contain palette indexes if the bitmap is to be stored in a file or transferred to another application.

Unless the application has exclusive use and control of the bitmap, the bitmap color table should contain explicit RGB values.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 1.0 or later.
  Header: Declared in wingdi.h.

See Also

Bitmaps Overview, Bitmap Structures, CreateDIBitmap, CreateDIBPatternBrush, CreateDIBSection, RGBQUAD