The following example determines the buffer size needed for the data specifying the decompression format using the ICDecompressGetFormatSize macro, allocates a buffer of the appropriate size using the GlobalAlloc function, and retrieves the decompression format information using the ICDecompressGetFormat macro.
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// Assume *lpbiIn points to the input (compressed) format.
dwFormatSize = ICDecompressGetFormatSize(hIC, lpbiIn);
h = GlobalAlloc(GHND, dwFormatSize);
lpbiOut = (LPBITMAPINFOHEADER)GlobalLock(h);
ICDecompressGetFormat(hIC, lpbiIn, lpbiOut);
The following example shows how an application can use the ICDecompressQuery macro to determine if a decompressor can handle the input and output formats.
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// Assume *lpbiIn & *lpbiOut are initialized to the respective
// formats.
if (ICDecompressQuery(hIC, lpbiIn, lpbiOut) == ICERR_OK)
{
// Format is supported - use the decompressor.
}
The following code fragment shows how to get the palette information using the ICDecompressGetPalette macro.
ICDecompressGetPalette(hIC, lpbiIn, lpbiOut);
// Move up to the palette.
lpPalette = (LPBYTE)lpbiOut + lpbi->biSize;