class HT_Palette


Objects of this class represent color tables, containing an array of HT_Palette_Entry objects.

See Also

HT_Palette_Entry, HT_Color_Cube

Access Methods

Comparison Methods

is_equal_to               Compares two palettes for equality.

Operators

operator []               To reference a palette entry.
operator ==               Tests equality.
operator !=               Tests inequality.

Constructor

HT_Palette                Class constructor.

 


HT_Palette::closest_match

Purpose

Returns an index for a palette entry that most closely matches the target color.

Synopsis

int closest_match (HT_RGB32 input) const

Details

The palette is searched for an entry that most closely matches the input parameter. The return value is the closest match in the palette. If there is no close match, then HT_Palette::invalid_index is returned.

 


HT_Palette::cube

Purpose

Returns the color cube installed in this palette, if one exists.

Synopsis

HT_Color_Cube const * cube (void) const

Details

A color cube must have been installed by HT_Palette::install.

 


HT_Palette::first_available_block

Purpose

Locates a block of unused palette entries in the current palette, if one exists.

Synopsis

int first_available_block (int size = 1) const

Details

The palette is searched for a contiguous block of size unused palette entries. If there is insufficient unused space in the palette, HT_Palette::invalid_index is returned. Otherwise, the index of the start of the block is returned.

 


HT_Palette::HT_Palette

Purpose

Constructor to initialize a new HT_Palette object.

Synopsis

HT_Palette (void) 

Details

Initializes to an empty palette.

 


HT_Palette::install

Purpose

Defines a range of entries in this palette.

Synopsis

HT_Boolean install (HT_Color_Cube const & cube)
HT_Boolean install (HT_Palette target)

Details

In the first form, a color cube is installed into the palette. This cube occupies a range of cube.resolution().r * cube.resolution().g * cube.resolution().b entries in this palette object, beginning with index cube.base_index(). The return value indicates whether or not the operation was successful.

In the second form, the palette represented by target is installed into this palette object. If this operation is successful (no conflicts between the allocated entries in this palette and the target palette), then true is returned. Otherwise, false is returned and no change occurs in "this" object.

 


HT_Palette::is_equal_to

Purpose

Compares two palettes for equality.

Synopsis

HT_Boolean is_equal_to (HT_Palette target) const

Details

The two palettes are compared. If the target palette matches this one, then true is returned. Otherwise, false is returned.

 


HT_Palette::operator [ ]

Purpose

Palette indexing operator.

Synopsis

HT_Palette_Entry operator[] (int index) const

Details

Returns the palette entry specified by the index parameter.

 


HT_Palette::operator ==

Purpose

Compares two palettes for equality.

Synopsis

HT_Boolean operator== (HT_Palette target) const

Details

The two palettes are compared. If the target palette matches this one, then true is returned. Otherwise, false is returned.

 


HT_Palette::operator !=

Purpose

Compares two palettes for inequality.

Synopsis

HT_Boolean operator!= (HT_Palette target) const

Details

The two palettes are compared. If the target palette does not match this one, then true is returned. Otherwise, false is returned.

 


HT_Palette::remove

Purpose

Removes a previously installed palette from this palette.

Synopsis

HT_Boolean remove (HT_Palette target)

Details

The palette represented by target is removed from this palette object. If this operation is successful, then true is returned. Otherwise, false is returned.