ImageGear Professional DLL v17.1 for Windows Accusoft
LPFNIG_GUIPALETTE
Send Feedback  
ImageGear Professional DLL v17.1 for Windows > API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_GUIPALETTE

Glossary Item Box

This function is called any time the user has attempted to change a palette color in the palette window.

Declaration:

  Copy Code
typedef BOOL (ACCUAPI LPFNIG_GUIPALETTE) (
        LPVOID lpPrivate, 
        UINT nPaletteIndex, 
        LPAT_RGBQUAD lpRGB 
);

Arguments:

lpPrivate Far pointer to private data area.
nPaletteIndex Index of palette entry that changed.
lpRGB Far pointer to the entry.

Return Value:

Return TRUE to modify the DIB palette; FALSE to make no changes.

Supported Raster Image Formats:

Indexed RGB - 1…8 bpp.

Sample:

Palette Edit

Example:

  Copy Code
BOOL ACCUAPI  MyPaletteCBFunc ( LPVOID lpPrivate, UINT nEntryNum, LPAT_RGBQUAD
lpRBGQ_PaletteEntry )
{
INT     r, g, b;           /* will hold the palette colors */
                                /* Don't let the user change color 0:   */
if ( nEntryNum == 0 )
        { return  FALSE; }  /* Don't store or display the new color  */
/* If the color is too dark, don't accept it: */
r  =  lpRGBQ_PaletteEntry -> rgbRed;
g  =  lpRGBQ_PaletteEntry -> rgbGreen;
b  =  lpRGBQ_PaletteEntry -> rgbBlue;
if ( (r<20) || (g<20) || (b<20) )
        { return  FALSE; }    /* Too dark, say "Don't store it"   */
return  TRUE;           /* Else OK, store and display new color  */
}

See also the example under function IG_GUI_palette_CB_register().

Remarks:

This type of callback function is registered by calling IG_GUI_palette_CB_register().

You may perform any operations you wish here, but you should also return TRUE to tell ImageGear to go ahead with the change and actually modify the DIB palette, FALSE to tell ImageGear to deny the change.

If you have not registered a palette callback function, ImageGear will make each change the user attempts.

©2012. Accusoft Corporation. All Rights Reserved.