MorphoGraphX  2.0-1-227
Palette.hpp
Go to the documentation of this file.
1 #ifndef _PALETTE_HPP_
2 #define _PALETTE_HPP_
3 
9 #include <config.h>
10 #include <string>
11 #include <util/gl.h>
12 #include <util/color.h>
13 #include <util/watchdog.h>
14 
15 namespace util {
23  class Palette : public FileObject {
24  public:
25  typedef util::Color<GLfloat> Color;
26 
32  Palette(std::string filename);
33 
37  Palette();
38 
42  void reread();
43 
50  Color getColor(unsigned int index, double alpha = 1) const;
60  Color getColor(unsigned int ind1, unsigned int ind2, double w, double alpha = 1) const;
66  void useColor(unsigned int index, double alpha = 1) const;
75  void blend(unsigned int ind1, unsigned int ind2, double w, double alpha = 1) const;
76 
80  static Color blend(const Color& c1, const Color& c2, double w);
81 
91  void select(unsigned int start, unsigned int end, double w, double alpha = 1) const;
92 
101  Color selectColor(unsigned int start, unsigned int end, double w, double alpha = 1) const;
102 
103 
104  private:
105  Color colors[256];
106  };
107 }
108 
109 #endif
110 
util::Palette
A utility class for palettes.
Definition: Palette.hpp:23
util::Palette::select
void select(unsigned int start, unsigned int end, double w, double alpha=1) const
Select a color from a range in a palette and make it the current OpenGL color.
util::Palette::reread
void reread()
Reread the file describing the palette.
mgx::c2
CU_HOST_DEVICE const const T T c2
Definition: Geometry.hpp:234
util::Palette::useColor
void useColor(unsigned int index, double alpha=1) const
Get a color and make it the current OpenGL color.
util::Palette::blend
void blend(unsigned int ind1, unsigned int ind2, double w, double alpha=1) const
Blend two colors together and make the result the current OpenGL color.
mgx::c1
CU_HOST_DEVICE const const T c1
Definition: Geometry.hpp:234
util::Palette::Color
util::Color< GLfloat > Color
Definition: Palette.hpp:25
util::Palette::getColor
Color getColor(unsigned int index, double alpha=1) const
Get a color from the palette.
util::Palette::selectColor
Color selectColor(unsigned int start, unsigned int end, double w, double alpha=1) const
Select a color from a range in a palette and returns it.
util
Definition: Palette.hpp:15
util::Palette::Palette
Palette()
Construct an empty palette with only black colors.