refactor glsequence to be more testable
[mussa.git] / alg / color.h
1 #ifndef _GLCOLOR_H_
2 #define _GLCOLOR_H_
3
4 #include <ostream>
5
6 //! convienece class for handling opengl colors
7 class Color
8 {
9 public:
10   Color();
11   Color(const Color &);
12   //! initialize with red, green, blue, alpha
13   Color(float r, float g, float b, float a=0.0);
14
15   //! set all channels simultaneously 
16   void set(float r, float g, float b, float a=0.0);
17   //! return an array of 4 colors (stored by class)
18   const float* const get() const;
19   void setR(float);
20   float r() const;
21   void setG(float);
22   float g() const;
23   void setB(float);
24   float b() const;
25   void setA(float);
26   float a() const;
27
28   enum color_channels { RedChannel, GreenChannel, BlueChannel, AlphaChannel };
29   friend bool operator==(const Color&, const Color&);
30   friend std::ostream& operator<<(std::ostream&, const Color&);
31
32 protected:
33   float colors[4];
34 };
35
36 #endif
37