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

Leonardo: The ConvertDIB function

Converts a 1, 4, 8, 16, 24, 32 or 48 bit DIB to a DIB of a new color depth. Optimized for generation of 32 bit DIBs.

HDIB FAR * lphdib,
UINT uNewBitCount,
DWORD dwReserved);

lphdib HDIB FAR * Variable pointer to an HDIB. When passed to the function, it should contain the handle of the source dib. On completion, the handle is the handle of the output DIB.

uNewBitCount UINT Desired color depth for the new DIB (1, 4, 8, 16, 24, 32 or 48 bits)

dwReserved DWORD Reserved for future use. Should be specified as 0.


Returns TRUE if the function was successful, otherwise FALSE. Conversion failure is usually due to insufficient memory to complete the operation.


The value of the DIB handle becomes the handle of the destination DIB on return. Since the conversion is executed "in-place", the original handle becomes invalid and cannot used after conversion any more. The source DIB's handle cannot and should not be deleted by the application.

In many cases, the returned handle will be identical to the source DIB's handle.

Requirements for source DIBs


DaVinci Professional includes optimized routines for conversion to 32 bit DIBs. Code is optimized for speed and color depth adjustment occurs "in-place", meaning that no temporary storage is required during the operation.