Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This structure contains information about the dimensions and color format of a device-independent bitmap (DIB).
Syntax
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; |
Members
- biSize
-
Specifies the size of the structure, in bytes.
This size does not include the color table or the masks mentioned in the biClrUsedmember.
See the Remarks section for more information.
- biWidth
-
Specifies the width of the bitmap, in pixels.
- biHeight
-
Specifies the height of the bitmap, in pixels.
If biHeightis positive, the bitmap is a bottom-up DIB and its origin is the lower left corner.
If biHeightis negative, the bitmap is a top-down DIB and its origin is the upper left corner.
If biHeightis negative, indicating a top-down DIB, biCompressionmust be either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed.
- biPlanes
-
Specifies the number of planes for the target device.
This value must be set to 1.
- biBitCount
-
Specifies the number of bits per pixel.
The biBitCountmember of the BITMAPINFOHEADERstructure determines the number of bits that define each pixel and the maximum number of colors in the bitmap.
This member must be one of the following values.
Value Description 1
The bitmap is monochrome, and the bmiColorsmember contains two entries.
Each bit in the bitmap array represents a pixel.
If the bit is clear, the pixel is displayed with the color of the first entry in the bmiColorstable.
If the bit is set, the pixel has the color of the second entry in the table.
2
The bitmap has four possible color values.
4
The bitmap has a maximum of 16 colors, and the bmiColorsmember contains up to 16 entries.
Each pixel in the bitmap is represented by a 4-bit index into the color table.
For example, if the first byte in the bitmap is 0x1F, the byte represents two pixels. The first pixel contains the color in the second table entry, and the second pixel contains the color in the sixteenth table entry.
8
The bitmap has a maximum of 256 colors, and the bmiColorsmember contains up to 256 entries. In this case, each byte in the array represents a single pixel.
16
The bitmap has a maximum of 2^16 colors.
If the biCompressionmember of the BITMAPINFOHEADERis BI_RGB, the bmiColorsmember is NULL.
Each WORDin the bitmap array represents a single pixel. The relative intensities of red, green, and blue are represented with 5 bits for each color component.
The value for blue is in the least significant 5 bits, followed by 5 bits each for green and red.
The most significant bit is not used. The bmiColorscolor table is used for optimizing colors used on palette-based devices, and must contain the number of entries specified by the biClrUsedmember of the BITMAPINFOHEADER.
24
The bitmap has a maximum of 2^24 colors, and the bmiColorsmember is NULL.
Each 3-byte triplet in the bitmap array represents the relative intensities of blue, green, and red, respectively, for a pixel.
The bmiColorscolor table is used for optimizing colors used on palette-based devices, and must contain the number of entries specified by the biClrUsedmember of the BITMAPINFOHEADER.
32
The bitmap has a maximum of 2^32 colors. If the biCompressionmember of the BITMAPINFOHEADERis BI_RGB, the bmiColorsmember is NULL. Each DWORDin the bitmap array represents the relative intensities of blue, green, and red, respectively, for a pixel. The high byte in each DWORDis not used. The bmiColorscolor table is used for optimizing colors used on palette-based devices, and must contain the number of entries specified by the biClrUsedmember of the BITMAPINFOHEADER.
If the biCompressionmember of the BITMAPINFOHEADERis BI_BITFIELDS, the bmiColorsmember contains three DWORDcolor masks that specify the red, green, and blue components, respectively, of each pixel.
Each DWORDin the bitmap array represents a single pixel.
- biCompression
-
Specifies the type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be compressed). This member can be one of the following values.
Value Description BI_RGB
An uncompressed format.
BI_BITFIELDS
Specifies that the bitmap is not compressed and that the color table consists of three DWORD color masks that specify the red, green, and blue components of each pixel.
This is valid when used with 16- and 32-bpp bitmaps.
This value is valid in Windows Embedded CE versions 2.0 and later.
BI_ALPHABITFIELDS
Specifies that the bitmap is not compressed and that the color table consists of four DWORD color masks that specify the red, green, blue, and alpha components of each pixel.
This is valid when used with 16- and 32-bpp bitmaps.
This value is valid in Windows CE .NET 4.0 and later.
You can OR any of the values in the above table with BI_SRCPREROTATE to specify that the source DIB section has the same rotation angle as the destination.
- biSizeImage
-
Specifies the size, in bytes, of the image.
This may be set to zero for BI_RGB bitmaps.
- 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 indexes in the color table that are actually used by the bitmap.
If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCountmember for the compression mode specified by biCompression.
If biClrUsedis nonzero and the biBitCountmember is less than 16, the biClrUsedmember specifies the actual number of colors the graphics engine or device driver accesses.
If biBitCountis 16 or greater, the biClrUsedmember specifies the size of the color table used to optimize performance of the system color palettes.
If biBitCountequals 16 or 32, the optimal color palette starts immediately following the three DWORDmasks.
If the bitmap is a packed bitmap (a bitmap in which the bitmap array immediately follows the BITMAPINFOheader and is referenced by a single pointer), the biClrUsedmember must be either zero or the actual size of the color table.
- biClrImportant
-
Specifies the number of color indexes required for displaying the bitmap.
If this value is zero, all colors are required.
Remarks
The BITMAPINFOstructure combines the BITMAPINFOHEADERstructure and a color table to provide a complete definition of the dimensions and colors of a DIB.
An application should use the information stored in the biSizemember to locate the color table in a BITMAPINFOstructure, as follows.
Copy Code | |
---|---|
pColor = ((LPSTR)pBitmapInfo + (WORD)(pBitmapInfo->bmiHeader.biSize)); |
For Windows Embedded CE versions 1.0 and 1.01, the biBitCountmember must be either one or two.
Requirements
Header | windows.h |
Windows Embedded CE | Windows CE 1.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |