31 rgba[0] = color.rgba[0];
32 rgba[1] = color.rgba[1];
33 rgba[2] = color.rgba[2];
34 rgba[3] = color.rgba[3];
49 uchar p =
static_cast<uchar>(v * (1 - s) * 255);
50 uchar q =
static_cast<uchar>(v * (1 - s * f) * 255);
51 uchar t =
static_cast<uchar>(v * (1 - s * (1 - f)) * 255);
113 byte =
static_cast<unsigned char>(rand() % 256);
115 byte =
static_cast<unsigned char>(rand() % 256);
117 byte =
static_cast<unsigned char>(rand() % 256);
131 unsigned char* b,
unsigned char* a)
const {
139 rgbaVec[0] = rgba[0]/255.0f;
140 rgbaVec[1] = rgba[1]/255.0f;
141 rgbaVec[2] = rgba[2]/255.0f;
142 rgbaVec[3] = rgba[3]/255.0f;
145 rgba[0] = color.rgba[0];
146 rgba[1] = color.rgba[1];
147 rgba[2] = color.rgba[2];
148 rgba[3] = color.rgba[3];
153 VART::Color c(rgba[0]+color.rgba[0], rgba[1]+color.rgba[1],
154 rgba[2]+color.rgba[2], rgba[3]+color.rgba[3]);
159 VART::Color c(rgba[0]-color.rgba[0], rgba[1]-color.rgba[1],
160 rgba[2]-color.rgba[2], rgba[3]-color.rgba[3]);
165 return ( rgba[0] == color.rgba[0] &&
166 rgba[1] == color.rgba[1] &&
167 rgba[2] == color.rgba[2] &&
168 rgba[3] == color.rgba[3] );
172 return ( rgba[0] != color.rgba[0] ||
173 rgba[1] != color.rgba[1] ||
174 rgba[2] != color.rgba[2] ||
175 rgba[3] != color.rgba[3] );
179 assert(escalar >= 0);
180 assert(escalar <= 1);
181 result[0] = rgba[0]/255.0f * escalar;
182 result[1] = rgba[1]/255.0f * escalar;
183 result[2] = rgba[2]/255.0f * escalar;
184 result[3] = rgba[3]/255.0f;
188 assert(escalar >= 0);
189 assert(escalar <= 1);
190 result->rgba[0] =
static_cast<unsigned char>(rgba[0] * escalar);
191 result->rgba[1] =
static_cast<unsigned char>(rgba[1] * escalar);
192 result->rgba[2] =
static_cast<unsigned char>(rgba[2] * escalar);
193 result->rgba[3] = rgba[3];
199 output <<
"{" <<
static_cast<int>(c.rgba[0]) <<
" "
200 << static_cast<int>(c.rgba[1]) <<
" " <<
static_cast<int>(c.rgba[2])
201 <<
" " << static_cast<int>(c.rgba[3]) <<
"}";
static const Color & YELLOW()
Yellow opaque color.
static const Color & RED()
Red opaque color.
static const Color & BLUE()
Blue opaque color.
Color operator-(const Color &color) const
void GetRGBA(unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) const
ostream & operator<<(ostream &output, const Color &c)
Color()
Creates a black, opaque color.
void SetR(unsigned char r)
void SetG(unsigned char g)
static const Color & GREEN()
Green opaque color.
bool operator==(const Color &color) const
RGBA color representation.
static const Color & MAGENTA()
Magenta opaque color.
static Color HSV(unsigned char h_, unsigned char s_, unsigned char v_)
HSV named Constructor.
void SetRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void SetB(unsigned char b)
static const Color & CYAN()
Cyan opaque color.
void GetScaled(float escalar, float result[4]) const
Multiplies RGB components, keeps A component.
bool operator!=(const Color &color) const
static const Color & BLACK()
Black opaque color.
void Get(float rgbaVec[4]) const
Returns RGBA componts as a vector of floats.
Header file for V-ART class "Color".
static Color RANDOM()
Returns a randomly chosen color.
Color operator+(const Color &color) const
Color & operator=(const Color &color)
static const Color & WHITE()
White opaque color.
void SetA(unsigned char a)