lv_color.h

Defines

LV_OPA_MIN
LV_OPA_MAX
_LV_COLOR_HAS_MODERN_CPP
_LV_COLOR_MAKE_TYPE_HELPER
LV_COLOR_SET_R1(c, v)
LV_COLOR_SET_G1(c, v)
LV_COLOR_SET_B1(c, v)
LV_COLOR_SET_A1(c, v)
LV_COLOR_GET_R1(c)
LV_COLOR_GET_G1(c)
LV_COLOR_GET_B1(c)
LV_COLOR_GET_A1(c)
_LV_COLOR_ZERO_INITIALIZER1
LV_COLOR_MAKE1(r8, g8, b8)
LV_COLOR_SET_R8(c, v)
LV_COLOR_SET_G8(c, v)
LV_COLOR_SET_B8(c, v)
LV_COLOR_SET_A8(c, v)
LV_COLOR_GET_R8(c)
LV_COLOR_GET_G8(c)
LV_COLOR_GET_B8(c)
LV_COLOR_GET_A8(c)
_LV_COLOR_ZERO_INITIALIZER8
LV_COLOR_MAKE8(r8, g8, b8)
LV_COLOR_SET_R16(c, v)
LV_COLOR_SET_G16(c, v)
LV_COLOR_SET_B16(c, v)
LV_COLOR_SET_A16(c, v)
LV_COLOR_GET_R16(c)
LV_COLOR_GET_G16(c)
LV_COLOR_GET_B16(c)
LV_COLOR_GET_A16(c)
_LV_COLOR_ZERO_INITIALIZER16
LV_COLOR_MAKE16(r8, g8, b8)
LV_COLOR_SET_R24(c, v)
LV_COLOR_SET_G24(c, v)
LV_COLOR_SET_B24(c, v)
LV_COLOR_SET_A24(c, v)
LV_COLOR_GET_R24(c)
LV_COLOR_GET_G24(c)
LV_COLOR_GET_B24(c)
LV_COLOR_GET_A24(c)
_LV_COLOR_ZERO_INITIALIZER24
LV_COLOR_MAKE24(r8, g8, b8)
LV_COLOR_SET_R32(c, v)
LV_COLOR_SET_G32(c, v)
LV_COLOR_SET_B32(c, v)
LV_COLOR_SET_A32(c, v)
LV_COLOR_GET_R32(c)
LV_COLOR_GET_G32(c)
LV_COLOR_GET_B32(c)
LV_COLOR_GET_A32(c)
_LV_COLOR_ZERO_INITIALIZER32
LV_COLOR_MAKE32(r8, g8, b8)
LV_COLOR_SET_R(c, v)
LV_COLOR_SET_G(c, v)
LV_COLOR_SET_B(c, v)
LV_COLOR_SET_A(c, v)
LV_COLOR_GET_R(c)
LV_COLOR_GET_G(c)
LV_COLOR_GET_B(c)
LV_COLOR_GET_A(c)
_LV_COLOR_ZERO_INITIALIZER
LV_COLOR_MAKE(r8, g8, b8)
LV_COLOR_FORMAT_NATIVE_ALPHA_SIZE
LV_COLOR_FORMAT_NATIVE_ALPHA_OFS

Typedefs

typedef _lv_opa_t lv_opa_t
typedef lv_color16_t lv_color_t
typedef lv_color_t (*lv_color_filter_cb_t)(const struct _lv_color_filter_dsc_t*, lv_color_t, lv_opa_t)
typedef struct _lv_color_filter_dsc_t lv_color_filter_dsc_t

Enums

enum _lv_opa_t

Opacity percentages.

Values:

enumerator LV_OPA_TRANSP
enumerator LV_OPA_0
enumerator LV_OPA_10
enumerator LV_OPA_20
enumerator LV_OPA_30
enumerator LV_OPA_40
enumerator LV_OPA_50
enumerator LV_OPA_60
enumerator LV_OPA_70
enumerator LV_OPA_80
enumerator LV_OPA_90
enumerator LV_OPA_100
enumerator LV_OPA_COVER
enum lv_color_format_t

