lv_draw_sw_gradient.h
Typedefs
-
typedef lv_color_t lv_grad_color_t
-
typedef struct _lv_gradient_cache_t lv_grad_t
To avoid recomputing gradient for each draw operation, it's possible to cache the computation in this structure instance. Whenever possible, this structure is reused instead of recomputing the gradient map
Functions
-
lv_grad_color_t lv_gradient_calculate(const lv_grad_dsc_t *dsc, lv_coord_t range, lv_coord_t frac)
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]
-
void lv_gradient_set_cache_size(size_t max_bytes)
Set the gradient cache size
- Parameters:
max_bytes -- Max cahce size
-
void lv_gradient_free_cache(void)
Free the gradient cache
-
lv_grad_t *lv_gradient_get(const lv_grad_dsc_t *gradient, lv_coord_t w, lv_coord_t h)
Get a gradient cache from the given parameters
-
struct _lv_gradient_cache_t
- #include <lv_draw_sw_gradient.h>
To avoid recomputing gradient for each draw operation, it's possible to cache the computation in this structure instance. Whenever possible, this structure is reused instead of recomputing the gradient map
Public Members
-
uint32_t key
A discriminating key that's built from the drawing operation. If the key does not match, the cache item is not used
-
uint32_t life
A life counter that's incremented on usage. Higher counter is less likely to be evicted from the cache
-
uint32_t filled
Used to skip dithering in it if already done
-
uint32_t not_cached
The cache was too small so this item is not managed by the cache
-
lv_color_t *map
The computed gradient low bitdepth color map, points into the cache's buffer, no free needed
-
lv_coord_t alloc_size
The map allocated size in colors
-
lv_coord_t size
The computed gradient color map size, in colors
-
uint32_t key