feat(style): backport opa_layered
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
1375ea85a1
commit
6548ea0f29
@@ -769,7 +769,7 @@ static void spectrum_draw_event_cb(lv_event_t * e)
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_draw_ctx_t * draw_ctx = lv_event_get_draw_ctx(e);
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, LV_PART_MAIN);
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN);
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
|
||||
lv_point_t poly[4];
|
||||
|
||||
@@ -385,7 +385,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.
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
|
||||
@@ -433,7 +433,7 @@ Set the width of the shadow in pixels. The value should be >= 0.
|
||||
</ul>
|
||||
|
||||
### 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.
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
|
||||
@@ -442,7 +442,7 @@ Set an offset on the shadow in pixels in X direction.
|
||||
</ul>
|
||||
|
||||
### 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.
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
|
||||
@@ -538,7 +538,7 @@ Set the gap between dashes in pixel. Note that dash works only on horizontal and
|
||||
</ul>
|
||||
|
||||
### 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
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
|
||||
@@ -577,7 +577,7 @@ Set the width (thickness) of the arcs in pixel.
|
||||
</ul>
|
||||
|
||||
### 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
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
|
||||
@@ -634,7 +634,7 @@ Set the opacity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully
|
||||
</ul>
|
||||
|
||||
### text_font
|
||||
Set the font of the text (a pointer `lv_font_t *`).
|
||||
Set the font of the text (a pointer `lv_font_t *`).
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_FONT_DEFAULT`</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> Yes</li>
|
||||
@@ -708,6 +708,15 @@ Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0`
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
|
||||
</ul>
|
||||
|
||||
### opa_layered
|
||||
First draw the object on the layer, then scale down layer opacity factor. 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.
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_OPA_COVER`</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> Yes</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Layout</strong> No</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
|
||||
</ul>
|
||||
|
||||
### color_filter_dsc
|
||||
Mix a color to all colors of the object.
|
||||
<ul>
|
||||
|
||||
@@ -316,6 +316,10 @@ props = [
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Scale down all opacity values of the object by this factor. 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': 'OPA_LAYERED',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "First draw the object on the layer, then scale down layer opacity factor. 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': 'COLOR_FILTER_DSC',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_color_filter_dsc_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Mix a color to all colors of the object." },
|
||||
|
||||
@@ -513,6 +513,11 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
return;
|
||||
}
|
||||
|
||||
if(lv_obj_get_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) {
|
||||
info->res = LV_COVER_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
|
||||
info->res = LV_COVER_RES_COVER;
|
||||
|
||||
}
|
||||
@@ -697,7 +702,7 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
|
||||
}
|
||||
}
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, LV_PART_SCROLLBAR);
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, LV_PART_SCROLLBAR);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
dsc->bg_opa = (dsc->bg_opa * opa) >> 8;
|
||||
dsc->border_opa = (dsc->bg_opa * opa) >> 8;
|
||||
|
||||
@@ -38,9 +38,8 @@
|
||||
|
||||
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc)
|
||||
{
|
||||
lv_opa_t opa = LV_OPA_COVER;
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(part != LV_PART_MAIN) {
|
||||
opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->bg_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->bg_img_opa = LV_OPA_TRANSP;
|
||||
@@ -181,14 +180,12 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
}
|
||||
#endif
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->bg_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->bg_img_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->border_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->outline_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->bg_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->bg_img_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->border_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->outline_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,16 +194,15 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc
|
||||
draw_dsc->opa = lv_obj_get_style_text_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_text_color_filtered(obj, part);
|
||||
draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
|
||||
@@ -230,16 +226,15 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t *
|
||||
draw_dsc->opa = lv_obj_get_style_img_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->angle = 0;
|
||||
draw_dsc->zoom = LV_IMG_ZOOM_NONE;
|
||||
@@ -260,16 +255,15 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t
|
||||
draw_dsc->opa = lv_obj_get_style_line_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->width = lv_obj_get_style_line_width(obj, part);
|
||||
if(draw_dsc->width == 0) return;
|
||||
@@ -297,16 +291,15 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
|
||||
draw_dsc->opa = lv_obj_get_style_arc_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_arc_color_filtered(obj, part);
|
||||
draw_dsc->img_src = lv_obj_get_style_arc_img_src(obj, part);
|
||||
|
||||
@@ -496,6 +496,40 @@ lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj,
|
||||
return align;
|
||||
}
|
||||
|
||||
lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part)
|
||||
{
|
||||
|
||||
lv_opa_t opa_obj = lv_obj_get_style_opa(obj, part);
|
||||
if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
|
||||
lv_opa_t opa_final = LV_OPA_COVER;
|
||||
if(opa_obj < LV_OPA_MAX) {
|
||||
opa_final = ((uint32_t)opa_final * opa_obj) >> 8;
|
||||
}
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
part = LV_PART_MAIN;
|
||||
}
|
||||
else {
|
||||
obj = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
while(obj) {
|
||||
opa_obj = lv_obj_get_style_opa(obj, part);
|
||||
if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
if(opa_obj < LV_OPA_MAX) {
|
||||
opa_final = ((uint32_t)opa_final * opa_obj) >> 8;
|
||||
}
|
||||
|
||||
obj = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
if(opa_final <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
if(opa_final >= LV_OPA_MAX) return LV_OPA_COVER;
|
||||
return opa_final;
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -846,8 +880,7 @@ static lv_layer_type_t calculate_layer_type(lv_obj_t * obj)
|
||||
{
|
||||
if(lv_obj_get_style_transform_angle(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_transform_zoom(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_opa(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
|
||||
|
||||
if(lv_obj_get_style_opa_layered(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
|
||||
#endif
|
||||
|
||||
@@ -236,6 +236,21 @@ static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t valu
|
||||
|
||||
lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt);
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_zoom_safe(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
int16_t zoom = lv_obj_get_style_transform_zoom(obj, part);
|
||||
return zoom != 0 ? zoom : 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the `opa` style property from all parents and multiply and `>> 8` them.
|
||||
* @param obj the object whose opacity should be get
|
||||
* @param part the part whose opacity should be get. Non-MAIN parts will consider the `opa` of teh MAIN part too
|
||||
* @return the final opacity considering the parents' opacity too
|
||||
*/
|
||||
lv_opa_t lv_obj_get_style_opa_recursive(const struct _lv_obj_t * obj, lv_part_t part);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -600,7 +600,16 @@ 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_opa_layered(struct _lv_obj_t * obj, lv_opa_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_OPA_LAYERED, 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)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
@@ -640,7 +649,8 @@ 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
|
||||
|
||||
@@ -162,7 +162,8 @@ 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_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -216,7 +217,8 @@ 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_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -240,7 +242,8 @@ 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_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -282,7 +285,8 @@ 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_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -330,7 +334,8 @@ 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_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -354,7 +359,8 @@ 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_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR));
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -508,7 +514,14 @@ 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 lv_opa_t lv_obj_get_style_opa_layered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA_LAYERED);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
@@ -637,12 +650,15 @@ 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_opa_layered(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_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);
|
||||
|
||||
@@ -973,7 +973,7 @@ void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
lv_obj_redraw(draw_ctx, obj);
|
||||
}
|
||||
else {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, 0);
|
||||
lv_opa_t opa = lv_obj_get_style_opa_layered(obj, 0);
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
|
||||
lv_area_t layer_area_full;
|
||||
|
||||
@@ -336,7 +336,7 @@ static void draw_arcs(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area_t
|
||||
scale_center.x = scale_area->x1 + r_out;
|
||||
scale_center.y = scale_area->y1 + r_out;
|
||||
|
||||
lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN);
|
||||
lv_opa_t opa_main = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN);
|
||||
lv_meter_indicator_t * indic;
|
||||
|
||||
lv_obj_draw_part_dsc_t part_draw_dsc;
|
||||
@@ -563,7 +563,7 @@ static void draw_needles(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area
|
||||
lv_draw_img_dsc_t img_dsc;
|
||||
lv_draw_img_dsc_init(&img_dsc);
|
||||
lv_obj_init_draw_img_dsc(obj, LV_PART_ITEMS, &img_dsc);
|
||||
lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN);
|
||||
lv_opa_t opa_main = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN);
|
||||
|
||||
lv_obj_draw_part_dsc_t part_draw_dsc;
|
||||
lv_obj_draw_dsc_init(&part_draw_dsc, draw_ctx);
|
||||
|
||||
@@ -779,7 +779,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx)
|
||||
lv_coord_t max_width = lv_area_get_width(&coords);
|
||||
lv_coord_t indent = convert_indent_pct(obj, max_width);
|
||||
lv_coord_t max_w = max_width - indent; /* first line need minus indent */
|
||||
lv_opa_t obj_opa = lv_obj_get_style_opa(obj, LV_PART_MAIN);
|
||||
lv_opa_t obj_opa = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN);
|
||||
|
||||
/* coords of draw span-txt */
|
||||
lv_point_t txt_pos;
|
||||
|
||||
@@ -119,7 +119,8 @@ const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PR
|
||||
|
||||
[LV_STYLE_RADIUS] = 0,
|
||||
[LV_STYLE_CLIP_CORNER] = 0,
|
||||
[LV_STYLE_OPA] = LV_STYLE_PROP_LAYER_REFR,
|
||||
[LV_STYLE_OPA] = 0,
|
||||
[LV_STYLE_OPA_LAYERED] = LV_STYLE_PROP_LAYER_REFR,
|
||||
[LV_STYLE_COLOR_FILTER_DSC] = LV_STYLE_PROP_INHERIT,
|
||||
[LV_STYLE_COLOR_FILTER_OPA] = LV_STYLE_PROP_INHERIT,
|
||||
[LV_STYLE_ANIM_TIME] = 0,
|
||||
@@ -330,6 +331,7 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop)
|
||||
value.color = lv_color_black();
|
||||
break;
|
||||
case LV_STYLE_OPA:
|
||||
case LV_STYLE_OPA_LAYERED:
|
||||
case LV_STYLE_BORDER_OPA:
|
||||
case LV_STYLE_TEXT_OPA:
|
||||
case LV_STYLE_IMG_OPA:
|
||||
|
||||
@@ -260,23 +260,24 @@ typedef enum {
|
||||
|
||||
/*Group 6*/
|
||||
LV_STYLE_OPA = 96,
|
||||
LV_STYLE_COLOR_FILTER_DSC = 97,
|
||||
LV_STYLE_COLOR_FILTER_OPA = 98,
|
||||
LV_STYLE_ANIM = 99,
|
||||
LV_STYLE_ANIM_TIME = 100,
|
||||
LV_STYLE_ANIM_SPEED = 101,
|
||||
LV_STYLE_TRANSITION = 102,
|
||||
LV_STYLE_BLEND_MODE = 103,
|
||||
LV_STYLE_TRANSFORM_WIDTH = 104,
|
||||
LV_STYLE_TRANSFORM_HEIGHT = 105,
|
||||
LV_STYLE_TRANSLATE_X = 106,
|
||||
LV_STYLE_TRANSLATE_Y = 107,
|
||||
LV_STYLE_TRANSFORM_ZOOM = 108,
|
||||
LV_STYLE_TRANSFORM_ANGLE = 109,
|
||||
LV_STYLE_TRANSFORM_PIVOT_X = 110,
|
||||
LV_STYLE_TRANSFORM_PIVOT_Y = 111,
|
||||
LV_STYLE_OPA_LAYERED = 97,
|
||||
LV_STYLE_COLOR_FILTER_DSC = 98,
|
||||
LV_STYLE_COLOR_FILTER_OPA = 99,
|
||||
LV_STYLE_ANIM = 100,
|
||||
LV_STYLE_ANIM_TIME = 101,
|
||||
LV_STYLE_ANIM_SPEED = 102,
|
||||
LV_STYLE_TRANSITION = 103,
|
||||
LV_STYLE_BLEND_MODE = 104,
|
||||
LV_STYLE_TRANSFORM_WIDTH = 105,
|
||||
LV_STYLE_TRANSFORM_HEIGHT = 106,
|
||||
LV_STYLE_TRANSLATE_X = 107,
|
||||
LV_STYLE_TRANSLATE_Y = 108,
|
||||
LV_STYLE_TRANSFORM_ZOOM = 109,
|
||||
LV_STYLE_TRANSFORM_ANGLE = 110,
|
||||
LV_STYLE_TRANSFORM_PIVOT_X = 111,
|
||||
LV_STYLE_TRANSFORM_PIVOT_Y = 112,
|
||||
|
||||
_LV_STYLE_LAST_BUILT_IN_PROP = 111,
|
||||
_LV_STYLE_LAST_BUILT_IN_PROP = 112,
|
||||
_LV_STYLE_NUM_BUILT_IN_PROPS = _LV_STYLE_LAST_BUILT_IN_PROP + 1,
|
||||
|
||||
LV_STYLE_PROP_ANY = 0xFFFF,
|
||||
|
||||
@@ -600,6 +600,14 @@ void lv_style_set_opa(lv_style_t * style, lv_opa_t value)
|
||||
lv_style_set_prop(style, LV_STYLE_OPA, v);
|
||||
}
|
||||
|
||||
void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_OPA_LAYERED, v);
|
||||
}
|
||||
|
||||
void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
||||
@@ -73,6 +73,7 @@ void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value);
|
||||
void lv_style_set_radius(lv_style_t * style, lv_coord_t value);
|
||||
void lv_style_set_clip_corner(lv_style_t * style, bool value);
|
||||
void lv_style_set_opa(lv_style_t * style, lv_opa_t value);
|
||||
void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value);
|
||||
void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value);
|
||||
void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value);
|
||||
void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value);
|
||||
@@ -458,6 +459,11 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value);
|
||||
.prop = LV_STYLE_OPA, .value = { .num = (int32_t)val } \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_OPA_LAYERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_OPA_LAYERED, .value = { .num = (int32_t)val } \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_COLOR_FILTER_DSC(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_COLOR_FILTER_DSC, .value = { .ptr = val } \
|
||||
|
||||
Reference in New Issue
Block a user