31#if defined(GradientColorMap_RECURSES)
32#error Recursive header files inclusion detected in GradientColorMap.h
35#define GradientColorMap_RECURSES
37#if !defined GradientColorMap_h
39#define GradientColorMap_h
44#include "DGtal/base/Common.h"
45#include "Board/Board.h"
46#include "DGtal/io/Color.h"
50#define DGTAL_RGB2INT(R,G,B) (((R)<<16)|((G)<<8)|(B))
51#define DGTAL_RED_COMPONENT(I) (((I)>>16)&0xFF)
52#define DGTAL_GREEN_COMPONENT(I) (((I)>>8)&0xFF)
53#define DGTAL_BLUE_COMPONENT(I) ((I)&0xFF)
115 template <
typename PValue,
117 int PDefaultFirstColor = -1,
118 int PDefaultLastColor = -1 >
143 const Color firstColor
146 Color( DGTAL_RED_COMPONENT( PDefaultFirstColor ),
147 DGTAL_GREEN_COMPONENT( PDefaultFirstColor ),
148 DGTAL_BLUE_COMPONENT( PDefaultFirstColor ) ),
149 const
Color lastColor
151 ( PDefaultFirstColor == -1 ) ?
Color::None :
152 Color( DGTAL_RED_COMPONENT( PDefaultLastColor ),
153 DGTAL_GREEN_COMPONENT( PDefaultLastColor ),
154 DGTAL_BLUE_COMPONENT( PDefaultLastColor ) )
217 const PValue &
min()
const;
224 const PValue &
max()
const;
275 template <
typename PValue,
277 int PDefaultFirstColor,
278 int PDefaultLastColor >
287#include "DGtal/io/colormaps/GradientColorMap.ih"
294#undef GradientColorMap_RECURSES
Structure representing an RGB triple with alpha component.
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
std::vector< Color > myColors
void addColor(const Color &color)
GradientColorMap(const GradientColorMap &other)
void selfDisplay(std::ostream &out) const
const PValue & min() const
GradientColorMap & operator=(const GradientColorMap &other)
Color operator()(const PValue &value) const
GradientColorMap(const PValue &min, const PValue &max, const ColorGradientPreset preset=static_cast< ColorGradientPreset >(PDefaultPreset), const Color firstColor=(PDefaultFirstColor==-1) ? Color::None :Color(DGTAL_RED_COMPONENT(PDefaultFirstColor), DGTAL_GREEN_COMPONENT(PDefaultFirstColor), DGTAL_BLUE_COMPONENT(PDefaultFirstColor)), const Color lastColor=(PDefaultFirstColor==-1) ? Color::None :Color(DGTAL_RED_COMPONENT(PDefaultLastColor), DGTAL_GREEN_COMPONENT(PDefaultLastColor), DGTAL_BLUE_COMPONENT(PDefaultLastColor)))
static Color getColor(const std::vector< Color > &colors, const PValue &min, const PValue &max, PValue value)
const PValue & max() const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)