|
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.
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// *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.
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// 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);
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
More Online Helps
Win32 Programmer's Reference (win32.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|