Determining a Compressor's Output Format

The following example uses the ICCompressGetFormat size macro to determine the buffer size needed for the data specifying the compression format, allocates a buffer of the appropriate size using the GlobalAlloc function, and retrieves the compression format information using the ICCompressGetFormat macro.


// *lpbiIn must be initialized to the input format.

dwFormatSize = ICCompressGetFormatSize(hIC, lpbiIn);

h = GlobalAlloc(GHND, dwFormatSize);

lpbiOut = (LPBITMAPINFOHEADER)GlobalLock(h);

ICCompressGetFormat(hIC, lpbiIn, lpbiOut);

The following example uses the ICCompressQuery macro to determine whether a compressor can handle the input and output formats.


// Both *lpbiIn and *lpbiOut must be initialized to the respective
// formats.

if (ICCompressQuery(hIC, lpbiIn, lpbiOut) == ICERR_OK)


// Format is supported; use the compressor.


The following example uses the ICCompressGetSize macro to determine the buffer size, and it allocates a buffer of that size using GlobalAlloc.

// Find the worst-case buffer size.

dwCompressBufferSize = ICCompressGetSize(hIC, lpbiIn, lpbiOut);

// Allocate a buffer and get lpOutput to point to it.

h = GlobalAlloc(GHND, dwCompressBufferSize);

lpOutput = (LPVOID)GlobalLock(h);

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database