#include "BITIFF.H"
BOOL CALLBACK GetTiffImageInfoBuffer( TIFFFILE hChain,
int iImage,
UINT wTagID,
HANDLE FAR *lphData,
UINT FAR *lpwType,
DWORD FAR *lpdwCount)
Description
Generalized information function on TIFF images. Refer to the desired information field by its tag identifier. You will get information about the field in *lpwType, *lpdwCount and in a memory block referred by *lphData. No information is passed back to parameters equal to NULL. There is a pseudo-tag named as EXISTINGTAGS. Using this tag ID you will get a list of all existing tag IDs of the image in the returned buffer. The type of the items is LONGTYPE(LONG).
Parameters
|
TIFFFILE |
hChain |
Handle of a TIFF image chain. |
|
int |
iImage |
Index of the image in the chain. |
|
UINT |
wTagID |
Identifier of tag you want information about. |
|
HANDLE FAR |
*lphData |
Pointer to data buffer handle. |
|
UINT FAR |
*lpwType |
Pointer to type of data (see defines in BITIFF.H). |
|
DWORD FAR |
*lpdwCount |
Pointer to number of data items (not bytes). |
Return values
TRUE on success, otherwise FALSE. If the specified tag ID does not exist, the function returns FALSE, and set the error code to TNOSUCHTAG. Call TiffError() to retrieve the error code.
Programming notes
It is your responsibility to free the buffer referred by *lphData with MS Windows SDK GlobalFree() function. To access the data stored in the buffer, first call GlobalLock(), when finished working with data, call GlobalUnlock() MS Windows SDK functions.
Requirements
Header : Declared in BiTiff.h; include BiTiff.h.
Library : Use BiTIFF.lib.
DLLs : BiTiff.dll.
Code example
#define "BITIFF.H"
TIFFFILE hTiff;
int nImage, nIndex;
HANDLE hData;
UINT *lpwGrayScaleBuff;
UINT wGrayLevel;
DWORD dwNumberOfLevels;
char lpszDateTime[20]; // String containing date and time.
.
.
// Registers the processed image first
GetTiffImage(hTiff,nImage);
// Retrieves values if tags exist.
lpszDateTime[0] = '\0'; // Default is empty string.
GetTiffImageInfoBuffer(hTiff,nImage,DATETIME,NULL,lpszDateTime,NULL);
// Asks for grayscale response curve data.
if (GetTiffImageInfoBuffer(hTiff,nImage,GRAYRESPONSECURVE,
&hData,NULL,&dwNumberOfLevels))
{
pGrayScaleBuff = (UINT*) GlobalLock(hData);
// Processes data items one by one.
for(nIndex = 0 ; nIndex < dwNumberOfLevels ; nIndex++)
{
wGrayLevel = lpGrayScaleBuff[nIndex];
... // Processes data.
}
GlobalUnlock(hData); // Unlocks buffer.
GlobalFree(hData); // Frees buffer.
}
else // Some error occurred.
{
switch (TiffError())
{
case TNOTENOUGHMEMORY :// Not enough memory.
...
case TNOSUCHTAG : // Tag doesn't exist.
...
default : // Other error.
...
}
}
// Unregisters image
DropTiffImage(hTiff,nImage);
...