ImageGear for C and C++ on Windows v19.10 - Updated
IG_palette_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Palette Functions > IG_palette_get

This function obtains the referenced image's DIB palette, storing it in your array of AT_RGBQUAD structs pointed to by lpPalette.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_palette_get ( 
        HIGEAR hIGear, 
        LPAT_RGBQUAD lpPalette
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpPalette LPAT_RGBQUAD Far pointer to the first of an array of AT_RGBQUAD structs sufficient to hold the entire palette from the image's DIB.

Return Value:

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

Supported Raster Image Formats:

Indexed RGB - 1…8 bpp.

Sample:

Palette Edit

Example:

 
Copy Code
HIGEAR hIGear;        /* HIGEAR handle of image     */
AT_ERRCOUNT nErrcount;      /* Returned count of errors on stack  */
AT_RGBQUAD rgbqPalette[256];  /* Array of AT_RGBQUAD structs    */
nErrcount = IG_palette_get ( hIGear, rgbqPalette );

Remarks:

The array must be large enough to hold the palette. For example, if an 8-bit image, lpPalette must point to the start of an array of 256 AT_RGBQUAD structs, therefore to an array of at least 256 x 4 = 1024 bytes. If the image is 24-bit, no error is set but no palette is returned.

See also function IG_palette_set() function.

To obtain an image's logical palette (the palette after mapping through the display LUTs, or for a 24-bit image the palette that would be used for displaying to an 8-bit device), use function IG_dspl_palette_create().