18 constexpr Color(uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_ = 255)
19 : r(r_), g(g_), b(b_), a(a_) {}
22 [[nodiscard]]
float RedF() const noexcept {
23 return static_cast<float>(r) / 255.0F;
25 [[nodiscard]]
float GreenF() const noexcept {
26 return static_cast<float>(g) / 255.0F;
28 [[nodiscard]]
float BlueF() const noexcept {
29 return static_cast<float>(b) / 255.0F;
31 [[nodiscard]]
float AlphaF() const noexcept {
32 return static_cast<float>(a) / 255.0F;
35 [[nodiscard]]
bool operator==(
const Color& other)
const noexcept {
36 return r == other.r && g == other.g && b == other.b && a == other.a;
38 [[nodiscard]]
bool operator!=(
const Color& other)
const noexcept {
39 return !(*
this == other);
43 [[nodiscard]]
static constexpr Color Black() noexcept {
return {0, 0, 0}; }
44 [[nodiscard]]
static constexpr Color White() noexcept {
45 return {255, 255, 255};
47 [[nodiscard]]
static constexpr Color Red() noexcept {
return {255, 0, 0}; }
48 [[nodiscard]]
static constexpr Color Green() noexcept {
return {0, 255, 0}; }
49 [[nodiscard]]
static constexpr Color Blue() noexcept {
return {0, 0, 255}; }
50 [[nodiscard]]
static constexpr Color Transparent() noexcept {
RGBA renk temsili. Her kanal [0, 255] aralığında.
Definition color.h:8
constexpr Color()=default
Varsayılan siyah, tam opak renk.
constexpr Color(uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_=255)
RGBA değerleriyle renk oluştur.
Definition color.h:18
float RedF() const noexcept
Rengi [0.0, 1.0] aralığında normalize edilmiş float olarak döndür.
Definition color.h:22