Bestimmen des Ausgabeformats eines Dekomprimierers

Im folgenden Beispiel wird die Puffergröße bestimmt, die für die Daten erforderlich ist, die das Dekomprimierungsformat mithilfe des ICDecompressGetFormatSize-Makros angeben, einen Puffer der entsprechenden Größe mithilfe der GlobalAlloc-Funktion zuordnet und die Dekomprimierungsformatinformationen mithilfe des ICDecompressGetFormat-Makros abruft.

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); 
 

Das folgende Beispiel zeigt, wie eine Anwendung das ICDecompressQuery-Makro verwenden kann, um zu bestimmen, ob ein Dekomprimierer die Eingabe- und Ausgabeformate verarbeiten kann.

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. 
    
} 
 

Das folgende Codefragment zeigt, wie Sie die Paletteninformationen mithilfe des IcDecompressGetPalette-Makros abrufen.

ICDecompressGetPalette(hIC, lpbiIn, lpbiOut); 
 
// Move up to the palette. 
lpPalette = (LPBYTE)lpbiOut + lpbi->biSize;