ImageGear Professional > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Palette Functions > IG_palette_save |
This function saves a palette to a file.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_palette_save (
const LPSTR lpszFileName,
LPAT_RGBQUAD lpPalette,
UINT nNumEntries,
AT_MODE nFileType
);
|
Name | Type | Description |
lpszFileName | const LPSTR | Name of file to which to save palette. |
lpPalette | LPAT_RGBQUAD | Far pointer to array of AT_RGBQUAD structs constituting palette to save. |
nNumEntries | UINT | Number of entries in palette. |
nFileType | AT_MODE | IG_PALETTE_FORMAT_ constant specifying format in which to save palette. The constants are listed in accucnst.h. |
Returns the number of ImageGear errors that occurred during this function call.
This function does not process image pixels.
Copy Code
|
|
---|---|
HIGEAR hIGear; /* Handle of image whose palette to save */ LPAT_RGBQUAD lpPalettePntr; /* Will hold address of the DIB palette */ UINT nEntries; /* Will hold number of entries in palette */ /* Obtain address of DIB palette and its number of entries ); IG_image_DIB_palette_pntr_get ( hIGear, &lpPalettePntr, &nEntries ); /* Save to a file, saving only 3 bytes per entry, in order B-G-R: */ nErrcount = IG_palette_save ( "Savedpal.pal", lpPalettePntr, nEntries, IG_PALETTE_FORMAT_RAW_BGR ); |
Argument nFileType lets you select the format in which to save the palette. If you save the palette using IG_PALETTE_FORMAT_TEXT, its format will be as shown for the following palette of a 1-bit black-and-white image:
Copy Code
|
|
---|---|
Accusoft Palette File ver 7.0.9 0 0 0 0 1 255 255 255 |
The first line identifies the version of ImageGear that created this Palette text file. Then each succeeding line gives the entry number, followed by the Red, Green, and Blue color intensities, respectively, for that palette color.