45 CColor(
float cr,
float cg,
float cb,
float ca) :
r(cr),
g(cg),
b(cb),
a(ca) {}
52 return r >= 0 &&
g >= 0 &&
b >= 0 &&
a >= 0;
61 bool ParseString(
const CStr8& value,
int defaultAlpha = 255);
66 return !(*
this == color);
75 sizeof(
CColor) ==
sizeof(
float) * 4u &&
77 offsetof(
CColor,
g) ==
sizeof(float) &&
78 offsetof(
CColor,
b) ==
sizeof(float) * 2u &&
79 offsetof(
CColor,
a) ==
sizeof(float) * 3u,
80 "CColor should be properly layouted to use AsFloatArray");
88 static_cast<u8>(
r * 255.f),
89 static_cast<u8>(
g * 255.f),
90 static_cast<u8>(
b * 255.f),
91 static_cast<u8>(
a * 255.f)
void ColorActivateFastImpl()
Detects CPU caps and activates the best possible codepath.
Definition: Color.cpp:78
SColor4ub(* ConvertRGBColorTo4ub)(const RGBColor &src)
Definition: Color.cpp:43
CVector4D RGBAColor
Definition: Color.h:30
CVector3D RGBColor
Definition: Color.h:29
Definition: Vector3D.h:31
Definition: Vector4D.h:31
Simplifed version of std::span (C++20) as we don't support the original one yet.
Definition: Span.h:37
span(const std::array< T, N > &) -> span< const T >
bool ParseString(const CStr8 &value, int defaultAlpha=255)
Try to parse Value as a color.
Definition: Color.cpp:94
bool operator==(const CColor &color) const
Definition: Color.cpp:139
PS::span< const float > AsFloatArray() const
Definition: Color.h:70
float g
Definition: Color.h:95
bool operator!=(const CColor &color) const
Definition: Color.h:64
float a
Definition: Color.h:95
CColor(float cr, float cg, float cb, float ca)
Definition: Color.h:45
float b
Definition: Color.h:95
float r
Definition: Color.h:95
CColor()
Definition: Color.h:44
SColor4ub AsSColor4ub() const
Definition: Color.h:85
uint8_t u8
Definition: types.h:37