DGtal 1.4.0
Loading...
Searching...
No Matches
DGtal::ColorBrightnessColorMap< PValue, PDefaultColor > Class Template Reference

Aim: This class template may be used to (linearly) convert scalar values in a given range into a color with given lightness. More...

#include <DGtal/io/colormaps/ColorBrightnessColorMap.h>

Public Types

typedef PValue Value
 

Public Member Functions

 ColorBrightnessColorMap (const PValue &min, const PValue &max, const Color color=Color(DGTAL_RED_COMPONENT(PDefaultColor), DGTAL_GREEN_COMPONENT(PDefaultColor), DGTAL_BLUE_COMPONENT(PDefaultColor)))
 
Color operator() (const PValue &value) const
 
 ~ColorBrightnessColorMap ()
 
 ColorBrightnessColorMap (const ColorBrightnessColorMap &other)
 
ColorBrightnessColorMapoperator= (const ColorBrightnessColorMap &other)
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
const PValue & min () const
 
const PValue & max () const
 

Static Public Member Functions

static Color getColor (const Color color, const PValue &min, const PValue &max, const PValue &value)
 

Protected Member Functions

 ColorBrightnessColorMap ()
 

Protected Attributes

PValue myMin
 
PValue myMax
 
Color myColor
 

Detailed Description

template<typename PValue, int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
class DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >

Aim: This class template may be used to (linearly) convert scalar values in a given range into a color with given lightness.

Description of template class 'ColorBrightnessColorMap'

The ColorBrightnessColorMap can be used either as a functor object (the value range is given at the object's construction, together with the reference color) which converts a value into a LibBoard::Color structure, or it can be used through a static method taking both the range and the value as parameters.

The code below shows a possible use of this class.

#include "DGtal/io/Color.h"
#include "ColorBrightnessColorMap.h"
// ...
{
Color red = blueShade(1.0f);
Color blue1 = blueShade(0.5f);
// Or, equivalently:
}
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
static Color getColor(const Color color, const PValue &min, const PValue &max, const PValue &value)
Structure representing an RGB triple with alpha component.
Definition Color.h:68
static const Color Blue
Definition Color.h:419
Template Parameters
PValueThe type of the range values.
PDefaultColorThe default color as an integer built using the DGTAL_RGB2INT macro.

Definition at line 89 of file ColorBrightnessColorMap.h.

Member Typedef Documentation

◆ Value

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
typedef PValue DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::Value

Definition at line 93 of file ColorBrightnessColorMap.h.

Constructor & Destructor Documentation

◆ ColorBrightnessColorMap() [1/3]

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::ColorBrightnessColorMap ( const PValue & min,
const PValue & max,
const Color color = Color(DGTAL_RED_COMPONENT(PDefaultColor), DGTAL_GREEN_COMPONENT(PDefaultColor), DGTAL_BLUE_COMPONENT(PDefaultColor)) )

Constructor.

Parameters
minThe lower bound of the value range.
maxThe upper bound of the value range.
colorThe color associated with the upper bound.

◆ ~ColorBrightnessColorMap()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::~ColorBrightnessColorMap ( )

Destructor.

◆ ColorBrightnessColorMap() [2/3]

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::ColorBrightnessColorMap ( const ColorBrightnessColorMap< PValue, PDefaultColor > & other)

Copy constructor.

Parameters
otherthe object to clone.

◆ ColorBrightnessColorMap() [3/3]

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::ColorBrightnessColorMap ( )
protected

Constructor. Forbidden by default (protected to avoid g++ warnings).

Member Function Documentation

◆ getColor()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
static Color DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::getColor ( const Color color,
const PValue & min,
const PValue & max,
const PValue & value )
static

Computes the color associated with a value in a given range.

Parameters
colorThe color associated with the upper bound.
minThe lower bound of the value range.
maxThe upper bound of the value range.
valueA value within the value range.
Returns
A color whose brightness linearly depends on the position of [value] within the range [min]..[max].

◆ isValid()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
bool DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ max()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
const PValue & DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::max ( ) const

Returns the upper bound of the value range.

Returns
The upper bound of the value range.

◆ min()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
const PValue & DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::min ( ) const

Returns the lower bound of the value range.

Returns
The lower bound of the value range.

◆ operator()()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
Color DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::operator() ( const PValue & value) const

Computes the color associated with a value in a given range.

Parameters
valueA value within the value range.
Returns
A color whose brightness linearly depends on the position of [value] within the current range.

◆ operator=()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
ColorBrightnessColorMap & DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::operator= ( const ColorBrightnessColorMap< PValue, PDefaultColor > & other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ selfDisplay()

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
void DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::selfDisplay ( std::ostream & out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

◆ myColor

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
Color DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::myColor
protected

The color of the upper bound value.

Definition at line 197 of file ColorBrightnessColorMap.h.

◆ myMax

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
PValue DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::myMax
protected

The lower bound of the value range.

Definition at line 196 of file ColorBrightnessColorMap.h.

◆ myMin

template<typename PValue , int PDefaultColor = DGTAL_RGB2INT( 255, 255, 255 )>
PValue DGtal::ColorBrightnessColorMap< PValue, PDefaultColor >::myMin
protected

The lower bound of the value range.

Definition at line 195 of file ColorBrightnessColorMap.h.


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