The operating system uses the same file format for bitmaps, icons, and pointers in resource files. In the following description, "bitmap" refers to bitmaps, icons, and pointers unless otherwise specified.
Two formats are supported. In the first, a single-size version of the bitmap is defined. This is used whatever the target device.
The second format allows multiple versions of the bitmap to be defined, including one or more device-independent versions, and a number of device-dependent versions, each intended for use with a particular device.
In the case of icons and pointers, when more than one version of the bitmap exists, the preferred version is one that matches the device size of the icon or pointer; otherwise, the device-independent version is used to scale a bitmap to the required size.
The operating system provides pointers that match the requirements of the display device in use, typically pointers are 32x32 pels, one bit per plane.
Icons provided with the operating system are designed to match the requirements of the most common display devices. The following versions of each icon are included in each file:
32x32 4 bpp (16 color)
40x40 4 bpp (16 color)
32x32 1 bpp (black and white)
20x20 1 bpp (black and white)
16x16 1 bpp (black and white)
The 32x32 versions are designed for VGA displays and for device-independent use.
The 40x40 version is for 8514/A and XGA displays.
The 20x20 and 16x16 are half-size icons designed for use as mini-icons.
For general bitmaps, which may be of arbitrary size, the preferred version is one matching the requested bitmap size; otherwise one matching the display size is selected. If neither is available, the device-independent version is used from which to scale a bitmap.
For both formats, the definition consists of two sections. The first section contains general information about the type, dimensions, and other attributes of the resource. The second section contains data describing the pels that make up the bitmap(s), and is in the format specified in Bitmap Data.
In the multiple-version format, the first section contains an array of BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2 structures.
The device-independent version must be the first BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2 defined.
In the single-size format, the BITMAPARRAYFILEHEADER or BITMAPARRAYFILEHEADER2 structure is not present. The definition consists of one or two BITMAPFILEHEADER or BITMAPFILEHEADER2 structures.
For icons and pointers, the cy field in bmp is actually twice the pel height of the image that appears on the screen. This is because these types actually contain two full bitmap pel definitions. The first bitmap definition is the XOR mask, which contains invert information (0 = no invert, 1 = invert) for the pointer or icon. The second is the AND mask, which determines whether the pointer or the screen is shown (0 = black/white, 1 = screen/inverse screen).
For color icons or pointers, there are two bitmaps involved: one that is black and white and consists of an AND and an XOR mask, and one that is color that defines the color content.
The cy field in the BITMAPINFOHEADER2 structure for the color bitmap must be the real height, that is, half the value specified for the black and white bitmap. The cx must be the same.
The following table shows how these two bitmaps are used for a color icon or pointer:
XOR AND COLOR 1 1 x Invert screen 0 0 x Use color x 0 1 x Transparency 1 0 x Use color x
For color icons or pointers, two BITMAPFILEHEADER or BITMAPFILEHEADER2 structures are therefore required:
BITMAPFILEHEADER2 with usType BFT_COLORICON or BFT_COLORPOINTER BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2) Color table BITMAPFILEHEADER2 with same usType BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2) Color table ** bits for one bitmap ** ** bits for other bitmap **The usType for the first BITMAPFILEHEADER2 is either BFT_COLORICON or BFT_COLORPOINTER. This means that a second BITMAPFILEHEADER2 is present as part of the definition of a color icon or pointer. The first The first BITMAPFILEHEADER2 structure contains the information for the black and white AND and XOR masks, while the second BITMAPFILEHEADER2 structure contains the information for the color part of the pointer or icon.
BITMAPFILEHEADER and BITMAPINFOHEADER can occur in place of BITMAPFILEHEADER2 and BITMAPINFOHEADER2 in this example.
For the multiple version format, the file is as follows:
BITMAPARRAYFILEHEADER2 for device-independent version BITMAPFILEHEADER2 (part of BITMAPARRAYFILEHEADER2) BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2) Color table BITMAPFILEHEADER2 ) BITMAPINFOHEADER2 ) only if this is a color icon or pointer Color table ) BITMAPARRAYFILEHEADER2 for first device-dependent version BITMAPFILEHEADER2 (part of BITMAPARRAYFILEHEADER2) BITMAPINFOHEADER2 (part of BITMAPFILEHEADER2) Color table BITMAPFILEHEADER2 ) BITMAPINFOHEADER2 ) only if this is a color icon or pointer Color table ) Further BITMAPARRAYFILEHEADER2 groups occur here as required for additional device-dependent versions ** bits for one bitmap ** ** bits for next bitmap ** And so on for as many bitmaps as necessary.
As before, BITMAPARRAYFILEHEADER, BITMAPFILEHEADER, and BITMAPINFOHEADER, can occur in place of BITMAPARRAYFILEHEADER2, BITMAPFILEHEADER2, and BITMAPINFOHEADER2