49 Color(
unsigned char newR,
unsigned char newG,
unsigned char newB,
unsigned char newA):
64 r(CLAMP((int)(color.x*255), 0, 255)),
65 g(CLAMP((int)(color.y*255), 0, 255)),
66 b(CLAMP((int)(color.z*255), 0, 255)),
71 r(CLAMP((int)(color.x*255), 0, 255)),
72 g(CLAMP((int)(color.y*255), 0, 255)),
73 b(CLAMP((int)(color.z*255), 0, 255)),
74 a(CLAMP((int)(color.w*255), 0, 255))
84 int R = r + color.
r;
if(R > 255) R = 255;
85 int G = g + color.
g;
if(G > 255) G = 255;
86 int B = b + color.
b;
if(B > 255) B = 255;
87 int A = a + color.
a;
if(A > 255) A = 255;
89 return Color(R, G, B, A);
94 int R = r - color.
r;
if(R < 0) R = 0;
95 int G = g - color.
g;
if(G < 0) G = 0;
96 int B = b - color.
b;
if(B < 0) B = 0;
97 int A = a - color.
a;
if(A < 0) A = 0;
99 return Color(R, G, B, A);
102 inline Color operator + (
const int value)
const
104 int R = CLAMP((
int)(r + value), 0, 255);
105 int G = CLAMP((
int)(g + value), 0, 255);
106 int B = CLAMP((
int)(b + value), 0, 255);
107 int A = CLAMP((
int)(a + value), 0, 255);
109 return Color(R, G, B, A);
112 inline Color operator - (
const int value)
const
114 int R = CLAMP((
int)(r - value), 0, 255);
115 int G = CLAMP((
int)(g - value), 0, 255);
116 int B = CLAMP((
int)(b - value), 0, 255);
117 int A = CLAMP((
int)(a - value), 0, 255);
119 return Color(R, G, B, A);
122 inline Color operator * (
const float value)
const
124 int R = CLAMP((
int)(r * value), 0, 255);
125 int G = CLAMP((
int)(g * value), 0, 255);
126 int B = CLAMP((
int)(b * value), 0, 255);
127 int A = CLAMP((
int)(a * value), 0, 255);
129 return Color(R, G, B, A);
132 inline Color operator / (
const float value)
const
134 int R = CLAMP((
int)(r / value), 0, 255);
135 int G = CLAMP((
int)(g / value), 0, 255);
136 int B = CLAMP((
int)(b / value), 0, 255);
137 int A = CLAMP((
int)(a / value), 0, 255);
139 return Color(R, G, B, A);
142 inline bool operator == (
const Color & color)
const
144 if(r == color.
r && g == color.
g && b == color.
b && a == color.
a)
150 inline bool operator != (
const Color & color)
const
152 return !((*this) == color);
155 inline operator unsigned char * ()
const
157 return (
unsigned char *)
this;
160 inline operator const unsigned char * ()
const
162 return (
const unsigned char *)
this;
167 inline void set(
unsigned char newR,
unsigned char newG,
unsigned char newB,
unsigned char newA)
Color(unsigned char newR, unsigned char newG, unsigned char newB, unsigned char newA)
Definition: Color.h:49
Color(const Vector4 &color)
Definition: Color.h:70
unsigned char a
Definition: Color.h:38
unsigned char g
Definition: Color.h:36
unsigned char b
Definition: Color.h:37
unsigned char r
Definition: Color.h:35
Color(void)
Definition: Color.h:42
~Color()
Definition: Color.h:77
void set(unsigned char newR, unsigned char newG, unsigned char newB, unsigned char newA)
Definition: Color.h:167
Color(const Vector3 &color)
Definition: Color.h:63
Color(const Color &color)
Definition: Color.h:56