OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Constructing TPalette

You can construct a TPalette object either directly, passing an array of color values to the constructor, or indirectly, by specifying a TPalette &, a pointer to a LOGPALETTE structure, a pointer to a bitmap header, and so on.

Directly constructing a palette creates a new object with the specified attributes. Here is the constructor for directly constructing a palette:

TPalette(const PALETTEENTRY far* entries, int count);

entries is an array of PALETTEENTRY objects. Each PALETTEENTRY object contains a color value specified by three separate values, one each of red, green, and blue, plus a flags variable for the entry. count specifies the number of values contained in the entries array.

Indirectly creating a palette also creates a new object, but it copies the attributes of the object passed to it into the new palette object. Here are the constructors for indirectly creating a palette:

TPalette(const TClipboard&);
TPalette(const TPalette& palette);
TPalette(const LOGPALETTE far* logPalette);
TPalette(const BITMAPINFO far* info, uint flags=0);
TPalette(const BITMAPCOREINFO far* core, uint flags=0);
TPalette(const TDib& dib, uint flags=0);

Each of these constructors copies into the new object the color values contained in the object passed into the constructor. The objects passed to the constructor are not necessarily palettes themselves; many of them are objects that use palettes and contain a palette themselves. In these cases, the TPalette constructor extracts the palette from the object and copies it into the new palette object.

You can also create a new TPalette object from an existing HPALETTE handle, as follows:

TPalette(HPALETTE handle, TAutoDelete autoDelete = NoAutoDelete);

This constructor is used to obtain an ObjectWindows object as an alias to a regular Windows handle received in a message.

See Also