TinyGPU
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
RGB888 Class Reference

RGB color stored in 24-bit RGB888 format. More...

#include <RGB888.h>

Public Member Functions

 RGB888 ()=default
 Creates a black RGB888 color.
 
 RGB888 (uint8_t r, uint8_t g, uint8_t b)
 Creates a color from 8-bit red, green, and blue components.
 
 RGB888 (uint8_t v)
 Creates a grayscale color from a single 8-bit value (all channels set to v).
 
void setValue (uint8_t r, uint8_t g, uint8_t b)
 Sets the color from 8-bit red, green, and blue components.
 
uint8_t getRed () const
 Returns the red component.
 
uint8_t getGreen () const
 Returns the green component.
 
uint8_t getBlue () const
 Returns the blue component.
 
const uint8_t * getValue () const
 Returns the packed RGB888 value as a pointer to 3 bytes.
 

Static Public Member Functions

static uint8_t size ()
 Returns size in bits.
 

Protected Attributes

uint8_t value [3] = {0, 0, 0}
 

Detailed Description

RGB color stored in 24-bit RGB888 format.

The class provides conversion between 8-bit per channel RGB values and the packed 24-bit representation (3 bytes) commonly used in graphics.

Constructor & Destructor Documentation

◆ RGB888() [1/3]

RGB888 ( )
default

Creates a black RGB888 color.

◆ RGB888() [2/3]

RGB888 ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

Creates a color from 8-bit red, green, and blue components.

◆ RGB888() [3/3]

RGB888 ( uint8_t  v)
inlineexplicit

Creates a grayscale color from a single 8-bit value (all channels set to v).

Member Function Documentation

◆ getBlue()

uint8_t getBlue ( ) const
inline

Returns the blue component.

◆ getGreen()

uint8_t getGreen ( ) const
inline

Returns the green component.

◆ getRed()

uint8_t getRed ( ) const
inline

Returns the red component.

◆ getValue()

const uint8_t * getValue ( ) const
inline

Returns the packed RGB888 value as a pointer to 3 bytes.

◆ setValue()

void setValue ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inline

Sets the color from 8-bit red, green, and blue components.

◆ size()

static uint8_t size ( )
inlinestatic

Returns size in bits.

Member Data Documentation

◆ value

uint8_t value[3] = {0, 0, 0}
protected

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