Pigweed
 
Loading...
Searching...
No Matches
Pw_display_color

Functions

constexpr ColorRgb565 pw::display::EncodeRgb565 (uint8_t r, uint8_t g, uint8_t b)
 
constexpr ColorRgb565 pw::display::EncodeRgb565 (ColorRgba8888 rgba8888)
 Encode an RGBA8888 value into RGB565.
 
constexpr ColorRgba8888 pw::display::EncodeRgba8888 (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 
constexpr ColorRgba8888 pw::display::EncodeRgba8888 (ColorRgb565 rgb565)
 

Detailed Description

Color conversion functions used by the pw_display draw library and tests.

Function Documentation

◆ EncodeRgb565()

constexpr ColorRgb565 pw::display::EncodeRgb565 ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)
constexpr

Encode an RGB565 value from individual red, green, blue and alpha values.

This will introduce some loss in color as values are mapped from 8 bits per color down to 5 for red, 6 for green, and 5 for blue.

◆ EncodeRgba8888() [1/2]

constexpr ColorRgba8888 pw::display::EncodeRgba8888 ( ColorRgb565  rgb565)
constexpr

Encode an RGBA8888 value from RGB565.

This will scale each color up to 8 bits per pixel. Red and blue are scaled from 5 bits to 8 bits. Green from 6 bits to 8 bits. There is no alpha channel in the RGB565 format so alpha is set to 255 representing 100% opaque.

◆ EncodeRgba8888() [2/2]

constexpr ColorRgba8888 pw::display::EncodeRgba8888 ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a 
)
constexpr

Encode an RGBA8888 value from individual red, green, blue and alpha values.