#include "BITIFF.H"
BOOL CALLBACK DecodeTiffImage( TIFFFILE hChain,
int nImage,
UINT wFirstStrip,
UINT wNumLines,
INT_PTR lUserData,
FILLPROC lpLineFn)
Description
Uncompresses an image from a TIFF file. The decoded image data can be retrieved line by line through the user defined callback function.
Parameters
|
TIFFFILE |
hChain |
TIFF image chain handle. |
|
int |
nImage |
Index of the image in the chain. |
|
UINT |
wFirstStrip |
First strip to decode. Strips are counted from 0. |
|
UINT |
wNumLines |
Number of lines to decode. It must be 0 if all remaining lines must be decoded. |
|
INT_PTR |
lUserData |
User defined info. It is passed to the callback function as a third parameter unchanged. |
|
FILLPROC |
lpLineFn |
Callback function that will get the decoded DIB lines. |
Return values
TRUE on success, FALSE if failed. It sets the error flag to TUNKNOWNCOMPRESSION if the compression type of the image is not supported, or to TCOMPRESSIONFAILED if the decompression has failed. If you have specified more lines than the image has, the function will return with TENDOFDATA. Actually it is not an error in this case, because all the lines were successfully decoded.
Programming notes
The callback function pointed by the lpLineFn parameter must use the Pascal calling convention and must have the following form:
int CALLBACK LineFn(LPSTR lpLineBuff, int nLine, INT_PTR lParam)
LineFn is a placeholder for the application-supplied function name. You can use any other name for this purpose.
Parameters
|
LPSTR |
lpLineBuff |
Buffer containing a single line uncompressed DIB (of course, without header). |
|
int |
nLine |
Index of the required line. Line numbers are started from zero. |
|
INT_PTR |
lParam |
The lUserData parameter of the DecodeTiffImage() function. The user can use this parameter freely. |
Return values
Error status. TOK if OK.
Using a callback function for this purpose provides you with the possibility for advanced bitmap handling (e.g. direct image transport to clipboard, DDE pipe, to another file from TIFF). So you are not forced to keep the whole - possibly huge - image in your applications memory.
Requirements
Header : Declared in BiTiff.h; include BiTiff.h.
Library : Use BiTIFF.lib.
DLLs : BiTiff.dll.
References to related functions
See DecodeCcittImage(), EncodeTiffImage() and EncodeCcittImage().
Code example
See example at DecodeCcittImage().