00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00039 #ifndef _COLOR_H
00040 #define _COLOR_H
00041
00048 namespace GVectors {
00049
00056 class Color {
00057 private:
00063 float c_red;
00069 float c_green;
00075 float c_blue;
00076
00077 public:
00083 inline Color() : c_red(0), c_green(0), c_blue(0) { ; }
00084
00096 inline Color(float r, float g, float b) : c_red(r), c_green(g), c_blue(b) { ; }
00097
00105 inline Color(const Color& c) : c_red(c.c_red), c_green(c.c_green), c_blue(c.c_blue) { ; }
00106
00112 inline ~Color() { ; }
00113
00123 inline const Color& operator=(const Color& c) {
00124 c_red = c.c_red;
00125 c_green = c.c_green;
00126 c_blue = c.c_blue;
00127 return *this;
00128 }
00129
00137 inline void red(float r) { c_red = r; }
00138
00146 inline void green(float g) { c_green = g; }
00147
00155 inline void blue(float b) { c_blue = b; }
00156
00164 inline float red() const { return c_red; }
00165
00173 inline float green() const { return c_green; }
00174
00182 inline float blue() const { return c_blue; }
00183
00193 inline Color operator+(const Color& c) {
00194 return Color(c_red+c.c_red, c_green+c.c_green, c_blue+c.c_blue);
00195 }
00196
00206 inline Color operator-(const Color& c) {
00207 return Color(c_red-c.c_red, c_green-c.c_green, c_blue-c.c_blue);
00208 }
00209 };
00210 }
00211
00212 #endif
00213