roo_display
API Documentation for roo_display
Loading...
Searching...
No Matches
roo_display::Color Class Reference

ARGB8888 color stored as a 32-bit unsigned integer. More...

#include <color.h>

Public Member Functions

 Color ()
 Construct transparent black.
 
constexpr Color (uint8_t r, uint8_t g, uint8_t b)
 Construct opaque color from RGB.
 
constexpr Color (uint8_t a, uint8_t r, uint8_t g, uint8_t b)
 Construct ARGB color from components.
 
constexpr Color (uint32_t argb)
 Construct from a packed ARGB value.
 
constexpr uint32_t asArgb () const
 Return packed ARGB value.
 
constexpr uint8_t a () const
 Alpha channel.
 
constexpr uint8_t r () const
 Red channel.
 
constexpr uint8_t g () const
 Green channel.
 
constexpr uint8_t b () const
 Blue channel.
 
void set_a (uint8_t a)
 Set alpha channel.
 
void set_r (uint8_t r)
 Set red channel.
 
void set_g (uint8_t g)
 Set green channel.
 
void set_b (uint8_t g)
 Set blue channel.
 
constexpr Color withA (uint8_t a) const
 Return a copy with the specified alpha channel.
 
constexpr Color withR (uint8_t r) const
 Return a copy with the specified red channel.
 
constexpr Color withG (uint8_t g) const
 Return a copy with the specified green channel.
 
constexpr Color withB (uint8_t b) const
 Return a copy with the specified blue channel.
 
constexpr bool isOpaque () const
 Return true if the color is fully opaque (alpha = 255).
 
constexpr Color toOpaque ()
 Return a fully opaque copy (alpha = 255).
 

Detailed Description

ARGB8888 color stored as a 32-bit unsigned integer.

This is a lightweight, trivially-constructible type that can be passed by value, with convenience accessors and type safety.

Definition at line 16 of file color.h.

Constructor & Destructor Documentation

◆ Color() [1/4]

roo_display::Color::Color ( )
inline

Construct transparent black.

Definition at line 19 of file color.h.

Referenced by toOpaque(), withA(), withB(), withG(), and withR().

◆ Color() [2/4]

constexpr roo_display::Color::Color ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inlineconstexpr

Construct opaque color from RGB.

Definition at line 22 of file color.h.

◆ Color() [3/4]

constexpr roo_display::Color::Color ( uint8_t  a,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
inlineconstexpr

Construct ARGB color from components.

Definition at line 26 of file color.h.

◆ Color() [4/4]

constexpr roo_display::Color::Color ( uint32_t  argb)
inlineconstexpr

Construct from a packed ARGB value.

Definition at line 30 of file color.h.

Member Function Documentation

◆ a()

◆ asArgb()

constexpr uint32_t roo_display::Color::asArgb ( ) const
inlineconstexpr

◆ b()

◆ g()

◆ isOpaque()

constexpr bool roo_display::Color::isOpaque ( ) const
inlineconstexpr

Return true if the color is fully opaque (alpha = 255).

Definition at line 89 of file color.h.

References a().

Referenced by roo_display::FilledRect::getTransparencyMode(), and roo_display::RawStreamableFilledRect::RawStream::transparency().

◆ r()

◆ set_a()

void roo_display::Color::set_a ( uint8_t  a)
inline

Set alpha channel.

Definition at line 45 of file color.h.

References a().

Referenced by roo_display::internal::RleStreamRgb565Alpha4< Resource >::next().

◆ set_b()

void roo_display::Color::set_b ( uint8_t  g)
inline

Set blue channel.

Definition at line 63 of file color.h.

References g().

◆ set_g()

void roo_display::Color::set_g ( uint8_t  g)
inline

Set green channel.

Definition at line 57 of file color.h.

References g().

◆ set_r()

void roo_display::Color::set_r ( uint8_t  r)
inline

Set red channel.

Definition at line 51 of file color.h.

References r().

◆ toOpaque()

constexpr Color roo_display::Color::toOpaque ( )
inlineconstexpr

Return a fully opaque copy (alpha = 255).

Definition at line 92 of file color.h.

References asArgb(), and Color().

◆ withA()

◆ withB()

constexpr Color roo_display::Color::withB ( uint8_t  b) const
inlineconstexpr

Return a copy with the specified blue channel.

Definition at line 84 of file color.h.

References b(), and Color().

◆ withG()

constexpr Color roo_display::Color::withG ( uint8_t  g) const
inlineconstexpr

Return a copy with the specified green channel.

Definition at line 79 of file color.h.

References Color(), and g().

◆ withR()

constexpr Color roo_display::Color::withR ( uint8_t  r) const
inlineconstexpr

Return a copy with the specified red channel.

Definition at line 74 of file color.h.

References Color(), and r().


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