diff --git a/docs/overview/style-props.md b/docs/overview/style-props.md
index bef42e50f221..ed924ee99a53 100644
--- a/docs/overview/style-props.md
+++ b/docs/overview/style-props.md
@@ -367,7 +367,7 @@ Sets whether the border should be drawn before or after the children are drawn.
Properties to describe the outline. It's like a border but drawn outside of the rectangles.
### outline_width
-Set the width of the outline in pixels.
+Set the width of the outline in pixels.
- Default 0
- Inherited No
@@ -415,7 +415,7 @@ Set the width of the shadow in pixels. The value should be >= 0.
### shadow_ofs_x
-Set an offset on the shadow in pixels in X direction.
+Set an offset on the shadow in pixels in X direction.
- Default 0
- Inherited No
@@ -424,7 +424,7 @@ Set an offset on the shadow in pixels in X direction.
### shadow_ofs_y
-Set an offset on the shadow in pixels in Y direction.
+Set an offset on the shadow in pixels in Y direction.
- Default 0
- Inherited No
@@ -520,7 +520,7 @@ Set the gap between dashes in pixel. Note that dash works only on horizontal and
### line_rounded
-Make the end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending
+Make the end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending
- Default 0
- Inherited No
@@ -559,7 +559,7 @@ Set the width (thickness) of the arcs in pixel.
### arc_rounded
-Make the end points of the arcs rounded. `true`: rounded, `false`: perpendicular line ending
+Make the end points of the arcs rounded. `true`: rounded, `false`: perpendicular line ending
- Default 0
- Inherited No
@@ -616,7 +616,7 @@ Set the opacity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully
### text_font
-Set the font of the text (a pointer `lv_font_t *`).
+Set the font of the text (a pointer `lv_font_t *`).
- Default `LV_FONT_DEFAULT`
- Inherited Yes
diff --git a/scripts/code-format.cfg b/scripts/code-format.cfg
index a92a84962e0f..fbe687e29262 100644
--- a/scripts/code-format.cfg
+++ b/scripts/code-format.cfg
@@ -24,6 +24,8 @@
--formatted
--ignore-exclude-errors
--exclude=assets
+--exclude=../src/core/lv_obj_style_gen.c
+--exclude=../src/core/lv_obj_style_gen.h
--exclude=../src/extra/libs/gif/gifdec.c
--exclude=../src/extra/libs/gif/gifdec.h
--exclude=../src/extra/libs/png/lodepng.c
@@ -33,5 +35,7 @@
--exclude=../src/extra/libs/sjpg/tjpgd.c
--exclude=../src/extra/libs/sjpg/tjpgd.h
--exclude=../src/extra/libs/sjpg/tjpgdcnf.h
+--exclude=../src/misc/lv_style_gen.c
+--exclude=../src/misc/lv_style_gen.h
--exclude=../src/lv_conf_internal.h
--exclude=../tests/src/test_cases/_test_template.c
diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py
index ca904833fe6e..8e1f008d20f4 100755
--- a/scripts/style_api_gen.py
+++ b/scripts/style_api_gen.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
-import sys, os, re
+import os
+import re
+import sys
props = [
{'section': 'Size and position', 'dsc':'Properties related to size, position, alignment and layout of the objects.' },
@@ -91,23 +93,17 @@
{'section': 'Background', 'dsc':'Properties to describe the background color and image of the objects.' },
{'name': 'BG_COLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0xffffff`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0xffffff`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set the background color of the object."},
-{'name': 'BG_COLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t' },
-
{'name': 'BG_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'name': 'BG_GRAD_COLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set the gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`"},
-{'name': 'BG_GRAD_COLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t' },
-
{'name': 'BG_GRAD_DIR',
'style_type': 'num', 'var_type': 'lv_grad_dir_t', 'default':'`LV_GRAD_DIR_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the direction of the gradient of the background. The possible values are `LV_GRAD_DIR_NONE/HOR/VER`."},
@@ -137,12 +133,9 @@
'dsc': "Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'name': 'BG_IMG_RECOLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set a color to mix to the background image."},
-{'name': 'BG_IMG_RECOLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t'},
-
{'name': 'BG_IMG_RECOLOR_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally."},
@@ -153,12 +146,9 @@
{'section': 'Border', 'dsc':'Properties to describe the borders' },
{'name': 'BORDER_COLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set the color of the border"},
-{'name': 'BORDER_COLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t' },
-
{'name': 'BORDER_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
@@ -181,12 +171,9 @@
'dsc': "Set the width of the outline in pixels. "},
{'name': 'OUTLINE_COLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set the color of the outline."},
-{'name': 'OUTLINE_COLOR_FILTERED',
-'style_type': 'color', 'var_type': 'lv_color_t'},
-
{'name': 'OUTLINE_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set the opacity of the outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
@@ -213,12 +200,9 @@
'dsc': "Make the shadow calculation to use a larger or smaller rectangle as base. The value can be in pixel to make the area larger/smaller"},
{'name': 'SHADOW_COLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set the color of the shadow"},
-{'name': 'SHADOW_COLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t'},
-
{'name': 'SHADOW_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
@@ -229,12 +213,9 @@
'dsc': "Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
{'name': 'IMG_RECOLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set color to mixt to the image."},
-{'name': 'IMG_RECOLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t'},
-
{'name': 'IMG_RECOLOR_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
@@ -257,12 +238,9 @@
'dsc': "Make the end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending "},
{'name': 'LINE_COLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t' , 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set the color fo the lines."},
-{'name': 'LINE_COLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t'},
-
{'name': 'LINE_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the lines."},
@@ -277,12 +255,9 @@
'dsc': "Make the end points of the arcs rounded. `true`: rounded, `false`: perpendicular line ending "},
{'name': 'ARC_COLOR',
- 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
+ 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set the color of the arc."},
-{'name': 'ARC_COLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t' },
-
{'name': 'ARC_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the arcs."},
@@ -293,12 +268,9 @@
{'section': 'Text', 'dsc':'Properties to describe the properties of text. All these properties are inherited.' },
{'name': 'TEXT_COLOR',
-'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
+'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 1, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Sets the color of the text."},
-{'name': 'TEXT_COLOR_FILTERED',
- 'style_type': 'color', 'var_type': 'lv_color_t'},
-
{'name': 'TEXT_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
@@ -392,6 +364,15 @@ def obj_style_get(p):
print("}")
print("")
+ if 'filtered' in p and p['filtered']:
+ print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"_filtered(const struct _lv_obj_t * obj, uint32_t part)")
+ print("{")
+ print(" lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_" + p['name'] + "));")
+ print(" return " + cast + "v." + p['style_type'] + ";")
+ print("}")
+ print("")
+
+
def style_set_cast(style_type):
cast = ""
diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c
index 82e1ebba252e..1c981889c512 100644
--- a/src/core/lv_obj_style.c
+++ b/src/core/lv_obj_style.c
@@ -45,7 +45,6 @@ typedef enum {
static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector);
static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, uint32_t part);
static bool get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, lv_style_value_t * v);
-static lv_style_value_t apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v);
static void report_style_change_core(void * style, lv_obj_t * obj);
static void refresh_children_style(lv_obj_t * obj);
static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, trans_t * tr_limit);
@@ -174,7 +173,11 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
lv_part_t part = lv_obj_style_get_selector_part(selector);
- if(prop & LV_STYLE_PROP_LAYOUT_REFR) {
+ bool is_layout_refr = lv_style_prop_has_flag(prop, LV_STYLE_PROP_LAYOUT_REFR);
+ bool is_ext_draw = lv_style_prop_has_flag(prop, LV_STYLE_PROP_EXT_DRAW);
+ bool is_inherit = lv_style_prop_has_flag(prop, LV_STYLE_PROP_INHERIT);
+
+ if(is_layout_refr) {
if(part == LV_PART_ANY ||
part == LV_PART_MAIN ||
lv_obj_get_style_height(obj, 0) == LV_SIZE_CONTENT ||
@@ -183,19 +186,17 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
lv_obj_mark_layout_as_dirty(obj);
}
}
- if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY ||
- (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) {
+ if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || is_layout_refr)) {
lv_obj_t * parent = lv_obj_get_parent(obj);
if(parent) lv_obj_mark_layout_as_dirty(parent);
}
- if(prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_EXT_DRAW)) {
+ if(prop == LV_STYLE_PROP_ANY || is_ext_draw) {
lv_obj_refresh_ext_draw_size(obj);
}
lv_obj_invalidate(obj);
- if(prop == LV_STYLE_PROP_ANY ||
- ((prop & LV_STYLE_PROP_INHERIT) && ((prop & LV_STYLE_PROP_EXT_DRAW) || (prop & LV_STYLE_PROP_LAYOUT_REFR)))) {
+ if(prop == LV_STYLE_PROP_ANY || (is_inherit && (is_ext_draw || is_layout_refr))) {
if(part != LV_PART_SCROLLBAR) {
refresh_children_style(obj);
}
@@ -210,11 +211,7 @@ void lv_obj_enable_style_refresh(bool en)
lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop)
{
lv_style_value_t value_act;
- bool inherit = prop & LV_STYLE_PROP_INHERIT ? true : false;
- bool filter = prop & LV_STYLE_PROP_FILTER ? true : false;
- if(filter) {
- prop &= ~LV_STYLE_PROP_FILTER;
- }
+ bool inherit = lv_style_prop_has_flag(prop, LV_STYLE_PROP_INHERIT);
bool found = false;
while(obj) {
found = get_prop_core(obj, part, prop, &value_act);
@@ -250,7 +247,6 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_
value_act = lv_style_prop_get_default(prop);
}
}
- if(filter) value_act = apply_color_filter(obj, part, value_act);
return value_act;
}
@@ -355,6 +351,18 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t
}
}
+
+lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v)
+{
+ if(obj == NULL) return v;
+ const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part);
+ if(f && f->filter_cb) {
+ lv_opa_t f_opa = lv_obj_get_style_color_filter_opa(obj, part);
+ if(f_opa != 0) v.color = f->filter_cb(f, v.color, f_opa);
+ }
+ return v;
+}
+
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2)
{
_lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME;
@@ -596,17 +604,6 @@ static bool get_prop_core(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t
else return false;
}
-static lv_style_value_t apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v)
-{
- if(obj == NULL) return v;
- const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part);
- if(f && f->filter_cb) {
- lv_opa_t f_opa = lv_obj_get_style_color_filter_opa(obj, part);
- if(f_opa != 0) v.color = f->filter_cb(f, v.color, f_opa);
- }
- return v;
-}
-
/**
* Refresh the style of all children of an object. (Called recursively)
* @param style refresh objects only with this
diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h
index 7fb2723c892c..329ca9159f10 100644
--- a/src/core/lv_obj_style.h
+++ b/src/core/lv_obj_style.h
@@ -152,6 +152,11 @@ lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t pro
*/
bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
+/**
+ * Used internally for color filtering
+ */
+lv_style_value_t _lv_obj_style_apply_color_filter(const struct _lv_obj_t * obj, uint32_t part, lv_style_value_t v);
+
/**
* Used internally to create a style transition
* @param obj
diff --git a/src/core/lv_obj_style_gen.c b/src/core/lv_obj_style_gen.c
index defaba7eb3cd..cc51506d8e8c 100644
--- a/src/core/lv_obj_style_gen.c
+++ b/src/core/lv_obj_style_gen.c
@@ -176,14 +176,6 @@ void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_styl
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_COLOR, v, selector);
}
-void lv_obj_set_style_bg_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_BG_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -200,14 +192,6 @@ void lv_obj_set_style_bg_grad_color(struct _lv_obj_t * obj, lv_color_t value, lv
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD_COLOR, v, selector);
}
-void lv_obj_set_style_bg_grad_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -272,14 +256,6 @@ void lv_obj_set_style_bg_img_recolor(struct _lv_obj_t * obj, lv_color_t value, l
lv_obj_set_local_style_prop(obj, LV_STYLE_BG_IMG_RECOLOR, v, selector);
}
-void lv_obj_set_style_bg_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_BG_IMG_RECOLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_bg_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -304,14 +280,6 @@ void lv_obj_set_style_border_color(struct _lv_obj_t * obj, lv_color_t value, lv_
lv_obj_set_local_style_prop(obj, LV_STYLE_BORDER_COLOR, v, selector);
}
-void lv_obj_set_style_border_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_BORDER_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -360,14 +328,6 @@ void lv_obj_set_style_outline_color(struct _lv_obj_t * obj, lv_color_t value, lv
lv_obj_set_local_style_prop(obj, LV_STYLE_OUTLINE_COLOR, v, selector);
}
-void lv_obj_set_style_outline_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_OUTLINE_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -424,14 +384,6 @@ void lv_obj_set_style_shadow_color(struct _lv_obj_t * obj, lv_color_t value, lv_
lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_COLOR, v, selector);
}
-void lv_obj_set_style_shadow_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -456,14 +408,6 @@ void lv_obj_set_style_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_s
lv_obj_set_local_style_prop(obj, LV_STYLE_IMG_RECOLOR, v, selector);
}
-void lv_obj_set_style_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_IMG_RECOLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -512,14 +456,6 @@ void lv_obj_set_style_line_color(struct _lv_obj_t * obj, lv_color_t value, lv_st
lv_obj_set_local_style_prop(obj, LV_STYLE_LINE_COLOR, v, selector);
}
-void lv_obj_set_style_line_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_LINE_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -552,14 +488,6 @@ void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_sty
lv_obj_set_local_style_prop(obj, LV_STYLE_ARC_COLOR, v, selector);
}
-void lv_obj_set_style_arc_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_ARC_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_arc_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -584,14 +512,6 @@ void lv_obj_set_style_text_color(struct _lv_obj_t * obj, lv_color_t value, lv_st
lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_COLOR, v, selector);
}
-void lv_obj_set_style_text_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_COLOR_FILTERED, v, selector);
-}
-
void lv_obj_set_style_text_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@@ -664,8 +584,7 @@ void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selec
lv_obj_set_local_style_prop(obj, LV_STYLE_OPA, v, selector);
}
-void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
- lv_style_selector_t selector)
+void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value
@@ -705,8 +624,7 @@ void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_styl
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_SPEED, v, selector);
}
-void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
- lv_style_selector_t selector)
+void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value
diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h
index 6ac1f8e41992..4a72a5a76efc 100644
--- a/src/core/lv_obj_style_gen.h
+++ b/src/core/lv_obj_style_gen.h
@@ -132,7 +132,7 @@ static inline lv_color_t lv_obj_get_style_bg_color(const struct _lv_obj_t * obj,
static inline lv_color_t lv_obj_get_style_bg_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR));
return v.color;
}
@@ -150,7 +150,7 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color(const struct _lv_obj_t *
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR));
return v.color;
}
@@ -204,7 +204,7 @@ static inline lv_color_t lv_obj_get_style_bg_img_recolor(const struct _lv_obj_t
static inline lv_color_t lv_obj_get_style_bg_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR));
return v.color;
}
@@ -228,7 +228,7 @@ static inline lv_color_t lv_obj_get_style_border_color(const struct _lv_obj_t *
static inline lv_color_t lv_obj_get_style_border_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR));
return v.color;
}
@@ -270,7 +270,7 @@ static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t *
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR));
return v.color;
}
@@ -318,7 +318,7 @@ static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t *
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR));
return v.color;
}
@@ -342,7 +342,7 @@ static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * o
static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR));
return v.color;
}
@@ -384,7 +384,7 @@ static inline lv_color_t lv_obj_get_style_line_color(const struct _lv_obj_t * ob
static inline lv_color_t lv_obj_get_style_line_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR));
return v.color;
}
@@ -414,7 +414,7 @@ static inline lv_color_t lv_obj_get_style_arc_color(const struct _lv_obj_t * obj
static inline lv_color_t lv_obj_get_style_arc_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR));
return v.color;
}
@@ -438,7 +438,7 @@ static inline lv_color_t lv_obj_get_style_text_color(const struct _lv_obj_t * ob
static inline lv_color_t lv_obj_get_style_text_color_filtered(const struct _lv_obj_t * obj, uint32_t part)
{
- lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR_FILTERED);
+ lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR));
return v.color;
}
@@ -496,8 +496,7 @@ static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32
return (lv_opa_t)v.num;
}
-static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj,
- uint32_t part)
+static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC);
return (const lv_color_filter_dsc_t *)v.ptr;
@@ -573,10 +572,8 @@ void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_sty
void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_bg_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_grad_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_bg_grad_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
@@ -585,18 +582,15 @@ void lv_obj_set_style_bg_dither_mode(struct _lv_obj_t * obj, lv_dither_mode_t va
void lv_obj_set_style_bg_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector);
void lv_obj_set_style_bg_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_bg_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_bg_img_tiled(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
void lv_obj_set_style_border_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_border_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_border_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_border_side(struct _lv_obj_t * obj, lv_border_side_t value, lv_style_selector_t selector);
void lv_obj_set_style_border_post(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_outline_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_outline_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
@@ -604,27 +598,22 @@ void lv_obj_set_style_shadow_ofs_x(struct _lv_obj_t * obj, lv_coord_t value, lv_
void lv_obj_set_style_shadow_ofs_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_shadow_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_shadow_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_img_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_img_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_img_recolor_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_img_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_line_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
void lv_obj_set_style_line_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_line_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_arc_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_arc_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_arc_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_arc_img_src(struct _lv_obj_t * obj, const void * value, lv_style_selector_t selector);
void lv_obj_set_style_text_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
-void lv_obj_set_style_text_color_filtered(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
void lv_obj_set_style_text_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector);
void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
@@ -634,14 +623,12 @@ void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value,
void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
-void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
- lv_style_selector_t selector);
+void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector);
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector);
void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
-void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
- lv_style_selector_t selector);
+void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector);
void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector);
void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_t value, lv_style_selector_t selector);
void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector);
diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c
index 11803427388a..cccea62918a2 100644
--- a/src/extra/layouts/flex/lv_flex.c
+++ b/src/extra/layouts/flex/lv_flex.c
@@ -93,10 +93,10 @@ void lv_flex_init(void)
{
LV_LAYOUT_FLEX = lv_layout_register(flex_update, NULL);
- LV_STYLE_FLEX_FLOW = lv_style_register_prop();
- LV_STYLE_FLEX_MAIN_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_FLEX_CROSS_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_FLEX_TRACK_PLACE = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
+ LV_STYLE_FLEX_FLOW = lv_style_register_prop(LV_STYLE_PROP_FLAG_NONE);
+ LV_STYLE_FLEX_MAIN_PLACE = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_FLEX_CROSS_PLACE = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_FLEX_TRACK_PLACE = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
}
void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow)
diff --git a/src/extra/layouts/grid/lv_grid.c b/src/extra/layouts/grid/lv_grid.c
index 6812a04a2d6e..9ba1836f67e7 100644
--- a/src/extra/layouts/grid/lv_grid.c
+++ b/src/extra/layouts/grid/lv_grid.c
@@ -131,17 +131,17 @@ void lv_grid_init(void)
{
LV_LAYOUT_GRID = lv_layout_register(grid_update, NULL);
- LV_STYLE_GRID_COLUMN_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_ROW_DSC_ARRAY = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_COLUMN_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_ROW_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
-
- LV_STYLE_GRID_CELL_ROW_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_CELL_ROW_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_CELL_COLUMN_SPAN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_CELL_COLUMN_POS = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_CELL_X_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
- LV_STYLE_GRID_CELL_Y_ALIGN = lv_style_register_prop() | LV_STYLE_PROP_LAYOUT_REFR;
+ LV_STYLE_GRID_COLUMN_DSC_ARRAY = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_ROW_DSC_ARRAY = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_COLUMN_ALIGN = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_ROW_ALIGN = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+
+ LV_STYLE_GRID_CELL_ROW_SPAN = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_CELL_ROW_POS = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_CELL_COLUMN_SPAN = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_CELL_COLUMN_POS = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_CELL_X_ALIGN = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
+ LV_STYLE_GRID_CELL_Y_ALIGN = lv_style_register_prop(LV_STYLE_PROP_LAYOUT_REFR);
}
void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[])
diff --git a/src/misc/lv_gc.h b/src/misc/lv_gc.h
index 7551252a542b..9d7d1bb92da7 100644
--- a/src/misc/lv_gc.h
+++ b/src/misc/lv_gc.h
@@ -59,7 +59,8 @@ extern "C" {
LV_DISPATCH(f, void * , _lv_theme_default_styles) \
LV_DISPATCH(f, void * , _lv_theme_basic_styles) \
LV_DISPATCH_COND(f, uint8_t *, _lv_font_decompr_buf, LV_USE_FONT_COMPRESSED, 1) \
- LV_DISPATCH(f, uint8_t * , _lv_grad_cache_mem)
+ LV_DISPATCH(f, uint8_t * , _lv_grad_cache_mem) \
+ LV_DISPATCH(f, uint8_t * , _lv_style_custom_prop_flag_lookup_table)
#define LV_DEFINE_ROOT(root_type, root_name) root_type root_name;
#define LV_ROOTS LV_ITERATE_ROOTS(LV_DEFINE_ROOT)
diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c
index 8b065a8e6d25..2b9a1527a240 100644
--- a/src/misc/lv_style.c
+++ b/src/misc/lv_style.c
@@ -7,6 +7,7 @@
* INCLUDES
*********************/
#include "lv_style.h"
+#include "../misc/lv_gc.h"
#include "../misc/lv_mem.h"
/*********************
@@ -25,10 +26,109 @@
* GLOBAL VARIABLES
**********************/
+const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PROPS] = {
+ [LV_STYLE_WIDTH] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_MIN_WIDTH] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_MAX_WIDTH] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_HEIGHT] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_MIN_HEIGHT] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_MAX_HEIGHT] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_X] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_Y] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_ALIGN] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_TRANSFORM_WIDTH] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_TRANSFORM_HEIGHT] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_TRANSLATE_X] = LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
+ [LV_STYLE_TRANSLATE_Y] = LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
+ [LV_STYLE_TRANSFORM_ZOOM] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
+ [LV_STYLE_TRANSFORM_ANGLE] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
+
+ [LV_STYLE_PAD_TOP] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_PAD_BOTTOM] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_PAD_LEFT] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_PAD_RIGHT] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_PAD_ROW] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_PAD_COLUMN] = LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
+
+ [LV_STYLE_BG_COLOR] = 0,
+ [LV_STYLE_BG_OPA] = 0,
+ [LV_STYLE_BG_GRAD_COLOR] = 0,
+ [LV_STYLE_BG_GRAD_DIR] = 0,
+ [LV_STYLE_BG_MAIN_STOP] = 0,
+ [LV_STYLE_BG_GRAD_STOP] = 0,
+ [LV_STYLE_BG_GRAD] = 0,
+ [LV_STYLE_BG_DITHER_MODE] = 0,
+
+ [LV_STYLE_BG_IMG_SRC] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_BG_IMG_OPA] = 0,
+ [LV_STYLE_BG_IMG_RECOLOR] = 0,
+ [LV_STYLE_BG_IMG_RECOLOR_OPA] = 0,
+ [LV_STYLE_BG_IMG_TILED] = 0,
+
+ [LV_STYLE_BORDER_COLOR] = 0,
+ [LV_STYLE_BORDER_OPA] = 0,
+ [LV_STYLE_BORDER_WIDTH] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_BORDER_SIDE] = 0,
+ [LV_STYLE_BORDER_POST] = 0,
+
+ [LV_STYLE_OUTLINE_WIDTH] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_OUTLINE_COLOR] = 0,
+ [LV_STYLE_OUTLINE_OPA] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_OUTLINE_PAD] = LV_STYLE_PROP_EXT_DRAW,
+
+ [LV_STYLE_SHADOW_WIDTH] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_SHADOW_OFS_X] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_SHADOW_OFS_Y] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_SHADOW_SPREAD] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_SHADOW_COLOR] = 0,
+ [LV_STYLE_SHADOW_OPA] = LV_STYLE_PROP_EXT_DRAW,
+
+ [LV_STYLE_IMG_OPA] = 0,
+ [LV_STYLE_IMG_RECOLOR] = 0,
+ [LV_STYLE_IMG_RECOLOR_OPA] = 0,
+
+ [LV_STYLE_LINE_WIDTH] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_LINE_DASH_WIDTH] = 0,
+ [LV_STYLE_LINE_DASH_GAP] = 0,
+ [LV_STYLE_LINE_ROUNDED] = 0,
+ [LV_STYLE_LINE_COLOR] = 0,
+ [LV_STYLE_LINE_OPA] = 0,
+
+ [LV_STYLE_ARC_WIDTH] = LV_STYLE_PROP_EXT_DRAW,
+ [LV_STYLE_ARC_ROUNDED] = 0,
+ [LV_STYLE_ARC_COLOR] = 0,
+ [LV_STYLE_ARC_OPA] = 0,
+ [LV_STYLE_ARC_IMG_SRC] = 0,
+
+ [LV_STYLE_TEXT_COLOR] = LV_STYLE_PROP_INHERIT,
+ [LV_STYLE_TEXT_OPA] = LV_STYLE_PROP_INHERIT,
+ [LV_STYLE_TEXT_FONT] = LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_TEXT_LETTER_SPACE] = LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_TEXT_LINE_SPACE] = LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_TEXT_DECOR] = LV_STYLE_PROP_INHERIT,
+ [LV_STYLE_TEXT_ALIGN] = LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
+
+ [LV_STYLE_RADIUS] = 0,
+ [LV_STYLE_CLIP_CORNER] = 0,
+ [LV_STYLE_OPA] = LV_STYLE_PROP_INHERIT,
+ [LV_STYLE_COLOR_FILTER_DSC] = 0,
+ [LV_STYLE_COLOR_FILTER_OPA] = 0,
+ [LV_STYLE_ANIM_TIME] = 0,
+ [LV_STYLE_ANIM_SPEED] = 0,
+ [LV_STYLE_TRANSITION] = 0,
+ [LV_STYLE_BLEND_MODE] = 0,
+ [LV_STYLE_LAYOUT] = LV_STYLE_PROP_LAYOUT_REFR,
+ [LV_STYLE_BASE_DIR] = LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
+};
+
+uint32_t _lv_style_custom_prop_flag_lookup_table_size = 0;
+
/**********************
* STATIC VARIABLES
**********************/
+static uint16_t last_custom_prop_id = (uint16_t)_LV_STYLE_LAST_BUILT_IN_PROP;
+
/**********************
* MACROS
**********************/
@@ -67,11 +167,34 @@ void lv_style_reset(lv_style_t * style)
#endif
}
-lv_style_prop_t lv_style_register_prop(void)
+lv_style_prop_t lv_style_register_prop(uint8_t flag)
+{
+ /*
+ * Allocate the lookup table if it's not yet available.
+ */
+ uint8_t required_size = (last_custom_prop_id + 1 - _LV_STYLE_LAST_BUILT_IN_PROP);
+ if(_lv_style_custom_prop_flag_lookup_table_size < required_size) {
+ /* Round required_size up to the nearest 32-byte value */
+ required_size = (required_size + 31) & ~31;
+ uint8_t * old_p = LV_GC_ROOT(_lv_style_custom_prop_flag_lookup_table);
+ uint8_t * new_p = lv_mem_realloc(old_p, required_size * sizeof(uint8_t));
+ if(new_p == NULL) {
+ LV_LOG_ERROR("Unable to allocate space for custom property lookup table");
+ return LV_STYLE_PROP_INV;
+ }
+ LV_GC_ROOT(_lv_style_custom_prop_flag_lookup_table) = new_p;
+ _lv_style_custom_prop_flag_lookup_table_size = required_size;
+ }
+ last_custom_prop_id++;
+ /* This should never happen - we should bail out above */
+ LV_ASSERT_NULL(LV_GC_ROOT(_lv_style_custom_prop_flag_lookup_table));
+ LV_GC_ROOT(_lv_style_custom_prop_flag_lookup_table)[last_custom_prop_id - _LV_STYLE_NUM_BUILT_IN_PROPS] = flag;
+ return last_custom_prop_id;
+}
+
+lv_style_prop_t lv_style_get_num_custom_props(void)
{
- static uint16_t act_id = (uint16_t)_LV_STYLE_LAST_BUILT_IN_PROP;
- act_id++;
- return act_id;
+ return last_custom_prop_id - _LV_STYLE_LAST_BUILT_IN_PROP;
}
bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop)
@@ -295,6 +418,20 @@ uint8_t _lv_style_get_prop_group(lv_style_prop_t prop)
return (uint8_t)group;
}
+uint8_t _lv_style_prop_lookup_flags(lv_style_prop_t prop)
+{
+ extern const uint8_t _lv_style_builtin_prop_flag_lookup_table[];
+ extern uint32_t _lv_style_custom_prop_flag_lookup_table_size;
+ if(prop == LV_STYLE_PROP_ANY || prop == LV_STYLE_PROP_INV)
+ return 0;
+ if(prop < _LV_STYLE_NUM_BUILT_IN_PROPS)
+ return _lv_style_builtin_prop_flag_lookup_table[prop];
+ prop -= _LV_STYLE_NUM_BUILT_IN_PROPS;
+ if(LV_GC_ROOT(_lv_style_custom_prop_flag_lookup_table) != NULL && prop < _lv_style_custom_prop_flag_lookup_table_size)
+ return LV_GC_ROOT(_lv_style_custom_prop_flag_lookup_table)[prop];
+ return 0;
+}
+
/**********************
* STATIC FUNCTIONS
**********************/
diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h
index c639cd6d9f91..848a697c6d0d 100644
--- a/src/misc/lv_style.h
+++ b/src/misc/lv_style.h
@@ -31,13 +31,15 @@ extern "C" {
#define LV_STYLE_SENTINEL_VALUE 0xAABBCCDD
/**
- * Flags for style properties
+ * Flags for style behavior
+ *
+ * The rest of the flags will have _FLAG added to their name in v9.
*/
-#define LV_STYLE_PROP_INHERIT (1 << 10) /*Inherited*/
-#define LV_STYLE_PROP_EXT_DRAW (1 << 11) /*Requires ext. draw size update when changed*/
-#define LV_STYLE_PROP_LAYOUT_REFR (1 << 12) /*Requires layout update when changed*/
-#define LV_STYLE_PROP_PARENT_LAYOUT_REFR (1 << 13) /*Requires layout update on parent when changed*/
-#define LV_STYLE_PROP_FILTER (1 << 14) /*Apply color filter*/
+#define LV_STYLE_PROP_FLAG_NONE (0)
+#define LV_STYLE_PROP_INHERIT (1 << 0) /*Inherited*/
+#define LV_STYLE_PROP_EXT_DRAW (1 << 1) /*Requires ext. draw size update when changed*/
+#define LV_STYLE_PROP_LAYOUT_REFR (1 << 2) /*Requires layout update when changed*/
+#define LV_STYLE_PROP_PARENT_LAYOUT_REFR (1 << 3) /*Requires layout update on parent when changed*/
/**
* Other constants
@@ -153,123 +155,110 @@ typedef union {
/**
* Enumeration of all built in style properties
+ *
+ * Props are split into groups of 16. When adding a new prop to a group, ensure it does not overflow into the next one.
*/
typedef enum {
- LV_STYLE_PROP_INV = 0,
+ LV_STYLE_PROP_INV,
/*Group 0*/
- LV_STYLE_WIDTH = 1 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_MIN_WIDTH = 2 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_MAX_WIDTH = 3 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_HEIGHT = 4 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_MIN_HEIGHT = 5 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_MAX_HEIGHT = 6 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_X = 7 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_Y = 8 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_ALIGN = 9 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_TRANSFORM_WIDTH = 10 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_TRANSFORM_HEIGHT = 11 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_TRANSLATE_X = 12 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
- LV_STYLE_TRANSLATE_Y = 13 | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
- LV_STYLE_TRANSFORM_ZOOM = 14 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
- LV_STYLE_TRANSFORM_ANGLE = 15 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR | LV_STYLE_PROP_PARENT_LAYOUT_REFR,
+ LV_STYLE_WIDTH = 1,
+ LV_STYLE_MIN_WIDTH = 2,
+ LV_STYLE_MAX_WIDTH = 3,
+ LV_STYLE_HEIGHT = 4,
+ LV_STYLE_MIN_HEIGHT = 5,
+ LV_STYLE_MAX_HEIGHT = 6,
+ LV_STYLE_X = 7,
+ LV_STYLE_Y = 8,
+ LV_STYLE_ALIGN = 9,
+ LV_STYLE_TRANSFORM_WIDTH = 10,
+ LV_STYLE_TRANSFORM_HEIGHT = 11,
+ LV_STYLE_TRANSLATE_X = 12,
+ LV_STYLE_TRANSLATE_Y = 13,
+ LV_STYLE_TRANSFORM_ZOOM = 14,
+ LV_STYLE_TRANSFORM_ANGLE = 15,
/*Group 1*/
- LV_STYLE_PAD_TOP = 16 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_PAD_BOTTOM = 17 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_PAD_LEFT = 18 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_PAD_RIGHT = 19 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_PAD_ROW = 20 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_PAD_COLUMN = 21 | LV_STYLE_PROP_EXT_DRAW | LV_STYLE_PROP_LAYOUT_REFR,
+ LV_STYLE_PAD_TOP = 16,
+ LV_STYLE_PAD_BOTTOM = 17,
+ LV_STYLE_PAD_LEFT = 18,
+ LV_STYLE_PAD_RIGHT = 19,
+ LV_STYLE_PAD_ROW = 20,
+ LV_STYLE_PAD_COLUMN = 21,
/*Group 2*/
- LV_STYLE_BG_COLOR = 32,
- LV_STYLE_BG_COLOR_FILTERED = 32 | LV_STYLE_PROP_FILTER,
- LV_STYLE_BG_OPA = 33,
- LV_STYLE_BG_GRAD_COLOR = 34,
- LV_STYLE_BG_GRAD_COLOR_FILTERED = 34 | LV_STYLE_PROP_FILTER,
- LV_STYLE_BG_GRAD_DIR = 35,
- LV_STYLE_BG_MAIN_STOP = 36,
- LV_STYLE_BG_GRAD_STOP = 37,
- LV_STYLE_BG_GRAD = 38,
- LV_STYLE_BG_DITHER_MODE = 39,
-
-
- LV_STYLE_BG_IMG_SRC = 40 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_BG_IMG_OPA = 41,
- LV_STYLE_BG_IMG_RECOLOR = 42,
- LV_STYLE_BG_IMG_RECOLOR_FILTERED = 42 | LV_STYLE_PROP_FILTER,
- LV_STYLE_BG_IMG_RECOLOR_OPA = 43,
- LV_STYLE_BG_IMG_TILED = 44,
+ LV_STYLE_BG_COLOR = 32,
+ LV_STYLE_BG_OPA = 33,
+ LV_STYLE_BG_GRAD_COLOR = 34,
+ LV_STYLE_BG_GRAD_DIR = 35,
+ LV_STYLE_BG_MAIN_STOP = 36,
+ LV_STYLE_BG_GRAD_STOP = 37,
+ LV_STYLE_BG_GRAD = 38,
+ LV_STYLE_BG_DITHER_MODE = 39,
+ LV_STYLE_BG_IMG_SRC = 40,
+ LV_STYLE_BG_IMG_OPA = 41,
+ LV_STYLE_BG_IMG_RECOLOR = 42,
+ LV_STYLE_BG_IMG_RECOLOR_OPA = 43,
+ LV_STYLE_BG_IMG_TILED = 44,
/*Group 3*/
- LV_STYLE_BORDER_COLOR = 48,
- LV_STYLE_BORDER_COLOR_FILTERED = 48 | LV_STYLE_PROP_FILTER,
- LV_STYLE_BORDER_OPA = 49,
- LV_STYLE_BORDER_WIDTH = 50 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_BORDER_SIDE = 51,
- LV_STYLE_BORDER_POST = 52,
-
- LV_STYLE_OUTLINE_WIDTH = 58 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_OUTLINE_COLOR = 59,
- LV_STYLE_OUTLINE_COLOR_FILTERED = 59 | LV_STYLE_PROP_FILTER,
- LV_STYLE_OUTLINE_OPA = 60 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_OUTLINE_PAD = 61 | LV_STYLE_PROP_EXT_DRAW,
+ LV_STYLE_BORDER_COLOR = 48,
+ LV_STYLE_BORDER_OPA = 49,
+ LV_STYLE_BORDER_WIDTH = 50,
+ LV_STYLE_BORDER_SIDE = 51,
+ LV_STYLE_BORDER_POST = 52,
+ LV_STYLE_OUTLINE_WIDTH = 53,
+ LV_STYLE_OUTLINE_COLOR = 54,
+ LV_STYLE_OUTLINE_OPA = 55,
+ LV_STYLE_OUTLINE_PAD = 56,
/*Group 4*/
- LV_STYLE_SHADOW_WIDTH = 64 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_SHADOW_OFS_X = 65 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_SHADOW_OFS_Y = 66 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_SHADOW_SPREAD = 67 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_SHADOW_COLOR = 68,
- LV_STYLE_SHADOW_COLOR_FILTERED = 68 | LV_STYLE_PROP_FILTER,
- LV_STYLE_SHADOW_OPA = 69 | LV_STYLE_PROP_EXT_DRAW,
-
- LV_STYLE_IMG_OPA = 70,
- LV_STYLE_IMG_RECOLOR = 71,
- LV_STYLE_IMG_RECOLOR_FILTERED = 71 | LV_STYLE_PROP_FILTER,
- LV_STYLE_IMG_RECOLOR_OPA = 72,
-
- LV_STYLE_LINE_WIDTH = 73 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_LINE_DASH_WIDTH = 74,
- LV_STYLE_LINE_DASH_GAP = 75,
- LV_STYLE_LINE_ROUNDED = 76,
- LV_STYLE_LINE_COLOR = 77,
- LV_STYLE_LINE_COLOR_FILTERED = 77 | LV_STYLE_PROP_FILTER,
- LV_STYLE_LINE_OPA = 78,
+ LV_STYLE_SHADOW_WIDTH = 64,
+ LV_STYLE_SHADOW_OFS_X = 65,
+ LV_STYLE_SHADOW_OFS_Y = 66,
+ LV_STYLE_SHADOW_SPREAD = 67,
+ LV_STYLE_SHADOW_COLOR = 68,
+ LV_STYLE_SHADOW_OPA = 69,
+ LV_STYLE_IMG_OPA = 70,
+ LV_STYLE_IMG_RECOLOR = 71,
+ LV_STYLE_IMG_RECOLOR_OPA = 72,
+ LV_STYLE_LINE_WIDTH = 73,
+ LV_STYLE_LINE_DASH_WIDTH = 74,
+ LV_STYLE_LINE_DASH_GAP = 75,
+ LV_STYLE_LINE_ROUNDED = 76,
+ LV_STYLE_LINE_COLOR = 77,
+ LV_STYLE_LINE_OPA = 78,
/*Group 5*/
- LV_STYLE_ARC_WIDTH = 80 | LV_STYLE_PROP_EXT_DRAW,
- LV_STYLE_ARC_ROUNDED = 81,
- LV_STYLE_ARC_COLOR = 82,
- LV_STYLE_ARC_COLOR_FILTERED = 82 | LV_STYLE_PROP_FILTER,
- LV_STYLE_ARC_OPA = 83,
- LV_STYLE_ARC_IMG_SRC = 84,
-
- LV_STYLE_TEXT_COLOR = 87 | LV_STYLE_PROP_INHERIT,
- LV_STYLE_TEXT_COLOR_FILTERED = 87 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_FILTER,
- LV_STYLE_TEXT_OPA = 88 | LV_STYLE_PROP_INHERIT,
- LV_STYLE_TEXT_FONT = 89 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_TEXT_LETTER_SPACE = 90 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_TEXT_LINE_SPACE = 91 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_TEXT_DECOR = 92 | LV_STYLE_PROP_INHERIT,
- LV_STYLE_TEXT_ALIGN = 93 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
+ LV_STYLE_ARC_WIDTH = 80,
+ LV_STYLE_ARC_ROUNDED = 81,
+ LV_STYLE_ARC_COLOR = 82,
+ LV_STYLE_ARC_OPA = 83,
+ LV_STYLE_ARC_IMG_SRC = 84,
+ LV_STYLE_TEXT_COLOR = 85,
+ LV_STYLE_TEXT_OPA = 86,
+ LV_STYLE_TEXT_FONT = 87,
+ LV_STYLE_TEXT_LETTER_SPACE = 88,
+ LV_STYLE_TEXT_LINE_SPACE = 89,
+ LV_STYLE_TEXT_DECOR = 90,
+ LV_STYLE_TEXT_ALIGN = 91,
/*Group 6*/
- LV_STYLE_RADIUS = 96,
- LV_STYLE_CLIP_CORNER = 97,
- LV_STYLE_OPA = 98 | LV_STYLE_PROP_INHERIT,
- LV_STYLE_COLOR_FILTER_DSC = 99,
- LV_STYLE_COLOR_FILTER_OPA = 100,
- LV_STYLE_ANIM = 101,
- LV_STYLE_ANIM_TIME = 102,
- LV_STYLE_ANIM_SPEED = 103,
- LV_STYLE_TRANSITION = 104,
- LV_STYLE_BLEND_MODE = 105,
- LV_STYLE_LAYOUT = 106 | LV_STYLE_PROP_LAYOUT_REFR,
- LV_STYLE_BASE_DIR = 107 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
+ LV_STYLE_RADIUS = 96,
+ LV_STYLE_CLIP_CORNER = 97,
+ LV_STYLE_OPA = 98,
+ LV_STYLE_COLOR_FILTER_DSC = 99,
+ LV_STYLE_COLOR_FILTER_OPA = 100,
+ LV_STYLE_ANIM = 101,
+ LV_STYLE_ANIM_TIME = 102,
+ LV_STYLE_ANIM_SPEED = 103,
+ LV_STYLE_TRANSITION = 104,
+ LV_STYLE_BLEND_MODE = 105,
+ LV_STYLE_LAYOUT = 106,
+ LV_STYLE_BASE_DIR = 107,
_LV_STYLE_LAST_BUILT_IN_PROP = 111,
+ _LV_STYLE_NUM_BUILT_IN_PROPS = _LV_STYLE_LAST_BUILT_IN_PROP + 1,
LV_STYLE_PROP_ANY = 0xFFFF
} lv_style_prop_t;
@@ -340,7 +329,7 @@ void lv_style_reset(lv_style_t * style);
/**
* Register a new style property for custom usage
- * @return a new property ID.
+ * @return a new property ID, or LV_STYLE_PROP_INV if there are no more available.
* @example
* lv_style_prop_t MY_PROP;
* static inline void lv_style_set_my_prop(lv_style_t * style, lv_color_t value) {
@@ -351,7 +340,12 @@ void lv_style_reset(lv_style_t * style);
* ...
* lv_style_set_my_prop(&style1, lv_palette_main(LV_PALETTE_RED));
*/
-lv_style_prop_t lv_style_register_prop(void);
+lv_style_prop_t lv_style_register_prop(uint8_t flag);
+
+/**
+ * Get the number of custom properties that have been registered thus far.
+ */
+lv_style_prop_t lv_style_get_num_custom_props(void);
/**
* Remove a property from a style
@@ -466,6 +460,14 @@ bool lv_style_is_empty(const lv_style_t * style);
*/
uint8_t _lv_style_get_prop_group(lv_style_prop_t prop);
+/**
+ * Get the flags of a built-in or custom property.
+ *
+ * @param prop a style property
+ * @return the flags of the property
+ */
+uint8_t _lv_style_prop_lookup_flags(lv_style_prop_t prop);
+
#include "lv_style_gen.h"
static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value)
@@ -500,6 +502,20 @@ static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value)
lv_style_set_pad_column(style, value);
}
+/**
+ * @brief Check if the style property has a specified behavioral flag.
+ *
+ * Do not pass multiple flags to this function as backwards-compatibility is not guaranteed
+ * for that.
+ *
+ * @param prop Property ID
+ * @param flag Flag
+ * @return true if the flag is set for this property
+ */
+static inline bool lv_style_prop_has_flag(lv_style_prop_t prop, uint8_t flag)
+{
+ return _lv_style_prop_lookup_flags(prop) & flag;
+}
/*************************
* GLOBAL VARIABLES
diff --git a/src/misc/lv_style_gen.c b/src/misc/lv_style_gen.c
index 63ca64112e9e..e4dfbf435c67 100644
--- a/src/misc/lv_style_gen.c
+++ b/src/misc/lv_style_gen.c
@@ -176,14 +176,6 @@ void lv_style_set_bg_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_BG_COLOR, v);
}
-void lv_style_set_bg_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_BG_COLOR_FILTERED, v);
-}
-
void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -200,14 +192,6 @@ void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_BG_GRAD_COLOR, v);
}
-void lv_style_set_bg_grad_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_BG_GRAD_COLOR_FILTERED, v);
-}
-
void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value)
{
lv_style_value_t v = {
@@ -272,14 +256,6 @@ void lv_style_set_bg_img_recolor(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_BG_IMG_RECOLOR, v);
}
-void lv_style_set_bg_img_recolor_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_BG_IMG_RECOLOR_FILTERED, v);
-}
-
void lv_style_set_bg_img_recolor_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -304,14 +280,6 @@ void lv_style_set_border_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_BORDER_COLOR, v);
}
-void lv_style_set_border_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_BORDER_COLOR_FILTERED, v);
-}
-
void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -360,14 +328,6 @@ void lv_style_set_outline_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_OUTLINE_COLOR, v);
}
-void lv_style_set_outline_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_OUTLINE_COLOR_FILTERED, v);
-}
-
void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -424,14 +384,6 @@ void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_SHADOW_COLOR, v);
}
-void lv_style_set_shadow_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_SHADOW_COLOR_FILTERED, v);
-}
-
void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -456,14 +408,6 @@ void lv_style_set_img_recolor(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR, v);
}
-void lv_style_set_img_recolor_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_IMG_RECOLOR_FILTERED, v);
-}
-
void lv_style_set_img_recolor_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -512,14 +456,6 @@ void lv_style_set_line_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_LINE_COLOR, v);
}
-void lv_style_set_line_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_LINE_COLOR_FILTERED, v);
-}
-
void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -552,14 +488,6 @@ void lv_style_set_arc_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_ARC_COLOR, v);
}
-void lv_style_set_arc_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_ARC_COLOR_FILTERED, v);
-}
-
void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
@@ -584,14 +512,6 @@ void lv_style_set_text_color(lv_style_t * style, lv_color_t value)
lv_style_set_prop(style, LV_STYLE_TEXT_COLOR, v);
}
-void lv_style_set_text_color_filtered(lv_style_t * style, lv_color_t value)
-{
- lv_style_value_t v = {
- .color = value
- };
- lv_style_set_prop(style, LV_STYLE_TEXT_COLOR_FILTERED, v);
-}
-
void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value)
{
lv_style_value_t v = {
diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h
index 52833fd50dfd..f62206f8352c 100644
--- a/src/misc/lv_style_gen.h
+++ b/src/misc/lv_style_gen.h
@@ -20,10 +20,8 @@ void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value);
void lv_style_set_pad_row(lv_style_t * style, lv_coord_t value);
void lv_style_set_pad_column(lv_style_t * style, lv_coord_t value);
void lv_style_set_bg_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_bg_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_bg_grad_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value);
void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t value);
void lv_style_set_bg_grad_stop(lv_style_t * style, lv_coord_t value);
@@ -32,18 +30,15 @@ void lv_style_set_bg_dither_mode(lv_style_t * style, lv_dither_mode_t value);
void lv_style_set_bg_img_src(lv_style_t * style, const void * value);
void lv_style_set_bg_img_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_bg_img_recolor(lv_style_t * style, lv_color_t value);
-void lv_style_set_bg_img_recolor_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_bg_img_recolor_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_bg_img_tiled(lv_style_t * style, bool value);
void lv_style_set_border_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_border_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_border_width(lv_style_t * style, lv_coord_t value);
void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value);
void lv_style_set_border_post(lv_style_t * style, bool value);
void lv_style_set_outline_width(lv_style_t * style, lv_coord_t value);
void lv_style_set_outline_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_outline_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value);
void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t value);
@@ -51,27 +46,22 @@ void lv_style_set_shadow_ofs_x(lv_style_t * style, lv_coord_t value);
void lv_style_set_shadow_ofs_y(lv_style_t * style, lv_coord_t value);
void lv_style_set_shadow_spread(lv_style_t * style, lv_coord_t value);
void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_shadow_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_img_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_img_recolor(lv_style_t * style, lv_color_t value);
-void lv_style_set_img_recolor_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_img_recolor_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_line_width(lv_style_t * style, lv_coord_t value);
void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t value);
void lv_style_set_line_dash_gap(lv_style_t * style, lv_coord_t value);
void lv_style_set_line_rounded(lv_style_t * style, bool value);
void lv_style_set_line_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_line_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_arc_width(lv_style_t * style, lv_coord_t value);
void lv_style_set_arc_rounded(lv_style_t * style, bool value);
void lv_style_set_arc_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_arc_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_arc_img_src(lv_style_t * style, const void * value);
void lv_style_set_text_color(lv_style_t * style, lv_color_t value);
-void lv_style_set_text_color_filtered(lv_style_t * style, lv_color_t value);
void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value);
void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value);
void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t value);
@@ -201,11 +191,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_BG_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_BG_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_BG_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_BG_OPA(val) \
{ \
.prop = LV_STYLE_BG_OPA, .value = { .num = (int32_t)val } \
@@ -216,11 +201,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_BG_GRAD_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_BG_GRAD_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_BG_GRAD_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_BG_GRAD_DIR(val) \
{ \
.prop = LV_STYLE_BG_GRAD_DIR, .value = { .num = (int32_t)val } \
@@ -261,11 +241,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_BG_IMG_RECOLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_BG_IMG_RECOLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_BG_IMG_RECOLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_BG_IMG_RECOLOR_OPA(val) \
{ \
.prop = LV_STYLE_BG_IMG_RECOLOR_OPA, .value = { .num = (int32_t)val } \
@@ -281,11 +256,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_BORDER_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_BORDER_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_BORDER_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_BORDER_OPA(val) \
{ \
.prop = LV_STYLE_BORDER_OPA, .value = { .num = (int32_t)val } \
@@ -316,11 +286,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_OUTLINE_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_OUTLINE_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_OUTLINE_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_OUTLINE_OPA(val) \
{ \
.prop = LV_STYLE_OUTLINE_OPA, .value = { .num = (int32_t)val } \
@@ -356,11 +321,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_SHADOW_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_SHADOW_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_SHADOW_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_SHADOW_OPA(val) \
{ \
.prop = LV_STYLE_SHADOW_OPA, .value = { .num = (int32_t)val } \
@@ -376,11 +336,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_IMG_RECOLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_IMG_RECOLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_IMG_RECOLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_IMG_RECOLOR_OPA(val) \
{ \
.prop = LV_STYLE_IMG_RECOLOR_OPA, .value = { .num = (int32_t)val } \
@@ -411,11 +366,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_LINE_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_LINE_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_LINE_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_LINE_OPA(val) \
{ \
.prop = LV_STYLE_LINE_OPA, .value = { .num = (int32_t)val } \
@@ -436,11 +386,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_ARC_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_ARC_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_ARC_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_ARC_OPA(val) \
{ \
.prop = LV_STYLE_ARC_OPA, .value = { .num = (int32_t)val } \
@@ -456,11 +401,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
.prop = LV_STYLE_TEXT_COLOR, .value = { .color = val } \
}
-#define LV_STYLE_CONST_TEXT_COLOR_FILTERED(val) \
- { \
- .prop = LV_STYLE_TEXT_COLOR_FILTERED, .value = { .color = val } \
- }
-
#define LV_STYLE_CONST_TEXT_OPA(val) \
{ \
.prop = LV_STYLE_TEXT_OPA, .value = { .num = (int32_t)val } \
diff --git a/tests/src/test_cases/test_style.c b/tests/src/test_cases/test_style.c
index 4ad5ad2be62e..c9ece0d86e83 100644
--- a/tests/src/test_cases/test_style.c
+++ b/tests/src/test_cases/test_style.c
@@ -40,4 +40,34 @@ void test_gradient_vertical_misalignment(void)
}
}
+void test_custom_prop_ids(void)
+{
+ uint8_t fake_flag = 0;
+ uint32_t initial_custom_props = lv_style_get_num_custom_props();
+ uint32_t max_props_to_register = 64;
+ for(uint32_t i = 0; i < max_props_to_register; i++) {
+ lv_style_prop_t prop = lv_style_register_prop(fake_flag);
+ /* Should have a higher index than the last built-in prop */
+ TEST_ASSERT_GREATER_THAN(_LV_STYLE_LAST_BUILT_IN_PROP, prop);
+ if(i == 0) {
+ /* Should be equal to the first expected index of a custom prop */
+ TEST_ASSERT_EQUAL(_LV_STYLE_NUM_BUILT_IN_PROPS + initial_custom_props, prop);
+ }
+ /*We should find our flags*/
+ TEST_ASSERT_EQUAL(fake_flag, _lv_style_prop_lookup_flags(prop));
+ if(fake_flag == 0xff)
+ fake_flag = 0;
+ else
+ fake_flag++;
+ }
+ TEST_ASSERT_EQUAL(initial_custom_props + max_props_to_register, lv_style_get_num_custom_props());
+ /*
+ * Check that the resizing algorithm works correctly, given that 64 props
+ * were registered + whatever's built-in. A failure here may just indicate
+ * that LVGL registers more built-in properties now and this needs adjustment.
+ */
+ extern uint32_t _lv_style_custom_prop_flag_lookup_table_size;
+ TEST_ASSERT_EQUAL(_lv_style_custom_prop_flag_lookup_table_size, 96);
+}
+
#endif