frame_helper
ColorGradient.h
Go to the documentation of this file.
1 #ifndef COLORGRADIENT_H
2 #define COLORGRADIENT_H
3 
4 #include <list>
5 #include <stdexcept>
6 #include "ColorGradientTypes.h"
7 
8 namespace frame_helper {
9 
11 
12  struct ColorPoint { // Internal class used to store colors at different points in the gradient.
13  float r, g, b; // Red, green and blue values of our color.
14  float val; // Position of our color along the gradient (between 0 and 1).
15  ColorPoint(float red, float green, float blue, float value) :
16  r(red), g(green), b(blue), val(value) {
17  }
18  };
19 
20 private:
21  std::list<ColorPoint> color; // An array of color points in ascending value.
22 
23 public:
25  void addColorPoint(const float red, const float green, const float blue, const float value);
26  void clearGradient();
27  void getColorAtValue(const float value, float &red, float &green, float &blue) const;
28  void colormapSelector(const ColorGradientType type);
29 };
30 
31 }
32 
33 #endif
void colormapSelector(const ColorGradientType type)
Definition: ColorGradient.cpp:49
void clearGradient()
Definition: ColorGradient.cpp:44
void addColorPoint(const float red, const float green, const float blue, const float value)
Definition: ColorGradient.cpp:6
void getColorAtValue(const float value, float &red, float &green, float &blue) const
Definition: ColorGradient.cpp:18
ColorGradient()
Definition: ColorGradient.h:24
Definition: ColorGradient.h:10
ColorGradientType
Definition: ColorGradientTypes.h:6