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

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

Declaration:

 
Copy Code
typedef BOOL (ACCUAPI LPFNIG_TAG_SET) (
        LPVOID lpPrivate, 
        AT_MODE nIGTag, 
        AT_MODE nDataType, 
        const LPVOID lpTagData, 
        DWORD dwSize 
);

Arguments:

Name Type Description
lpPrivate LPVOID A far pointer to a private data area that can be used for anything you like.
nIGTag AT_MODE ImageGear supplies you with an IGTAG_ Tag ID constant from file Geartags.h, so that you will know which tag is currently being processed.
nDataType AT_MODE ImageGear supplies you with an IG_TAG_TYPE_ constant from file accucnst.h, specifying the data type for this tag (e.g., BYTE, LONG, FLOAT, etc.).
lpTagData const LPVOID ImageGear supplies you with a copy of the data from the tag currently being read.
dwSize DWORD ImageGear tells you the size of tag data, in bytes.

Return Value:

Returns TRUE if ImageGear should overwrite the default tag data with your data, or FALSE if ImageGear should ignore your data.

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

JPEG, Filters

Example:

 
Copy Code
BOOL ACCUAPI TagSet(
   LPVOID         lpPrivate,     /* Private data passed in        */
   AT_MODE        nIGTag,        /* Tag ID from geartags.h        */
   AT_MODE        nType,         /* Type of data in lpTag         */
   const LPVOID   lpTag,         /* Pointer to tag data           */
   DWORD          dwSize         /* Size of tag data (bytes)      */
   )
...
return TRUE; /* FALSE to terminate the operation */
}
... 
IG_load_tag_CB_register( TagSet, (LPVOID)&dwPrivateFlags ); 
...

The following example illustrates loading a GIF image.

 
Copy Code
/* Example of LPFNIG_TAG_SET type function, which may be used during loading GIF image:  
*/
BOOL ACCUAPI GifCallbackTagSet(
        LPVOID  lpPrivate,
        AT_MODE  nIGTag,
        AT_MODE  nDataType,
        LPVOID  lpData,
        DWORD   dwDataLen
{
        WORD    wWidth;
        WORD    wLeft;
        WORD    wExtNumber;
        LPBYTE                  lpRGB;
        LPAT_GIF_CTRL_EXT lpCtrlExt;
        LPAT_GIF_TEXT_EXT lpTextExt;
        LPAT_GIF_COMM_EXT lpCommExt;
        LPAT_GIF_APPL_EXT lpApplExt;
        LPVOID                  lpExt;
/* Following code illustrates how to get GIF file information                                                           */
/* Parameter nIGTag in this function informs about kind of data on which points lpData.
*/
/* If GIF image is loaded this parameter may be equal to IGTAG_GIF_ constants, defined in
*/
/* file \ACCUSOFT\GEAR\SOURCE\INCLUDE\geartags.h. For example, when IGTag is equal to*/
/* IGTAG_GIF_SCREEN_ASPECT lpData must point (after conversion) to BYTE - bAspectRatio
field */
/* of GIF_SCREEN_DESC structure. Analogously for other IGTAG_GIF_ constants.*/
/* IGTAG_GIF_SCREEN_BG_COLOR - for getting or setting screen background color index*/
/* - lpData points to BYTE, */
/* 1.When GIF image is loaded: lpData points to GIF Extention Block structure*/
/* 2.When GIF image is written: lpData must points to LPVOID, which points to created by
user*/
/* GIF Extention Block structure. This structure must exist all time when image is written.
*/
/* IGTAG_GIF_EXT_AFTER_IMG - Analogously as for IGTAG_GIF_EXT_BEFORE_IMG*/
        switch(nIGTag)
        {
                case IGTAG_GIF_SCREEN_WIDTH:
                        wWidth=*(LPWORD)lpData;
                        break;
                case IGTAG_GIF_IMAGE_LEFT:
                        wLeft=*(LPWORD)lpData;
                        break;
                case IGTAG_GIF_SCREEN_PALETTE:
                        lpRGB=(LPBYTE)lpData;
                        break;
                case IGTAG_GIF_IMAGE_PALETTE:
                        lpRGB=(LPBYTE)lpData;
                        break;
                case IGTAG_GIF_EXT_NUMBER_BEFORE_IMG:
                        wExtNumber=*(LPWORD)lpData;
                        break;
                case IGTAG_GIF_EXT_BEFORE_IMG:
                        lpExt=lpData;
                        switch(*(LPDWORD)lpExt)
                        {
                                case CTRL_EXT_LABLE:
                                        lpCtrlExt=(LPAT_GIF_CTRL_EXT)lpExt;
                                        break;
                                case TEXT_EXT_LABLE:
                                        lpTextExt=(LPAT_GIF_TEXT_EXT)lpExt;
                                        break;
                                case COMM_EXT_LABLE:
                                        lpCommExt=(LPAT_GIF_COMM_EXT)lpExt;
                                        break;
                                case APPL_EXT_LABLE:
                                        lpApplExt=(LPAT_GIF_APPL_EXT)lpExt;
                                        break;
                        }
                        break;
                case IGTAG_GIF_EXT_NUMBER_AFTER_IMG:
                        wExtNumber=*(LPWORD)lpData;
                        break;
                case IGTAG_GIF_EXT_AFTER_IMG:
                        lpExt=lpData;
                        switch(*(LPDWORD)lpExt)
                        {
                                case CTRL_EXT_LABLE:
                                        lpCtrlExt=(LPAT_GIF_CTRL_EXT)lpExt;
                                        break;
                                case TEXT_EXT_LABLE:
                                        lpTextExt=(LPAT_GIF_TEXT_EXT)lpExt;
                                        break;
                                case COMM_EXT_LABLE:
                                        lpCommExt=(LPAT_GIF_COMM_EXT)lpExt;
                                        break;
                                case APPL_EXT_LABLE:
                                        lpApplExt=(LPAT_GIF_APPL_EXT)lpExt;
                                        break;
                        }
                        break;
        }
        return TRUE

Remarks:

This function will be called once for each tag (both volatile and non-volatile, see LPFNIG_TAG_GET) that is being parsed.

This callback function is registered by calling IG_load_tag_CB_register() function. When ImageGear is going to perform any load operation it will first check to see if you have registered any applicable callbacks. If you have registered a callback of type LPFNIG_TAG_SET, it will be called once for each tag (both volatile and non-volatile, see LPFNIG_TAG_GET) that is being parsed. ImageGear will not let you write data to any tag while loading.

If you would like to modify tag data as the image is being saved, register a callback of type LPFNIG_TAG_GET().

If you would like to add your own user-defined tags to a TIFF file, register a callback of type LPFNIG_USER_TAG_GET. Your tags will be saved with the image when it is being saved.

See also the discussion about Tag Callbacks in the section Working with ImageGear Callback Functions.

The HIGEAR for the image is not created until after all of the tags have been read in.

If you need to store any tag data, make a copy of the data, not the lpTagData pointer.