Product Home Class IndexDownload

CK_PaletteSet

CK_Object
   |
   +----CK_PaletteSet

This class represents a collection of palettes. Any CK_Image object, such as a CK_StaticImage or CK_AnimatedImage, can contain a palette set if the image is 8 bits per pixel. A palette set allows the same image (or animation) to be displayed in multiple palettes, without duplication the pixel data in memory for each different palette.


Factory Methods

copy
Create a CK_StaticImage object from an opened file pointer.
createEmpty
Creates a CK_StaticImage object from a file.
createFromFile
Creates a CK_StaticImage object from a file.

Public Methods

getNumPalettes
Adds a palette to the image's palette set.
getPaletteAt
Delets a palette from the image's palette set.
serialize
Removes the palette set from the image. The image will no longer have any palette information.
setPaletteAt
Returns the compression object, if any, installed with this instance.

This factory method creates a palette set that is a copy of another palette set.

Return Value
Returns a pointer to the created palette set.

Parameters

palSet
The palette set to be copied.

This factory method creates an empty palette set. Palettes can be added to the set by calling the setPaletteAt() method.

Return Value
Returns a pointer to the created palette set.

Parameters

numPalettes
The number of palettes this palette set can contain.

This factory method creates a palette set from a serialized palette set.

Return Value
Returns a pointer to the created palette set.

Parameters

fp
A file pointer positioned at the beginning of a serialized palette set.

Returns the number of palettes the palette set is able to hold.

Returns a const pointer to one palette in the set. A const pointer is returned because the palette set owns each of the palettes it contains, and these palettes should not be deleted by the application.

Return Value
Returns a const pointer to the requested palette in the set.

Parameters

palIndex
Specifies the palette to retrieve. The first palette is at palIndex 0.

Serializes the palette set to a file. Each palette in the set is serialized as part of the palette set.

Parameters

fp
A file pointer opened for writing and in binary mode. All file pointers used for serialization in the library should be opened in binary mode, as shown below:

FILE *fp = fopen("x.dat","wb");

Adds or replaces a palette within the palette set. If the palette set already contains a palette at palIndex, then it is replaced by the new palette. The palette passed in is copied, and the copy is stored in the palette set.

Parameters

pal
This palette is not stored in the palette set, but a copy of it is made and stored in the palette set.
palIndex
The position within the palette set to store the palette. The first palette is at palIndex 0.