Values:

enumerator LV_COLOR_FORMAT_UNKNOWN
enumerator LV_COLOR_FORMAT_L8
enumerator LV_COLOR_FORMAT_A8
enumerator LV_COLOR_FORMAT_I1
enumerator LV_COLOR_FORMAT_I2
enumerator LV_COLOR_FORMAT_I4
enumerator LV_COLOR_FORMAT_I8
enumerator LV_COLOR_FORMAT_A8L8
enumerator LV_COLOR_FORMAT_ARGB2222
enumerator LV_COLOR_FORMAT_RGB565
enumerator LV_COLOR_FORMAT_RGB565_CHROMA_KEYED
enumerator LV_COLOR_FORMAT_ARGB1555
enumerator LV_COLOR_FORMAT_ARGB4444
enumerator LV_COLOR_FORMAT_RGB565A8

Color array followed by Alpha array

enumerator LV_COLOR_FORMAT_ARGB8565
enumerator LV_COLOR_FORMAT_RGB888
enumerator LV_COLOR_FORMAT_RGB888_CHROMA_KEYED
enumerator LV_COLOR_FORMAT_ARGB8888
enumerator LV_COLOR_FORMAT_XRGB8888
enumerator LV_COLOR_FORMAT_XRGB8888_CHROMA_KEYED
enumerator LV_COLOR_FORMAT_NATIVE
enumerator LV_COLOR_FORMAT_NATIVE_CHROMA_KEYED
enumerator LV_COLOR_FORMAT_NATIVE_ALPHA
enumerator LV_COLOR_FORMAT_NATIVE_REVERSED
enumerator LV_COLOR_FORMAT_NATIVE_ALPHA_REVERSED
enumerator LV_COLOR_FORMAT_RAW
enumerator LV_COLOR_FORMAT_RAW_ALPHA
enum lv_palette_t

Values:

enumerator LV_PALETTE_RED
enumerator LV_PALETTE_PINK
enumerator LV_PALETTE_PURPLE
enumerator LV_PALETTE_DEEP_PURPLE
enumerator LV_PALETTE_INDIGO
enumerator LV_PALETTE_BLUE
enumerator LV_PALETTE_LIGHT_BLUE
enumerator LV_PALETTE_CYAN
enumerator LV_PALETTE_TEAL
enumerator LV_PALETTE_GREEN
enumerator LV_PALETTE_LIGHT_GREEN
enumerator LV_PALETTE_LIME
enumerator LV_PALETTE_YELLOW
enumerator LV_PALETTE_AMBER
enumerator LV_PALETTE_ORANGE
enumerator LV_PALETTE_DEEP_ORANGE
enumerator LV_PALETTE_BROWN
enumerator LV_PALETTE_BLUE_GREY
enumerator LV_PALETTE_GREY
enumerator _LV_PALETTE_LAST
enumerator LV_PALETTE_NONE

Functions

void lv_color_to_native(const uint8_t *src_buf, lv_color_format_t src_cf, lv_color_t *c_out, lv_opa_t *a_out, lv_color_t alpha_color, uint32_t px_cnt)
void lv_color_from_native(const lv_color_t *src_buf, uint8_t *dest_buf, lv_color_format_t dest_cf, uint32_t px_cnt)
void lv_color_from_native_alpha(const uint8_t *src_buf, uint8_t *dest_buf, lv_color_format_t dest_cf, uint32_t px_cnt)
uint8_t lv_color_format_get_size(lv_color_format_t src_cf)

Get the pixel size of a color format in bits

Parameters:

src_cf -- a color format (LV_IMG_CF_...)

Returns:

the pixel size in bits

bool lv_color_format_has_alpha(lv_color_format_t src_cf)

Check if a color format has alpha channel or not

Parameters:

