IBSimu 1.0.4
|
Class for palette definition. More...
#include <palette.hpp>
Classes | |
struct | Entry |
Palette defining entry. More... | |
Public Member Functions | |
Palette () | |
Default constructor for default black and white palette. | |
Palette (const std::vector< Entry > &entries) | |
Constructor for defined palette. | |
Color | operator() (double x) const |
Return the interpolated color value from palette. | |
void | clear (void) |
Clear current palette. | |
void | push_back (const Color &color, double val) |
Pushes new entry to palette. | |
void | norm (void) |
Normalize palette entries. | |
void | debug_print (void) const |
Class for palette definition.
Palette is an object that contains a list of colors and corresponding values. The colors are interpolated linearly between the defined points for a smooth color palette. The palette values are normed so that the end points of palette have values 0.0 and 1.0.
Palette::Palette | ( | ) |
Default constructor for default black and white palette.
Palette::Palette | ( | const std::vector< Entry > & | entries | ) |
Constructor for defined palette.
The values are normed to range from 0.0 to 1.0.
void Palette::clear | ( | void | ) |
Clear current palette.
Leaves palette with no colors. Used with push_back() to build new palettes on-line.
void Palette::debug_print | ( | void | ) | const |
void Palette::norm | ( | void | ) |
Normalize palette entries.
Normalize palette to range from 0.0 to 1.0.
Color Palette::operator() | ( | double | x | ) | const |
Return the interpolated color value from palette.
Makes and interpolated color value at value x. If palette has no colors, black will be returned. If palette has one color, that color will be returned. With two or more colors the interpolation can be done correctly.
void Palette::push_back | ( | const Color & | color, |
double | val | ||
) |