68 public:
typedef unsigned int RGBA;
77 public:
typedef unsigned int BGRA;
86 public:
typedef unsigned int ARGB;
95 public:
typedef unsigned int ABGR;
105 public:
constexpr Color(
const float _r,
const float _g,
const float _b,
106 const float _a = 1.0)
107 : r(_r), g(_g), b(_b), a(_a)
128 public:
void Set(
const float _r = 1,
const float _g = 1,
129 const float _b = 1,
const float _a = 1);
140 public:
void SetFromHSV(
const float _h,
const float _s,
const float _v);
150 public:
void SetFromYUV(
const float _y,
const float _u,
const float _v);
274 private:
constexpr void Clamp()
277 if (!(this->r >= 0)) { this->r = 0; }
278 if (!(this->g >= 0)) { this->g = 0; }
279 if (!(this->b >= 0)) { this->b = 0; }
280 if (!(this->a >= 0)) { this->a = 0; }
281 if (this->r > 1) { this->r = this->r/255.0f; }
282 if (this->g > 1) { this->g = this->g/255.0f; }
283 if (this->b > 1) { this->b = this->b/255.0f; }
284 if (this->a > 1) { this->a = 1; }
294 for (
auto i : {0, 1, 2, 3})
311 _in.
setf(std::ios_base::skipws);
312 _in >> _pt.r >> _pt.g >> _pt.b;
322 else if (!_in.
fail())
331 public:
float R()
const;
335 public:
float G()
const;
339 public:
float B()
const;
343 public:
float A()
const;
363 public:
void R(
const float _r);
367 public:
void G(
const float _g);
371 public:
void B(
const float _b);
375 public:
void A(
const float _a);
378 private:
float r = 0;
381 private:
float g = 0;
384 private:
float b = 0;
387 private:
float a = 1;