ROSE  0.11.145.0
Public Types | Public Member Functions | List of all members
Rose::Color::Gradient Class Reference

Description

Mapping from floating point to color.

Maps a floating point value in the range [0..1] to a color by linear interpolation between specified colors.

Definition at line 221 of file Color.h.

#include <Rose/Color.h>

Public Types

typedef Sawyer::Container::Map< double, HSVColorMap
 

Public Member Functions

 Gradient ()
 Default constructor. More...
 
 Gradient (const HSV &color1, const HSV &color2)
 Construct a mapping with two colors. More...
 
void clear ()
 Remove all points from the gradient. More...
 
void insert (double where, const HSV &color)
 Insert a point into the gradient. More...
 
 Gradient (const RGB &color)
 Construct a one-color gradient. More...
 
 Gradient (const HSV &color)
 Construct a one-color gradient. More...
 
const HSVnanColor () 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. More...
 
HSV operator() (double x) const
 Return a color for the specified position. More...
 
const ColorMapcolorMap () const
 Reference to color map. More...
 
ColorMapcolorMap ()
 Reference to color map. More...
 

Constructor & Destructor Documentation

Rose::Color::Gradient::Gradient ( )
inline

Default constructor.

A default-constructed gradient maps all points in the domain to the default-constructed color.

Definition at line 233 of file Color.h.

Rose::Color::Gradient::Gradient ( const RGB color)
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 241 of file Color.h.

References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert().

Rose::Color::Gradient::Gradient ( const HSV color)
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 242 of file Color.h.

References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert().

Rose::Color::Gradient::Gradient ( const HSV color1,
const HSV color2 
)
inline

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 249 of file Color.h.

References Sawyer::Container::Map< K, T, Cmp, Alloc >::insert().

Member Function Documentation

void Rose::Color::Gradient::clear ( )
inline

Remove all points from the gradient.

Definition at line 255 of file Color.h.

References Sawyer::Container::Map< K, T, Cmp, Alloc >::clear().

void Rose::Color::Gradient::insert ( double  where,
const HSV color 
)
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 268 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.

HSV Rose::Color::Gradient::operator() ( double  x) const
inline

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.

Definition at line 277 of file Color.h.

const ColorMap& Rose::Color::Gradient::colorMap ( ) const
inline

Reference to color map.

Returns a reference to the colors that are defined in this gradient.

Definition at line 285 of file Color.h.

ColorMap& Rose::Color::Gradient::colorMap ( )
inline

Reference to color map.

Returns a reference to the colors that are defined in this gradient.

Definition at line 286 of file Color.h.


The documentation for this class was generated from the following file: