00001
00002
00003
00004
00005
00006
00007 #ifndef __VPCOLOR_H
00008 #define __VPCOLOR_H
00009
00010 #include <iostream>
00011
00014
00015 class VPColor {
00016 friend std::ostream& operator<<(std::ostream& output, const VPColor& c);
00017 public:
00019 VPColor();
00020 VPColor(const VPColor& color);
00021 VPColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255);
00022 void SetR(unsigned char r) { rgba[0] = r; }
00023 void SetG(unsigned char g) { rgba[1] = g; }
00024 void SetB(unsigned char b) { rgba[2] = b; }
00025 void SetA(unsigned char a) { rgba[3] = a; }
00026 void SetRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
00027 unsigned char GetR() const { return rgba[0]; }
00028 unsigned char GetG() const { return rgba[1]; }
00029 unsigned char GetB() const { return rgba[2]; }
00030 unsigned char GetA() const { return rgba[3]; }
00031 void GetRGBA(unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a) const;
00033 void Get(float rgbaVec[4]) const;
00034 VPColor& operator=(const VPColor& color);
00035 VPColor operator+(const VPColor& color) const;
00036 VPColor operator-(const VPColor& color) const;
00037 bool operator==(const VPColor& color) const;
00038 bool operator!=(const VPColor& color) const;
00039
00041
00049 void GetScaled(float escalar, float result[4]) const;
00050
00052
00060 void GetScaled(float escalar, VPColor* result) const;
00061
00063 static const VPColor& BLACK();
00065 static const VPColor& RED();
00067 static const VPColor& GREEN();
00069 static const VPColor& BLUE();
00071 static const VPColor& WHITE();
00072
00074
00077 static VPColor RANDOM();
00078 private:
00079
00081 unsigned char rgba[4];
00082
00083
00084 };
00085
00086 #endif // _VPCOLOR_H