lv_draw_sw_gradient.h

Defines

LV_GRAD_LEFT
LV_GRAD_RIGHT
LV_GRAD_TOP
LV_GRAD_BOTTOM
LV_GRAD_CENTER

Typedefs

typedef lv_color_t lv_grad_color_t
typedef struct _lv_gradient_cache_t lv_grad_t

Functions

void lv_gradient_color_calculate(const lv_grad_dsc_t *dsc, int32_t range, int32_t frac, lv_grad_color_t *color_out, lv_opa_t *opa_out)

Compute the color in the given gradient and fraction Gradient are specified in a virtual [0-255] range, so this function scales the virtual range to the given range

Parameters:
  • dsc -- The gradient descriptor to use

  • range -- The range to use in computation.

  • frac -- The current part used in the range. frac is in [0; range]

lv_grad_t *lv_gradient_get(const lv_grad_dsc_t *gradient, int32_t w, int32_t h)

Get a gradient cache from the given parameters

void lv_gradient_cleanup(lv_grad_t *grad)

Clean up the gradient item after it was get with lv_grad_get_from_cache.

Parameters:

grad -- pointer to a gradient

void lv_gradient_init_stops(lv_grad_dsc_t *grad, const lv_color_t colors[], const lv_opa_t opa[], const uint8_t fracs[], int num_stops)

Initialize gradient color map from a table

Parameters:
  • grad -- pointer to a gradient descriptor

  • colors -- color array

  • fracs -- position array (0..255): if NULL, then colors are distributed evenly

  • opa -- opacity array: if NULL, then LV_OPA_COVER is assumed

  • num_stops -- number of gradient stops (1..LV_GRADIENT_MAX_STOPS)

struct _lv_gradient_cache_t

Public Members

lv_color_t *color_map
lv_opa_t *opa_map
uint32_t size