ImageGear for C and C++ on Windows v19.5 - Updated
LPFNIG_TAG_USER_GET
API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_TAG_USER_GET

This function has been deprecated and will be removed from the public API in a future release. Please use LPAFT_IG_METAD_ITEM_GET_CB instead.

Declaration:

 
Copy Code
typedef BOOL (ACCUAPI LPFNIG_TAG_USER_GET) (
        LPVOID lpPrivate, 
        LPAT_MODE lpUserTag, 
        LPAT_MODE lpDataType, 
        LPVOID32 FAR* lpTagData, 
        LPDWORD lpSize 
);

Arguments:

Name Type Description
lpPrivate LPVOID Far pointer to private data area, which can be used for anything you like, including the storage of the image's HIGEAR handle.
lpIGTag LPAT_MODE Far pointer to an AT_MODE variable to receive a private tag number. Your value must be 32768 or higher.
lpDataType LPAT_MODE Set to an IG_TAG_TYPE_ constant (these are listed in file accucnst.h) specifying the data type for this tag.
lpTagData LPVOID32 FAR* Return a pointer to your data.
lpSize LPDWORD Tell ImageGear the size of your data.

Return Value:

Return TRUE if returning a tag, in which case this callback function will be called again in case you have more tags to supply. Return FALSE if you are not returning a tag and are done returning tags.

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

JPEG

Example:

 
Copy Code
BOOL ACCUAPI TagUserGet(
   LPVOID         lpPrivate,     /* Private data passed in */
   LPAT_MODE      lpnIGTag,        /* Tag ID from geartags.h */
   LPAT_MODE      lpType,        /* Type of data lpTag points to */
   LPVOID  FAR*   lpTag,         /* Pointer to tag data */
   LPDWORD        lpSize         /* Size of tag data (bytes) */
   )
/* set Tag ID, data type, length, and pointer to your data */
{
   *lpSize = 0;
   if( (*lpnIGTag>=IGTAG_JPG_APPDATA) && (*lpnIGTag<=IGTAG_JPG_APPDATA_LAST) )
        {
if( (*lpnIGTag-IGTAG_JPG_APPDATA)==12   )       /* supplying only APP13 marker  */
                {
/* supply application marker data */
                        *lpType = IG_TAG_TYPE_RAWBYTES;
                        *lpTag = (LPVOID)(&TestData[0]);
                        *lpSize = sizeof(TestData);
                        return  TRUE;
                }
/* FALSE when no tag being returned */
        }
                      return    FALSE;
}
...
IG_save_tag_CB_register( TagGet, TagUserGet, (LPVOID)&dwPrivateFlags );
...

Remarks:

This function allows you to store a private TIFF tag with the image being saved.

This callback function is registered by calling IG_save_tag_CB_register(). In this callback, you supply a tag number, tag type, and tag data. Note that the value of your private tag number must be higher than 32768.

When ImageGear is going to save a file it will check to see if you have registered any applicable callbacks. If you have registered a callback of type LPFNIG_USER_TAG_GET(), it will be called until you set it to FALSE. While your callback is still set to TRUE, it will add your user-defined tags one at a time to the TIFF image being saved.

lpIGTag is a far pointer to an AT_MODE in which you store a privately defined tag ID#. lpDataType is a pointer to your Tag data type, lpTagData is a pointer to your tag data, and lpSize is the length of your tag data.

This callback function should return TRUE when supplying a tag, in which case it will be called again. Return FALSE when you are done supplying tags. This callback will be called at least once if it has been registered.