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 #ifndef RGBCOLOR_HH
00026 #define RGBCOLOR_HH
00027
00028 typedef unsigned char uchar;
00029
00030
00038
00039 class RGBColor
00040 {
00041 public:
00042
00043
00044
00045
00046 static const RGBColor White;
00047 static const RGBColor Red;
00048 static const RGBColor Green;
00049 static const RGBColor Blue;
00050 static const RGBColor Black;
00051 static const RGBColor Yellow;
00052 static const RGBColor Magenta;
00053 static const RGBColor Cyan;
00054
00055
00059
00060 RGBColor ();
00061
00062
00070
00071 RGBColor (uchar red, uchar green, uchar blue);
00072
00073
00079
00080 RGBColor (uchar gray);
00081
00082 uchar red() const;
00083 uchar green() const;
00084 uchar blue() const;
00085
00086 void set(uchar red, uchar green, uchar blue);
00087
00088
00090 void print() const;
00091
00092 RGBColor& operator +=(const RGBColor& c);
00093 RGBColor& operator +=(uchar gray);
00094 RGBColor& operator -=(const RGBColor& c);
00095 RGBColor& operator -=(uchar gray);
00096 RGBColor& operator *=(float factor);
00097
00098
00099 bool operator ==(const RGBColor& c) const;
00100 bool operator !=(const RGBColor& c) const;
00101
00102
00103 protected:
00104
00105 uchar rc, gc, bc;
00106 };
00107
00108
00109 RGBColor operator ! (const RGBColor& c);
00110 RGBColor operator + (const RGBColor& c1, const RGBColor& c2);
00111 RGBColor operator - (const RGBColor& c1, const RGBColor& c2);
00112 RGBColor operator * (const RGBColor& c1, float factor);
00113 RGBColor operator * (float factor, const RGBColor& c1);
00114
00115
00116 #include "RGBColor.icc"
00117
00118 #endif