ImageGear Professional for Linux
IG_palette_set

This function loads the palette pointed to by lpPalette into the DIB, replacing the prior palette that was present.

Declaration:

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

Arguments:

Name Type Description
HIGEAR HIGEAR HIGEAR handle of image.
LpPalette const LPAT_RGBQUAD Far pointer to the first of an array of AT_RGBQUAD structs containing the palette you wish to load into the DIB, as the image's new DIB palette.

Return Value:

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

Supported Raster Image Formats:

Indexed RGB - 1…8 bpp.

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  */
INT pix;              /* Loop index, = pixel value  */
/* Create a grayscale palette, and set it into image hIGear's DIB:  */
for ( pix = 0;  pix <= 255;  pix++ )
        {
        rgbqPalette[pix].rgbBlue  =  pix;
        rgbqPalette[pix].rgbGreen =  pix;
        rgbqPalette[pix].rgbRed   =  pix;
        rgbqPalette[pix].rgbReserved  =  0;
        }
nErrcount = IG_palette_set ( hIGear, rgbqPalette );

Remarks:

Your palette pointed to by lpPalette must be in the form of AT_RGBQUAD structs: 4 bytes per entry, ordered Blue-Green-Red-Unused (0). The number of consecutive AT_RGBQUAD structs you need is determined by the number of Bits Per Pixel in the image. For example, for an 8 bit image, you would need an array of 256 AT_RGBQUAD structs.

If the image is 24 bit, this function will set an error and return.

See also function IG_palette_set().

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback