The BITMAPINFO and BITMAPCOREINFO data structures define the dimensions and color information for Windows 3.0 and Presentation Manager 1.2 DIBs, respectively. They are defined as follows:
Windows 3.0 DIB | Presentation Manager 1.2 DIB |
typedef struct tagBITMAPINFO { { BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; } BITMAPINFO; | typedef struct _BITMAPCOREINFO { BITMAPCOREHEADER bmciHeader; RGBTRIPLE bmciColors[1]; } BITMAPCOREINFO; |
These structures are essentially alike, and this section discusses them simultaneously. Each field name for the Windows BITMAPINFO structure is followed by the corresponding field name for the Presentation Manager BITMAPCOREINFO 1.2 structure, in parentheses.
The following table describes the fields.
Windows Field (PM Field) |
Description |
bmiHeader (bmciHeader) | Specifies information about the dimensions and color format of the DIB. The BITMAPINFOHEADER and BITMAPCOREHEADER data structures are described in the next section. |
bmiColors (bmciColors) | Specifies the DIB color table. The RGBQUAD and RGBTRIPLE data structures are described in “Bitmap Color Table,” later in this chapter. |
The BITMAPINFOHEADER and BITMAPCOREHEADER structures contain information about the dimensions and color format of Windows 3.0 and Presentation Manager 1.2 DIBs, respectively. They are defined as follows:
Windows 3.0 DIB | Presentation Manager 1.2 DIB |
typedef struct tagBITMAPINFOHEADER{ { DWORD biSize; DWORD biWidth; DWORD biHeight; WORD biPlanes; WORD biBitCount; DWORD biCompression; DWORD biSizeImage; DWORD biXPelsPerMeter; DWORD biYPelsPerMeter; DWORD biClrUsed; DWORD biClrImportant; } BITMAPINFOHEADER; | typedef struct tagBITMAPCOREHEADER { DWORDbcSize; WORDbcWidth; WORDbcHeight; WORDbcPlanes; WORDbcBitCount; } BITMAPCOREHEADER; |
Because these structures are essentially alike, except for the added fields in the Windows 3.0 structure, this section discusses them simultaneously. Each field name for the Windows structure is followed by the corresponding field name for the Presentation Manager structure, in parentheses.
The following fields are present in both the Windows 3.0 and Presentation Manager 1.2 formats:
Windows (PM) Field | Description |
biSize (bcSize) | Specifies the number of bytes required by the BITMAPINFOHEADER structure. You can use this field to distinguish between Windows 3.0 and Presentation Manager 1.2 DIBs. |
biWidth (bcWidth) | Specifies the width of the DIB in pixels. |
biHeight (bcHeight) | Specifies the height of the DIB in pixels. |
biPlanes (bcPlanes) | Specifies the number of planes for the target device. Must must be set to 1. |
biBitCount (bcBitCount) | Specifies the number of bits-per-pixel. See “Interpreting the Color Table,” later in this section, for more information. |
The following fields are present only in the Windows 3.0 BITMAPINFOHEADER structure:
Field | Description |
biCompression | Specifies the type of compression for a compressed bitmap. It can be one of the following values: | ||
Value | Meaning | ||
BI_RGB | Specifies that the bitmap is not compressed. | ||
BI_RLE8 | Specifies a run-length encoded format for bitmaps with 8 bits-per-pixel. The compression format is a two-byte format consisting of a count byte followed by a color-index byte. | ||
BI_RLE4 | Specifies a run-length encoded format for bitmaps with 4 bits-per-pixel. The compression format is a two-byte format consisting of a count byte followed by two word-length color indexes. |
See “Windows 3.0 Bitmap Compression Formats” later in this document for information about the encoding schemes. | |||
biSizeImage | Specifies the size in bytes of the image. | ||
biXPelsPerMeter | Specifies the horizontal resolution in pixels per meter of the target device for the bitmap. An application can use this value to select a bitmap from a resource group that best matches the characteristics of the current device. | ||
biYPelsPerMeter | Specifies the vertical resolution in pixels per meter of the target device for the bitmap. | ||
biClrUsed | Specifies the number of color values in the color table actually used by the bitmap. Possible values follow. | ||
Value | Result | ||
0 | Bitmap uses the maximum number of colors corresponding to the value of the biBitCount field. | ||
Nonzero | If the biBitCount is less than 24, the actual number of colors which the graphics engine or device driver will access. | ||
If the biBitCount field is set to 24, the size of the reference color table used to optimize performance of Windows color palettes. |
If the bitmap is a “packed” bitmap (that is, a bitmap in which the bitmap array immediately follows the BITMAPINFO header and which is referenced by a single pointer), the biClrUsed field must be set to 0 or to the actual size of the color table. See “Interpreting the Color Table,” later in this section, for more information on how this field affects the interpretation of the color table. | ||
biClrImportant | Specifies the number of color indexes that are considered important for displaying the bitmap. If this value is 0, then all colors are important. |