src_cf -- a color format (LV_IMG_CF_...)

Returns:

true: has alpha channel; false: doesn't have alpha channel

static inline void lv_color8_set_int(lv_color8_t *c, uint8_t v)
static inline void lv_color16_set_int(lv_color16_t *c, uint16_t v)
static inline void lv_color24_set_int(lv_color24_t *c, uint32_t v)
static inline void lv_color32_set_int(lv_color32_t *c, uint32_t v)
static inline void lv_color_set_int(lv_color_t *c, uint32_t v)
static inline uint8_t lv_color8_to_int(lv_color8_t c)
static inline uint16_t lv_color16_to_int(lv_color16_t c)
static inline uint32_t lv_color24_to_int(lv_color24_t c)
static inline uint32_t lv_color32_to_int(lv_color32_t c)
static inline uint32_t lv_color_to_int(lv_color_t c)
static inline lv_color8_t lv_color8_from_buf(const uint8_t *buf)
static inline lv_color16_t lv_color16_from_buf(const uint8_t *buf)
static inline lv_color24_t lv_color24_from_buf(const uint8_t *buf)
static inline lv_color32_t lv_color32_from_buf(const uint8_t *buf)
static inline lv_color_t lv_color_from_buf(const uint8_t *buf)
static inline bool lv_color_eq(lv_color_t c1, lv_color_t c2)
static inline lv_color8_t lv_color_to8(lv_color_t color)
static inline lv_color16_t lv_color_to16(lv_color_t color)
static inline lv_color24_t lv_color_to24(lv_color_t color)
static inline lv_color32_t lv_color_to32(lv_color_t color)
static inline uint8_t lv_color_brightness(lv_color_t color)

Get the brightness of a color

Parameters:

color -- a color

Returns:

the brightness [0..255]

static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b)
static inline lv_color_t lv_color_hex(uint32_t c)
static inline lv_color_t lv_color_hex3(uint32_t c)
static inline void lv_color_filter_dsc_init(lv_color_filter_dsc_t *dsc, lv_color_filter_cb_t cb)
lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl)
lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl)
lv_color_t lv_color_change_lightness(lv_color_t c, lv_opa_t lvl)
lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)

Convert a HSV color to RGB

Parameters:
  • h -- hue [0..359]

  • s -- saturation [0..100]

  • v -- value [0..100]

Returns:

the given RGB color in RGB (with LV_COLOR_DEPTH depth)

lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8)

Convert a 32-bit RGB color to HSV

Parameters:
  • r8 -- 8-bit red

  • g8 -- 8-bit green

  • b8 -- 8-bit blue

Returns:

the given RGB color in HSV

lv_color_hsv_t lv_color_to_hsv(lv_color_t color)

Convert a color to HSV

Parameters:

color -- color

Returns:

the given color in HSV

static inline lv_color_t lv_color_chroma_key(void)

Just a wrapper around LV_COLOR_CHROMA_KEY because it might be more convenient to use a function in some cases

Returns:

LV_COLOR_CHROMA_KEY

lv_color_t lv_palette_main(lv_palette_t p)
static inline lv_color_t lv_color_white(void)
static inline lv_color_t lv_color_black(void)
lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl)
lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl)
union lv_color1_t

Public Members

uint8_t blue
uint8_t green
uint8_t red
union lv_color8_t

Public Members

uint8_t blue
uint8_t green
uint8_t red
uint8_t level
struct lv_color16_t

Public Members

uint16_t blue
uint16_t green
uint16_t red
struct lv_color24_t

Public Members

uint8_t blue
uint8_t green
uint8_t red
struct lv_color32_t

Public Members

uint8_t blue
uint8_t green
uint8_t red
uint8_t alpha
struct lv_color_hsv_t

Public Members

uint16_t h
uint8_t s
uint8_t v
struct _lv_color_filter_dsc_t

Public Members

lv_color_filter_cb_t filter_cb
void *user_data