ROSE 0.11.145.147
|
Mapping from floating point to color.
Maps a floating point value to a color by linear interpolation between specified colors.
#include <Rose/Color.h>
Public Types | |
typedef Sawyer::Container::Map< double, HSV > | ColorMap |
Public Member Functions | |
Gradient () | |
Default constructor. | |
Gradient (const HSV &color1, const HSV &color2) | |
Construct a mapping with two colors. | |
void | clear () |
Remove all points from the gradient. | |
void | insert (double where, const HSV &color) |
Insert a point into the gradient. | |
Gradient (const RGB &color) | |
Construct a one-color gradient. | |
Gradient (const HSV &color) | |
Construct a one-color gradient. | |
const HSV & | nanColor () const |
Color for NaN lookups. | |
void | nanColor (const HSV &c) |
Color for NaN lookups. | |
HSV | interpolate (double) const |
Return a color for the specified position. | |
HSV | operator() (double x) const |
Return a color for the specified position. | |
const ColorMap & | colorMap () const |
Reference to color map. | |
ColorMap & | colorMap () |
Reference to color map. | |
typedef Sawyer::Container::Map<double, HSV> Rose::Color::Gradient::ColorMap |
|
inline |
|
inline |
Construct a one-color gradient.
Implicit conversion from a color to a "constant gradient". That's a bit of a misnomer, but it turns out to be useful for allowing a single color to be specified where a gradient is supported.
Definition at line 248 of file Color.h.
References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert().
|
inline |
Construct a one-color gradient.
Implicit conversion from a color to a "constant gradient". That's a bit of a misnomer, but it turns out to be useful for allowing a single color to be specified where a gradient is supported.
Definition at line 249 of file Color.h.
References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert().
Construct a mapping with two colors.
Constructs a gradient that maps x less than or equal to zero to color1
; x greater than or equal to one to color2
, and interpolates between zero and one.
Definition at line 256 of file Color.h.
References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert().
|
inline |
Remove all points from the gradient.
Definition at line 262 of file Color.h.
References Sawyer::Container::Map< K, T, Cmp, Alloc >::clear().
|
inline |
|
inline |
|
inline |
Insert a point into the gradient.
This method is just a wrapper around this->colors().insert(where, color)
and is provided because it's a common operation.
Definition at line 275 of file Color.h.
References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert().
HSV Rose::Color::Gradient::interpolate | ( | double | ) | const |
Return a color for the specified position.
If the color map is empty then a default-constructed color is returned. If the color map has only one color then that color is returned.
|
inline |
|
inline |
|
inline |