ROSE 0.11.145.147
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 to a color by linear interpolation between specified colors.

Definition at line 228 of file Color.h.

#include <Rose/Color.h>

Public Types

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

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 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.
 
HSV operator() (double x) const
 Return a color for the specified position.
 
const ColorMapcolorMap () const
 Reference to color map.
 
ColorMapcolorMap ()
 Reference to color map.
 

Member Typedef Documentation

◆ ColorMap

Definition at line 230 of file Color.h.

Constructor & Destructor Documentation

◆ Gradient() [1/4]

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

◆ Gradient() [2/4]

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

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

◆ Gradient() [3/4]

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

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

◆ Gradient() [4/4]

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

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

Member Function Documentation

◆ clear()

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

Remove all points from the gradient.

Definition at line 262 of file Color.h.

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

◆ nanColor() [1/2]

const HSV & Rose::Color::Gradient::nanColor ( ) const
inline

Color for NaN lookups.

Definition at line 267 of file Color.h.

◆ nanColor() [2/2]

void Rose::Color::Gradient::nanColor ( const HSV c)
inline

Color for NaN lookups.

Definition at line 268 of file Color.h.

◆ insert()

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

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

◆ interpolate()

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.

◆ operator()()

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

◆ colorMap() [1/2]

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

◆ colorMap() [2/2]

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


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