00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00024 #ifndef __vtkColor_h
00025 #define __vtkColor_h
00026
00027 #include "vtkVector.h"
00028
00029
00030
00031 template<typename T>
00032 class vtkColor3 : public vtkVector<T, 3>
00033 {
00034 public:
00035 vtkColor3(const T& red = 0.0, const T& green = 0.0, const T& blue = 0.0)
00036 {
00037 this->Data[0] = red;
00038 this->Data[1] = green;
00039 this->Data[2] = blue;
00040 }
00041
00043
00044 void Set(const T& red, const T& green, const T& blue)
00045 {
00046 this->Data[0] = red;
00047 this->Data[1] = green;
00048 this->Data[2] = blue;
00049 }
00051
00053 void SetRed(const T& red) { this->Data[0] = red; }
00054
00056
00057 const T& GetRed() const { return this->Data[0]; }
00058 const T& Red() const { return this->Data[0]; }
00060
00062 void SetGreen(const T& green) { this->Data[1] = green; }
00063
00065
00066 const T& GetGreen() const { return this->Data[1]; }
00067 const T& Green() const { return this->Data[1]; }
00069
00071 void SetBlue(const T& blue) { this->Data[2] = blue; }
00072
00074
00075 const T& GetBlue() const { return this->Data[2]; }
00076 const T& Blue() const { return this->Data[2]; }
00078 };
00079
00080
00081
00082 template<typename T>
00083 class vtkColor4 : public vtkVector<T, 4>
00084 {
00085 public:
00086 vtkColor4(const T& red = 0.0, const T& green = 0.0, const T& blue = 0.0,
00087 const T& alpha = 0.0)
00088 {
00089 this->Data[0] = red;
00090 this->Data[1] = green;
00091 this->Data[2] = blue;
00092 this->Data[3] = alpha;
00093 }
00094
00096
00097 void Set(const T& red, const T& green, const T& blue)
00098 {
00099 this->Data[0] = red;
00100 this->Data[1] = green;
00101 this->Data[2] = blue;
00102 }
00104
00106
00107 void Set(const T& red, const T& green, const T& blue, const T& alpha)
00108 {
00109 this->Data[0] = red;
00110 this->Data[1] = green;
00111 this->Data[2] = blue;
00112 this->Data[3] = alpha;
00113 }
00115
00117 void SetRed(const T& red) { this->Data[0] = red; }
00118
00120
00121 const T& GetRed() const { return this->Data[0]; }
00122 const T& Red() const { return this->Data[0]; }
00124
00126 void SetGreen(const T& green) { this->Data[1] = green; }
00127
00129
00130 const T& GetGreen() const { return this->Data[1]; }
00131 const T& Green() const { return this->Data[1]; }
00133
00135 void SetBlue(const T& blue) { this->Data[2] = blue; }
00136
00138
00139 const T& GetBlue() const { return this->Data[2]; }
00140 const T& Blue() const { return this->Data[2]; }
00142
00144 void SetAlpha(const T& alpha) { this->Data[3] = alpha; }
00145
00147
00148 const T& GetAlpha() const { return this->Data[3]; }
00149 const T& Alpha() const { return this->Data[3]; }
00151 };
00152
00155 class vtkColor3ub : public vtkColor3<unsigned char>
00156 {
00157 public:
00158 vtkColor3ub(unsigned char r = 0, unsigned char g = 0,
00159 unsigned char b = 0) : vtkColor3<unsigned char>(r, g, b) {}
00160 };
00161
00162 class vtkColor3f : public vtkColor3<float>
00163 {
00164 public:
00165 vtkColor3f(float r = 0.0, float g = 0.0, float b = 0.0)
00166 : vtkColor3<float>(r, g, b) {}
00167 };
00168
00169 class vtkColor3d : public vtkColor3<double>
00170 {
00171 public:
00172 vtkColor3d(double r = 0.0, double g = 0.0, double b = 0.0)
00173 : vtkColor3<double>(r, g, b) {}
00174 };
00175
00176 class vtkColor4ub : public vtkColor4<unsigned char>
00177 {
00178 public:
00179 vtkColor4ub(unsigned char r = 0, unsigned char g = 0,
00180 unsigned char b = 0, unsigned char a = 255)
00181 : vtkColor4<unsigned char>(r, g, b, a) {}
00182 };
00183
00184 class vtkColor4f : public vtkColor4<float>
00185 {
00186 public:
00187 vtkColor4f(float r = 0.0, float g = 0.0, float b = 0.0, float a = 1.0)
00188 : vtkColor4<float>(r, g, b, a) {}
00189 };
00190
00191 class vtkColor4d : public vtkColor4<double>
00192 {
00193 public:
00194 vtkColor4d(double r = 0.0, double g = 0.0, double b = 0.0, float a = 1.0)
00195 : vtkColor4<double>(r, g, b, a) {}
00196 };
00197
00198 #endif // __vtkColor_h