feat(draw): add gradient dithering support (#2872)

* Add dithering to gradients

* Add support for 8x8 matrix for ordered dithering

* Fix CI errors

* Try error diffusion on vertical gradient too

* Vertical error diffusion dithering

* Add support for runtime based dithering mode selection (from none, ordered, error diffusion).

* Reduce the binary size of the code by sharing the dithering table when appropriate.

* Fix CI

* Fix CI

* Review corrections

* Fix union mapping

* Revert bg_color changes

* Fix for keeping bg_color in the API.

* Fix after review

* Add support for setting multiple stops per gradient in the style API

* Let's make an example

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
X-Ryl669
2022-01-11 12:38:30 +01:00
committed by GitHub
parent 89389d3c96
commit 6617385f8a
25 changed files with 980 additions and 82 deletions

View File

@@ -232,6 +232,22 @@ void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD_STOP, v, selector);
}
void lv_obj_set_style_bg_gradient(struct _lv_obj_t * obj, const lv_gradient_t * value, lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value
};
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRADIENT, v, selector);
}
void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
.num = (int32_t)value
};
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_DITHER_MODE, v, selector);
}
void lv_obj_set_style_bg_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector)
{
lv_style_value_t v = {