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

This function loads a palette that was saved using IG_palette_save() function.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_palette_load (
        const LPSTR lpszFileName, 
        LPAT_RGBQUAD lpPalette, 
        LPUINT lpNumEntries, 
        BOOL bBGR_Order, 
        LPAT_MODE lpFileType 
);

Arguments:

Name Type Description
lpszFileName const LPSTR Name of file containing saved palette to load.
lpPalette LPAT_RGBQUAD Far pointer to array of AT_RGBQUAD structs to load into (see the parameter bBGR_Order, below).
lpNumEntries LPUINT Far pointer to UINT variable to receive number of palette entries loaded (size of palette).
bBGR_Order BOOL TRUE = store as AT_RGB structs (that is, Blue-Green-Red), instead of AT_RGBQUAD structs (Blue-Green-Red-Unused). This switch has no effect when reading ImageGear's text format. It loads this information as if writing to AT_RGBQUAD.
lpFileType LPAT_MODE An IG_PALETTE_FORMAT_ constant specifying the format of the file. The constants are listed in file accucnst.h.

Return Value:

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

Supported Raster Image Formats:

This function does not process image pixels.

Sample:

Palette Edit

Example:

 
Copy Code
AT_RGBQUAD rgbqPalette[256];     /* Will hold the palette loaded */
UINT nEntries;           /* Holds number of entries in palette*/
AT_MODE nPaletteFileType;   /* Will receive IG_PALETTE_... constant*/
AT_ERRCOUNT1 nErrcount;           /* Returned count of errors   */
nErrcount = IG_palette_load ( "Palfile.pal", &rgbqPalette[0], &nEntries, TRUE,
&nPaletteFileType );