]> git.tdb.fi Git - libs/gl.git/blob - source/color.h
Drop Id tags and copyright notices from files
[libs/gl.git] / source / color.h
1 #ifndef MSP_GL_COLOR_H_
2 #define MSP_GL_COLOR_H_
3
4 namespace Msp {
5 namespace GL {
6
7 struct Color
8 {
9         float r, g, b, a;
10
11         Color(): r(1), g(1), b(1), a(1) { }
12         Color(float v): r(v), g(v), b(v), a(1) { }
13         Color(float r_, float g_, float b_): r(r_), g(g_), b(b_), a(1) { }
14         Color(float r_, float g_, float b_, float a_): r(r_), g(g_), b(b_), a(a_) { }
15         Color operator*(float f) const { return Color(r*f, g*f, b*f, a); }
16         Color operator+(const Color &c) const { return Color(r+c.r, g+c.g, b+c.g, 1-(1-a)*(1-c.a)); }
17         bool operator==(const Color &c) const { return (r==c.r && b==c.b && g==c.g && a==c.a); }
18         bool operator!=(const Color &c) const { return !operator==(c); }
19 };
20
21 } // namespace GL
22 } // namespace Msp
23
24 #endif