31#define LV_STYLE_SENTINEL_VALUE 0xAABBCCDD
38#define LV_STYLE_PROP_FLAG_NONE (0)
39#define LV_STYLE_PROP_INHERIT (1 << 0)
40#define LV_STYLE_PROP_EXT_DRAW (1 << 1)
41#define LV_STYLE_PROP_LAYOUT_REFR (1 << 2)
42#define LV_STYLE_PROP_PARENT_LAYOUT_REFR (1 << 3)
43#define LV_STYLE_PROP_LAYER_REFR (1 << 4)
44#define LV_STYLE_PROP_ALL (0x1F)
49#define LV_IMG_ZOOM_NONE 256
53#if LV_USE_ASSERT_STYLE
54#define LV_STYLE_CONST_INIT(var_name, prop_array) \
55 const lv_style_t var_name = { \
56 .sentinel = LV_STYLE_SENTINEL_VALUE, \
57 .v_p = { .const_props = prop_array }, \
59 .prop1 = LV_STYLE_PROP_ANY, \
60 .prop_cnt = (sizeof(prop_array) / sizeof((prop_array)[0])), \
63#define LV_STYLE_CONST_INIT(var_name, prop_array) \
64 const lv_style_t var_name = { \
65 .v_p = { .const_props = prop_array }, \
67 .prop1 = LV_STYLE_PROP_ANY, \
68 .prop_cnt = (sizeof(prop_array) / sizeof((prop_array)[0])), \
73#define LV_STYLE_PROP_META_INHERIT 0x8000
74#define LV_STYLE_PROP_META_INITIAL 0x4000
75#define LV_STYLE_PROP_META_MASK (LV_STYLE_PROP_META_INHERIT | LV_STYLE_PROP_META_INITIAL)
77#define LV_STYLE_PROP_ID_MASK(prop) ((lv_style_prop_t)((prop) & ~LV_STYLE_PROP_META_MASK))
94typedef uint8_t lv_blend_mode_t;
101 LV_TEXT_DECOR_NONE = 0x00,
102 LV_TEXT_DECOR_UNDERLINE = 0x01,
103 LV_TEXT_DECOR_STRIKETHROUGH = 0x02,
106typedef uint8_t lv_text_decor_t;
113 LV_BORDER_SIDE_NONE = 0x00,
114 LV_BORDER_SIDE_BOTTOM = 0x01,
115 LV_BORDER_SIDE_TOP = 0x02,
116 LV_BORDER_SIDE_LEFT = 0x04,
117 LV_BORDER_SIDE_RIGHT = 0x08,
118 LV_BORDER_SIDE_FULL = 0x0F,
121typedef uint8_t lv_border_side_t;
132typedef uint8_t lv_grad_dir_t;
144typedef uint8_t lv_dither_mode_t;
179 LV_STYLE_PROP_INV = 0,
183 LV_STYLE_MIN_WIDTH = 2,
184 LV_STYLE_MAX_WIDTH = 3,
186 LV_STYLE_MIN_HEIGHT = 5,
187 LV_STYLE_MAX_HEIGHT = 6,
191 LV_STYLE_LAYOUT = 10,
192 LV_STYLE_RADIUS = 11,
195 LV_STYLE_PAD_TOP = 16,
196 LV_STYLE_PAD_BOTTOM = 17,
197 LV_STYLE_PAD_LEFT = 18,
198 LV_STYLE_PAD_RIGHT = 19,
199 LV_STYLE_PAD_ROW = 20,
200 LV_STYLE_PAD_COLUMN = 21,
201 LV_STYLE_BASE_DIR = 22,
202 LV_STYLE_CLIP_CORNER = 23,
205 LV_STYLE_BG_COLOR = 32,
206 LV_STYLE_BG_OPA = 33,
207 LV_STYLE_BG_GRAD_COLOR = 34,
208 LV_STYLE_BG_GRAD_DIR = 35,
209 LV_STYLE_BG_MAIN_STOP = 36,
210 LV_STYLE_BG_GRAD_STOP = 37,
211 LV_STYLE_BG_GRAD = 38,
212 LV_STYLE_BG_DITHER_MODE = 39,
213 LV_STYLE_BG_IMG_SRC = 40,
214 LV_STYLE_BG_IMG_OPA = 41,
215 LV_STYLE_BG_IMG_RECOLOR = 42,
216 LV_STYLE_BG_IMG_RECOLOR_OPA = 43,
217 LV_STYLE_BG_IMG_TILED = 44,
220 LV_STYLE_BORDER_COLOR = 48,
221 LV_STYLE_BORDER_OPA = 49,
222 LV_STYLE_BORDER_WIDTH = 50,
223 LV_STYLE_BORDER_SIDE = 51,
224 LV_STYLE_BORDER_POST = 52,
225 LV_STYLE_OUTLINE_WIDTH = 53,
226 LV_STYLE_OUTLINE_COLOR = 54,
227 LV_STYLE_OUTLINE_OPA = 55,
228 LV_STYLE_OUTLINE_PAD = 56,
231 LV_STYLE_SHADOW_WIDTH = 64,
232 LV_STYLE_SHADOW_OFS_X = 65,
233 LV_STYLE_SHADOW_OFS_Y = 66,
234 LV_STYLE_SHADOW_SPREAD = 67,
235 LV_STYLE_SHADOW_COLOR = 68,
236 LV_STYLE_SHADOW_OPA = 69,
237 LV_STYLE_IMG_OPA = 70,
238 LV_STYLE_IMG_RECOLOR = 71,
239 LV_STYLE_IMG_RECOLOR_OPA = 72,
240 LV_STYLE_LINE_WIDTH = 73,
241 LV_STYLE_LINE_DASH_WIDTH = 74,
242 LV_STYLE_LINE_DASH_GAP = 75,
243 LV_STYLE_LINE_ROUNDED = 76,
244 LV_STYLE_LINE_COLOR = 77,
245 LV_STYLE_LINE_OPA = 78,
248 LV_STYLE_ARC_WIDTH = 80,
249 LV_STYLE_ARC_ROUNDED = 81,
250 LV_STYLE_ARC_COLOR = 82,
251 LV_STYLE_ARC_OPA = 83,
252 LV_STYLE_ARC_IMG_SRC = 84,
253 LV_STYLE_TEXT_COLOR = 85,
254 LV_STYLE_TEXT_OPA = 86,
255 LV_STYLE_TEXT_FONT = 87,
256 LV_STYLE_TEXT_LETTER_SPACE = 88,
257 LV_STYLE_TEXT_LINE_SPACE = 89,
258 LV_STYLE_TEXT_DECOR = 90,
259 LV_STYLE_TEXT_ALIGN = 91,
263 LV_STYLE_COLOR_FILTER_DSC = 97,
264 LV_STYLE_COLOR_FILTER_OPA = 98,
266 LV_STYLE_ANIM_TIME = 100,
267 LV_STYLE_ANIM_SPEED = 101,
268 LV_STYLE_TRANSITION = 102,
269 LV_STYLE_BLEND_MODE = 103,
270 LV_STYLE_TRANSFORM_WIDTH = 104,
271 LV_STYLE_TRANSFORM_HEIGHT = 105,
272 LV_STYLE_TRANSLATE_X = 106,
273 LV_STYLE_TRANSLATE_Y = 107,
274 LV_STYLE_TRANSFORM_ZOOM = 108,
275 LV_STYLE_TRANSFORM_ANGLE = 109,
276 LV_STYLE_TRANSFORM_PIVOT_X = 110,
277 LV_STYLE_TRANSFORM_PIVOT_Y = 111,
279 _LV_STYLE_LAST_BUILT_IN_PROP = 111,
280 _LV_STYLE_NUM_BUILT_IN_PROPS = _LV_STYLE_LAST_BUILT_IN_PROP + 1,
282 LV_STYLE_PROP_ANY = 0xFFFF,
283 _LV_STYLE_PROP_CONST = 0xFFFF
287 LV_STYLE_RES_NOT_FOUND,
292typedef uint8_t lv_style_res_t;
320#if LV_USE_ASSERT_STYLE
328 uint8_t * values_and_props;
451 if(style->prop1 == LV_STYLE_PROP_ANY) {
454 for(i = 0; i < style->prop_cnt; i++) {
455 const_prop = style->v_p.const_props + i;
457 if(prop_id == prop) {
458 if(const_prop->prop & LV_STYLE_PROP_META_INHERIT)
459 return LV_STYLE_RES_INHERIT;
461 return LV_STYLE_RES_FOUND;
464 return LV_STYLE_RES_NOT_FOUND;
467 if(style->prop_cnt == 0)
return LV_STYLE_RES_NOT_FOUND;
469 if(style->prop_cnt > 1) {
470 uint8_t * tmp = style->v_p.values_and_props + style->prop_cnt *
sizeof(
lv_style_value_t);
471 uint16_t * props = (uint16_t *)tmp;
473 for(i = 0; i < style->prop_cnt; i++) {
475 if(prop_id == prop) {
476 if(props[i] & LV_STYLE_PROP_META_INHERIT)
477 return LV_STYLE_RES_INHERIT;
478 if(props[i] & LV_STYLE_PROP_META_INITIAL)
484 return LV_STYLE_RES_FOUND;
488 else if(LV_STYLE_PROP_ID_MASK(style->prop1) == prop) {
489 if(style->prop1 & LV_STYLE_PROP_META_INHERIT)
490 return LV_STYLE_RES_INHERIT;
492 style->prop1)) : style->v_p.value1;
493 return LV_STYLE_RES_FOUND;
495 return LV_STYLE_RES_NOT_FOUND;
521#include "lv_style_gen.h"
523static inline void lv_style_set_size(
lv_style_t * style, lv_coord_t value)
525 lv_style_set_width(style, value);
526 lv_style_set_height(style, value);
529static inline void lv_style_set_pad_all(
lv_style_t * style, lv_coord_t value)
531 lv_style_set_pad_left(style, value);
532 lv_style_set_pad_right(style, value);
533 lv_style_set_pad_top(style, value);
534 lv_style_set_pad_bottom(style, value);
537static inline void lv_style_set_pad_hor(
lv_style_t * style, lv_coord_t value)
539 lv_style_set_pad_left(style, value);
540 lv_style_set_pad_right(style, value);
543static inline void lv_style_set_pad_ver(
lv_style_t * style, lv_coord_t value)
545 lv_style_set_pad_top(style, value);
546 lv_style_set_pad_bottom(style, value);
549static inline void lv_style_set_pad_gap(
lv_style_t * style, lv_coord_t value)
551 lv_style_set_pad_row(style, value);
552 lv_style_set_pad_column(style, value);
565static inline bool lv_style_prop_has_flag(
lv_style_prop_t prop, uint8_t flag)
578#if LV_USE_ASSERT_STYLE
579# define LV_ASSERT_STYLE(style_p) \
581 LV_ASSERT_MSG(style_p != NULL, "The style is NULL"); \
582 LV_ASSERT_MSG(style_p->sentinel == LV_STYLE_SENTINEL_VALUE, "Style is not initialized or corrupted"); \
585# define LV_ASSERT_STYLE(p) do{}while(0)
int32_t(* lv_anim_path_cb_t)(const struct _lv_anim_t *)
Definition lv_anim.h:46
void lv_style_set_prop_meta(lv_style_t *style, lv_style_prop_t prop, uint16_t meta)
#define LV_IMG_ZOOM_NONE
Definition lv_style.h:49
@ LV_BLEND_MODE_REPLACE
Definition lv_style.h:91
@ LV_BLEND_MODE_MULTIPLY
Definition lv_style.h:90
@ LV_BLEND_MODE_SUBTRACTIVE
Definition lv_style.h:89
@ LV_BLEND_MODE_ADDITIVE
Definition lv_style.h:88
@ LV_BLEND_MODE_NORMAL
Definition lv_style.h:87
lv_style_prop_t
Definition lv_style.h:178
uint8_t _lv_style_get_prop_group(lv_style_prop_t prop)
void lv_style_set_prop(lv_style_t *style, lv_style_prop_t prop, lv_style_value_t value)
uint8_t _lv_style_prop_lookup_flags(lv_style_prop_t prop)
void lv_style_init(lv_style_t *style)
bool lv_style_is_empty(const lv_style_t *style)
@ LV_BORDER_SIDE_INTERNAL
Definition lv_style.h:119
lv_style_res_t lv_style_get_prop(const lv_style_t *style, lv_style_prop_t prop, lv_style_value_t *value)
bool lv_style_remove_prop(lv_style_t *style, lv_style_prop_t prop)
lv_style_prop_t lv_style_get_num_custom_props(void)
lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop)
@ LV_DITHER_NONE
Definition lv_style.h:139
@ LV_DITHER_ORDERED
Definition lv_style.h:140
@ LV_DITHER_ERR_DIFF
Definition lv_style.h:141
@ LV_GRAD_DIR_VER
Definition lv_style.h:128
@ LV_GRAD_DIR_NONE
Definition lv_style.h:127
@ LV_GRAD_DIR_HOR
Definition lv_style.h:129
void lv_style_reset(lv_style_t *style)
Definition lv_style.h:155
lv_grad_dir_t dir
Definition lv_style.h:158
uint8_t stops_count
Definition lv_style.h:157
lv_dither_mode_t dither
Definition lv_style.h:160
Definition lv_style.h:149
lv_color_t color
Definition lv_style.h:150
uint8_t frac
Definition lv_style.h:151
Definition lv_style.h:310
Definition lv_style.h:318
Definition lv_style.h:297
uint32_t time
Definition lv_style.h:303
const lv_style_prop_t * props
Definition lv_style.h:298
uint32_t delay
Definition lv_style.h:304
lv_anim_path_cb_t path_xcb
Definition lv_style.h:302
Definition lv_style.h:167
const void * ptr
Definition lv_style.h:169
int32_t num
Definition lv_style.h:168
lv_color_t color
Definition lv_style.h:170