Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches

RGBA colour with packed-format conversions (RGB565, RGBA8888). More...

#include <Color.h>

Public Member Functions

 Color ()
 Color (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha=255)
uint16_t ToRGB565 () const
uint32_t ToRGB888 () const
uint32_t ToARGB8888 () const
uint32_t ToRGBA8888 () const
uint32_t ToABGR8888 () const
void ToFloats (float &r, float &g, float &b, float &a) const
void ToHSV (float &h, float &s, float &v) const
Color Lerp (const Color &to, float t) const
Color Multiply (float factor) const
Color Tint (const Color &tintColor, float intensity) const
Color WithAlpha (uint8_t newAlpha) const
uint8_t GetLuminance () const
Color ToGrayscale () const
Color AdjustBrightness (float factor) const
Color AdjustSaturation (float factor) const
bool operator== (const Color &other) const
bool operator!= (const Color &other) const

Static Public Member Functions

static Color FromRGB565 (uint16_t rgb565)
static Color FromRGB888 (uint32_t rgb888)
static Color FromARGB8888 (uint32_t argb8888)
static Color FromRGBA8888 (uint32_t rgba8888)
static Color FromFloats (float r, float g, float b, float a=1.0f)
static Color FromHSV (float h, float s, float v, float a=1.0f)

Public Attributes

uint8_t r
uint8_t g
uint8_t b
uint8_t a

Static Public Attributes

static const Color Black { 0, 0, 0 }
static const Color White { 255, 255, 255 }
static const Color Red { 255, 0, 0 }
static const Color Green { 0, 255, 0 }
static const Color Blue { 0, 0, 255 }
static const Color Yellow { 255, 255, 0 }
static const Color Cyan { 0, 255, 255 }
static const Color Magenta { 255, 0, 255 }
static const Color Gray { 128, 128, 128 }
static const Color DarkGray { 64, 64, 64 }
static const Color LightGray { 192, 192, 192 }
static const Color Orange { 255, 165, 0 }
static const Color Purple { 128, 0, 128 }
static const Color Brown { 139, 69, 19 }
static const Color Pink { 255, 192, 203 }
static const Color Transparent { 0, 0, 0, 0 }
static const Color SkyBlue { 135, 206, 235 }
static const Color GrassGreen { 124, 252, 0 }
static const Color SunsetOrange { 255, 94, 77 }
static const Color NightBlue { 25, 25, 112 }

Detailed Description

RGBA colour with packed-format conversions (RGB565, RGBA8888).

The Color class provides a unified interface for color handling throughout the engine, supporting RGB, RGBA, and various packed formats with conversion utilities.

Constructor & Destructor Documentation

◆ Color() [1/2]

Deki::Color::Color ( )
inline

◆ Color() [2/2]

Deki::Color::Color ( uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha = 255 )
inline

Member Function Documentation

◆ FromRGB565()

Color Deki::Color::FromRGB565 ( uint16_t rgb565)
inlinestatic

◆ FromRGB888()

Color Deki::Color::FromRGB888 ( uint32_t rgb888)
inlinestatic

◆ FromARGB8888()

Color Deki::Color::FromARGB8888 ( uint32_t argb8888)
inlinestatic

◆ FromRGBA8888()

Color Deki::Color::FromRGBA8888 ( uint32_t rgba8888)
inlinestatic

◆ FromFloats()

Color Deki::Color::FromFloats ( float r,
float g,
float b,
float a = 1.0f )
static

◆ FromHSV()

Color Deki::Color::FromHSV ( float h,
float s,
float v,
float a = 1.0f )
static

◆ ToRGB565()

uint16_t Deki::Color::ToRGB565 ( ) const
inline

◆ ToRGB888()

uint32_t Deki::Color::ToRGB888 ( ) const
inline

◆ ToARGB8888()

uint32_t Deki::Color::ToARGB8888 ( ) const
inline

◆ ToRGBA8888()

uint32_t Deki::Color::ToRGBA8888 ( ) const
inline

◆ ToABGR8888()

uint32_t Deki::Color::ToABGR8888 ( ) const
inline

◆ ToFloats()

void Deki::Color::ToFloats ( float & r,
float & g,
float & b,
float & a ) const

◆ ToHSV()

void Deki::Color::ToHSV ( float & h,
float & s,
float & v ) const

◆ Lerp()

Color Deki::Color::Lerp ( const Color & to,
float t ) const

◆ Multiply()

Color Deki::Color::Multiply ( float factor) const

◆ Tint()

Color Deki::Color::Tint ( const Color & tintColor,
float intensity ) const

◆ WithAlpha()

Color Deki::Color::WithAlpha ( uint8_t newAlpha) const
inline

◆ GetLuminance()

uint8_t Deki::Color::GetLuminance ( ) const
inline

◆ ToGrayscale()

Color Deki::Color::ToGrayscale ( ) const

◆ AdjustBrightness()

Color Deki::Color::AdjustBrightness ( float factor) const

◆ AdjustSaturation()

Color Deki::Color::AdjustSaturation ( float factor) const

◆ operator==()

bool Deki::Color::operator== ( const Color & other) const
inline

◆ operator!=()

bool Deki::Color::operator!= ( const Color & other) const
inline

Member Data Documentation

◆ r

uint8_t Deki::Color::r

◆ g

uint8_t Deki::Color::g

◆ b

uint8_t Deki::Color::b

◆ a

uint8_t Deki::Color::a

◆ Black

const Color Deki::Color::Black { 0, 0, 0 }
inlinestatic

◆ White

const Color Deki::Color::White { 255, 255, 255 }
inlinestatic

◆ Red

const Color Deki::Color::Red { 255, 0, 0 }
inlinestatic

◆ Green

const Color Deki::Color::Green { 0, 255, 0 }
inlinestatic

◆ Blue

const Color Deki::Color::Blue { 0, 0, 255 }
inlinestatic

◆ Yellow

const Color Deki::Color::Yellow { 255, 255, 0 }
inlinestatic

◆ Cyan

const Color Deki::Color::Cyan { 0, 255, 255 }
inlinestatic

◆ Magenta

const Color Deki::Color::Magenta { 255, 0, 255 }
inlinestatic

◆ Gray

const Color Deki::Color::Gray { 128, 128, 128 }
inlinestatic

◆ DarkGray

const Color Deki::Color::DarkGray { 64, 64, 64 }
inlinestatic

◆ LightGray

const Color Deki::Color::LightGray { 192, 192, 192 }
inlinestatic

◆ Orange

const Color Deki::Color::Orange { 255, 165, 0 }
inlinestatic

◆ Purple

const Color Deki::Color::Purple { 128, 0, 128 }
inlinestatic

◆ Brown

const Color Deki::Color::Brown { 139, 69, 19 }
inlinestatic

◆ Pink

const Color Deki::Color::Pink { 255, 192, 203 }
inlinestatic

◆ Transparent

const Color Deki::Color::Transparent { 0, 0, 0, 0 }
inlinestatic

◆ SkyBlue

const Color Deki::Color::SkyBlue { 135, 206, 235 }
inlinestatic

◆ GrassGreen

const Color Deki::Color::GrassGreen { 124, 252, 0 }
inlinestatic

◆ SunsetOrange

const Color Deki::Color::SunsetOrange { 255, 94, 77 }
inlinestatic

◆ NightBlue

const Color Deki::Color::NightBlue { 25, 25, 112 }
inlinestatic

The documentation for this class was generated from the following file: