ImageGear for C and C++ on Windows v19.8 - Updated
IG_dspl_palette_handle
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Display Functions > IG_dspl_palette_handle

This function is designed to be used to handle palette messages from the operating system.

Declaration:

 
Copy Code
AT_ERRCOUNT   ACCUAPI  IG_dspl_palette_handle(
        [IN] HIGEAR hIGear,
        [IN] DWORD dwGrpID,
        [IN] HWND hWnd,
        [IN] HDC hDC,
        [IN] AT_MODE nPalMode,
        [OUT] LPBOOL lpbRealized
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
dwGrpID DWORD Identifier of group that should be used.
hWnd HWND Valid handle of window where image is drawn and from which palette message is to be handled.
hDC HDC Handle of device context where image is to be drawn. If NULL, then it will automatically be retrieved from hWnd.
nPalMode AT_MODE New value of PaletteMode to set. Possible value is either IG_DSPL_PALETTE_HIGH or IG_DSPL_PALETTE_LOW. Please note that this new value is assigned only if the current value of PaletteMode is not IG_DSPL_PALETTE_DISABLE. If the current value is IG_DSPL_PALETTE_DISABLE then the function does not perform any action (to change this, use IG_dspl_palette_set() function).
lpbRealized LPBOOL Pointer to the BOOL parameter where TRUE will be assigned if new palette has been realized and FALSE if otherwise. If NULL, then this parameter is ignored.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

ASCII, Color, Display, GUI Windows, GUI Scan, Medical, MFC, Page, Thumbnail, Filters

Example:

 
Copy Code
HIGEAR           hIGear;      /* HIGEAR handle of image   */ 
DWORD           nGrpID;      /* display group identifier */
 ...
case WM_QUERYNEWPALETTE:
        /* let Image Gear handle palette management */
IG_dspl_palette_handle(hIGear, nGrpID, hWnd, NULL, IG_DSPL_PALETTE_HIGH, &bRealized );
        return bRealized;
case WM_PALETTECHANGED:
        /* let Image Gear handle palette management */
IG_dspl_palette_handle(hIGear, nGrpID, hWnd, NULL, IG_DSPL_PALETTE_LOW, NULL );
        break;
 ...
h2>Remarks:

For the Windows platform, this function should be called when WM_QUERYNEWPALETTE and WM_PALETTECHANGED messages are processed (see the sample below). Handling of those messages is extremely important for palette based devices.