Auffinden und Öffnen von Kompressoren und Dekomprimatoren
[Das feature, das dieser Seite zugeordnet ist, der Videokomprimierungs-Manager, ist ein Legacyfeature. Microsoft empfiehlt dringend, dass neuer Code dieses Feature nicht verwendet.]
Im folgenden Beispiel wird die ICLocate-Funktion verwendet, um einen Kompressor zu finden, der eine Bitmap mit 8 Bit pro Pixel komprimieren kann.
BITMAPINFOHEADER bih;
HIC hIC
// Initialize the bitmap structure.
bih.biSize = sizeof(BITMAPINFOHEADER);
bih.biWidth = bih.biHeight = 0;
bih.biPlanes = 1;
bih.biCompression = BI_RGB; // standard RGB bitmap
bih.biBitcount = 8; // 8 bits-per-pixel format
bih.biSizeImage = 0;
bih.biXPelsPerMeter = bih.biYPelsPerMeter = 0;
bih.biClrUsed = bih.biClrImportant = 256;
hIC = ICLocate (ICTYPE_VIDEO, 0L, (LPBITMAPINFOHEADER) &bih,
NULL, ICMODE_COMPRESS);
Im folgenden Beispiel werden die Dekomprimierungselemente im System aufgelistet, um einen zu finden, der das Format seiner Bilder verarbeiten kann. In diesem Beispiel werden ICTYPE_VIDEO (entspricht dem vierstelligen VIDC-Code) und das ICDecompressQuery-Makro verwendet, um zu ermitteln, ob ein Kompressor oder Dekomprimierungsprozessor das Bildformat unterstützt.
for (i=0; ICInfo(fccType, i, &icinfo); i++)
{
hic = ICOpen(icinfo.fccType, icinfo.fccHandler, ICMODE_QUERY);
if (hic)
{
// Skip this compressor if it can't handle the format.
if (fccType == ICTYPE_VIDEO && pvIn != NULL &&
ICDecompressQuery(hic, pvIn, NULL) != ICERR_OK)
{
ICClose(hic);
continue;
}
// Find out the compressor name.
ICGetInfo(hic, &icinfo, sizeof(icinfo));
// Add it to the combo box.
n = ComboBox_AddString(hwndC,icinfo.szDescription);
ComboBox_SetItemData(hwndC, n, hic);
}
}
Im folgenden Beispiel wird versucht, einen bestimmten Kompressor zu suchen, um das 8-Bit-RGB-Format in ein 8-Bit-RLE-Format zu komprimieren.
BITMAPINFOHEADER bihIn, bihOut;
HIC hIC
// Initialize the bitmap structure.
biSize = bihOut.biSize = sizeof(BITMAPINFOHEADER);
bihIn.biWidth = bihIn.biHeight = bihOut.biWidth = bihOut.biHeight = 0;
bihIn.biPlanes = bihOut.biPlanes= 1;
bihIn.biCompression = BI_RGB; // standard RGB bitmap for input
bihOut.biCompression = BI_RLE8; // 8-bit RLE for output format
bihIn.biBitcount = bihOut.biBitCount = 8; // 8 bits-per-pixel format
bihIn.biSizeImage = bihOut.biSizeImage = 0;
bihIn.biXPelsPerMeter = bih.biYPelsPerMeter =
bihOut.biXPelsPerMeter = bihOut.biYPelsPerMeter = 0;
bihIn.biClrUsed = bih.biClrImportant =
bihOut.biClrUsed = bihOut.biClrImportant = 256;
hIC = ICLocate (ICTYPE_VIDEO, 0L,
(LPBITMAPINFOHEADER)&bihIn,
(LPBITMAPINFOHEADER)&bihOut, ICMODE_COMPRESS);
Zugehörige Themen