class HT_Color_Cube

See Also HT_Palette, HT_Int_RGB, HT_Gray_Ramp Access methods Constructor
HT_Color_Cube
Creates an HT_Color_Cube object.

HT_Color_Cube::base_index

Purpose

Sets or queries the base index value in the color cube object. Synopsis
int base_index (void)
void set_base_index (int p_base_index) alter
Details When installed in a palette object, a color cube defines a range of palette entries. The base index defines the bias on the indexes of the cube. It defines the position in the palette for the first entry of the range  defined by the color cube. In other words, the array may not start at zero and in that case base_index returns the the first index number for the palette.
HT_Color_Cube::closest_match

Purpose

Finds the index whose color is closest to the target. Synopsis
int closest_match (HT_RGB32 target) const
Details This function returns an index into the color cube that represents the closest matching color to target. This value is already biased by the base index.
HT_Color_Cube::color

Purpose

Computes the  color based on the index of the color cube. Synopsis
HT_RGB32 color (int index) const
Details Computes the actual color that lies at the specified virtual index if the cube were linearized into palette elements.
HT_Color_Cube::dithered_match

Purpose

Returns color information (number of dithered planes, 1-4) that, when dithered together, best approximates a target color. Synopsis
int dithered_match (
    HT_RGB32               target,
    int alter              *colors,
    Face_Pattern::Enum     *densities) const
Details This routine takes a target color and returns the number of colors that, when dithered together, best approximate the target color. This number is between 1 and 4. The n colors are returned by index (already biased by the base index) in the colors array. The n-1 dithers, which separate the colors, are given in the densities array. The stipples should be drawn in order because they are effectively pixel-subtractive masks between color layers.
 
 

HT_Color_Cube::HT_Color_Cube

Purpose

Constructor to initialize new color cube object. Synopsis
HT_Color_Cube (
    HT_Int_RGB resolution_in = HT_Int_RGB(1,1,1),
    float gamma = 1.0f,
    int base_index_in=0
)
Details Creates an HT_Color_Cube object based on the data supplied in the arguments.

HT_Color_Cube::gamma, set_gamma

Purpose

Sets or queries gamma correction of the system. Synopsis
float gamma(void) const
void set_gamma (float p_gamma) alter
Details gamma is a scale factor to enhance the perception of color variation or hue. This is useful in situations where the hue may be imperceptible to the eye ¾  when changes in screen voltage are slight.
HT_Color_Cube::multiplier

Purpose

Returns a structure that holds the multiplier values for each R, G, and B component. Synopsis
HT_Int_RGB const & multiplier (void) const
Details This is a value that is precomputed from the resolution and is useful for renderers seeking to eliminate common operations.

The return value of the function is an HT_Int_RGB, call it multiplier, for which multiplier.r, multiplier.g, multiplier.b, are three integers giving the multipliers for the R, G, and B axes of the color cube. These multipliers are used to index into the color map containing the color cube given a specific R, G, and B color cube index value.

The cells of the partition are ordered in a standard way, with the B index varying most rapidly and the R index least rapidly. The multiplier is computed the following way:

multiplier.b = 1;
multiplier.g = resolution.b * multiplier.b;
multiplier.r = resolution.r * multiplier.r;
 

HT_Color_Cube::range

Purpose

Returns a structure that holds the range values for each R, G, and B component. Synopsis
HT_Int_RGB const & range (void) const
Details This function is a value that is precomputed from the resolution and are useful for renderers seeking to eliminate common operations.

The return value of the function is an HT_Int_RGB, called a range, for which range.r, range.g, range.b, are three integers giving the true range of values for the R, G, and B axes of the color cube. The range for each color component is between 0 and the value passed in set_resolution for that color component.

The range for each component x for R, G, and B is given by

   range.x = resolution.x - 1;

HT_Color_Cube::resolution

Purpose

Sets or queries the resolutions of this color cube object. Synopsis
HT_Int_RGB const & resolution ()
void set_resolution (HT_Int_RGB const & p_resolution) alter
Details This function defines the size of the cube. Often this is set to (6, 6, 6), which defines a cube with 6*6*6=216 virtual palette entries.

resolution.r, resolution.g, resolution.b, are three integers giving the resolutions along the R, G, and B axes of the color cube. Thus, the color cube partitions the full RGB space into
resolution.r*resolution.g*resolution.b discrete colors.
 
 


HT_Color_Cube::total

Purpose

Returns the number of entries in the cube Synopsis
int total (void)
Details Returns the number of entries the cube would contain if linearized into a palette entry array. The total is computed as
   total = resolution.r * resolution.g * resolution.b;