| Herd Software Development
DaVinci Graphics Library
DaVinci Documentation Home Search Order


Microsoft's DIB data format underwent an update with Windows 4.0 and Windows 95. DIBs can now optionally use a BITMAPV4HEADER structure in place of a BITMAPINFOHEADER structure. The the new structure starts with the same fields as BITMAPINFOHEADER structure, and additional fields used by the new format follow these standard fields. All other structures (color palettes, bits) are located after this new, larger header. The biSize field ia used to specify whether a DIB is based on BITMAPINFOHEADER or BITMAPV4HEADER.

BiSize Value Compatibility
Sizeof(BITMAPCOREHEADER) 0x0c DIB OS/2 1.3 compatible
Sizeof(BITMAPINFOHEADER) 0x28 DIB Windows 3.1 compatible
Sizeof(BITMAPV4HEADER) 0x6c Windows 95 / DIB NT 4.0
Sizeof(BITMAPV5HEADER) Windows 98 / DIB NT 5.0

type definition
type definition
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;
typedef struct 
DWORD bV4Size;
LONG bV4Width;
LONG bV4Height;
WORD bV4Planes;
WORD bV4BitCount;
DWORD bV4V4Compression;
DWORD bV4SizeImage;
LONG bV4XPelsPerMeter;
LONG bV4YPelsPerMeter;
DWORD bV4ClrUsed;
DWORD bV4ClrImportant;
DWORD bV4RedMask;
DWORD bV4GreenMask;
DWORD bV4BlueMask;
DWORD bV4AlphaMask;
DWORD bV4GammaRed;
DWORD bV4GammaGreen;
DWORD bV4GammaBlue;

The fields used by the BITMAPV4HEADER structure correspond to those of BITMAPINFOHEADER structure with the addition of a few supplementary fields as shown above.

Use in DaVinci

DaVinci uses the BITMAPV4HEADER structure when it needs to work with DIBs in special formats which need to contain information which cannot be recorded in the BITMAPINFOHEADER structure:

Identifier of a CMYK-DIB

The field bV4CSType, which takes the following (Color Space Type) values, can identify the DIB as CMYK, as follows:

Symbolic constant Value Meaning
LCS_CALIBRATED_RGB 0 The DIB uses the normalized sRGB colour space defined by ICM
LCS_DEVICE_RGB 1 The DIB uses the device dependent RGB colour space defined by a display device. This is the definition used by the older BITMAPINFOHEADER.
LCS_DEVICE_CMYK 2 The DIB uses the device dependent CMYK colour space defined by a printer.

Since the DIB is stored at 8 bits per CMYK component, bV4BitCount equivalent to biBitCount = 32.

Identifier of a RGBA-DIB

To specify an RGBA DIB, the bV4AlphaMask field is set to a non-zero value. Since the DIB is stored with 8 bits per RGB and alpha component, bV4BitCount equivalent to biBitCount = 32.

RGBA DIBs are treated by Windows functions in the same way as other DIBs. The Alpha channel is being used by the DIBAlphaBlend function.


The BITMAPV4HEADER structure is defined for newer 32 bit compilers in the WINGDI.H header shipped with the compiler.

For 16-Bit Compilers this structure is not defined in WINDOWS.H, for that reason it was included into the header-file LEONARDO.H header shipped with DaVinci.

See also