feat(style): add skew style (#4886)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
_VIFEXTech 2023-12-12 16:18:01 +08:00 committed by GitHub
parent f1e021e7b3
commit 4be4cb6eee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 163 additions and 56 deletions

View File

@ -165,6 +165,24 @@ Set the pivot point's Y coordinate for transformations. Relative to the object's
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul>
### transform_skew_x
Skew an object horizontally. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg.
<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>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Layout</strong> Yes</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li>
</ul>
### transform_skew_y
Skew an object vertically. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg.
<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>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Layout</strong> Yes</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li>
</ul>
## Padding
Properties to describe spacing between the parent's sides and the children and among the children. Very similar to the padding properties in HTML.
@ -226,7 +244,7 @@ Sets the padding between the columns. Used by the layouts.
Properties to describe spacing around an object. Very similar to the margin properties in HTML.
### margin_top
Sets the margin on the top. The object will keep this space from its siblings in layouts.
Sets the margin on the top. The object will keep this space from its siblings in layouts.
<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 +460,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>
@ -490,7 +508,7 @@ Set the width of the shadow in pixels. The value should be >= 0.
</ul>
### shadow_offset_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>
@ -499,7 +517,7 @@ Set an offset on the shadow in pixels in X direction.
</ul>
### shadow_offset_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>
@ -595,7 +613,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>
@ -634,7 +652,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>
@ -691,7 +709,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>

View File

@ -78,6 +78,14 @@ props = [
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the pivot point's Y coordinate for transformations. Relative to the object's top left corner'"},
{'name': 'TRANSFORM_SKEW_X',
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Skew an object horizontally. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
{'name': 'TRANSFORM_SKEW_Y',
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Skew an object vertically. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
{'section': 'Padding', 'dsc' : "Properties to describe spacing between the parent's sides and the children and among the children. Very similar to the padding properties in HTML."},
{'name': 'PAD_TOP',
'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,

View File

@ -19,6 +19,7 @@
#define style_refr LV_GLOBAL_DEFAULT()->style_refresh
#define style_trans_ll_p &(LV_GLOBAL_DEFAULT()->style_trans_ll)
#define _style_custom_prop_flag_lookup_table LV_GLOBAL_DEFAULT()->style_custom_prop_flag_lookup_table
#define STYLE_PROP_SHIFTED(prop) ((uint32_t)1 << ((prop) >> 3))
/**********************
* TYPEDEFS
@ -133,13 +134,13 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto
if(lv_style_is_const(style)) {
lv_style_const_prop_t * props = style->values_and_props;
for(i = 0; props[i].prop_ptr; i++) {
(*prop_is_set) |= (uint32_t)1 << ((*props[i].prop_ptr) >> 2);
(*prop_is_set) |= STYLE_PROP_SHIFTED(*props[i].prop_ptr);
}
}
else {
lv_style_prop_t * props = (lv_style_prop_t *)style->values_and_props + style->prop_cnt * sizeof(lv_style_value_t);
for(i = 0; i < style->prop_cnt; i++) {
(*prop_is_set) |= (uint32_t)1 << (props[i] >> 2);
(*prop_is_set) |= STYLE_PROP_SHIFTED(props[i]);
}
}
#endif
@ -394,7 +395,7 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_
/*The happy path*/
#if LV_OBJ_STYLE_CACHE
const uint32_t prop_shifted = (uint32_t)1 << (prop >> 2);
const uint32_t prop_shifted = STYLE_PROP_SHIFTED(prop);
if((part == LV_PART_MAIN ? obj->style_main_prop_is_set : obj->style_other_prop_is_set) & prop_shifted)
#endif
{
@ -466,11 +467,12 @@ void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_
lv_style_set_prop(style, prop, value);
#if LV_OBJ_STYLE_CACHE
uint32_t prop_shifted = STYLE_PROP_SHIFTED(prop);
if(lv_obj_style_get_selector_part(selector) == LV_PART_MAIN) {
obj->style_main_prop_is_set |= (uint32_t)1 << (prop >> 2);
obj->style_main_prop_is_set |= prop_shifted;
}
else {
obj->style_other_prop_is_set |= (uint32_t)1 << (prop >> 2);
obj->style_other_prop_is_set |= prop_shifted;
}
#endif
@ -1049,6 +1051,8 @@ static lv_layer_type_t calculate_layer_type(lv_obj_t * obj)
if(lv_obj_get_style_transform_rotation(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_scale_x(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_scale_y(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_skew_x(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_transform_skew_y(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_opa_layered(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
return LV_LAYER_TYPE_NONE;
@ -1067,13 +1071,13 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part)
if(lv_style_is_const(style)) {
lv_style_const_prop_t * props = style->values_and_props;
for(j = 0; props[j].prop_ptr; j++) {
obj->style_main_prop_is_set |= (uint32_t)1 << ((*props[j].prop_ptr) >> 2);
obj->style_main_prop_is_set |= STYLE_PROP_SHIFTED(*props[j].prop_ptr);
}
}
else {
lv_style_prop_t * props = (lv_style_prop_t *)style->values_and_props + style->prop_cnt * sizeof(lv_style_value_t);
for(j = 0; j < style->prop_cnt; j++) {
obj->style_main_prop_is_set |= (uint32_t)1 << (props[j] >> 2);
obj->style_main_prop_is_set |= STYLE_PROP_SHIFTED(props[j]);
}
}
}
@ -1087,13 +1091,13 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part)
if(lv_style_is_const(style)) {
lv_style_const_prop_t * props = style->values_and_props;
for(j = 0; props[j].prop_ptr; j++) {
obj->style_other_prop_is_set |= (uint32_t)1 << ((*props[j].prop_ptr) >> 2);
obj->style_other_prop_is_set |= STYLE_PROP_SHIFTED(*props[j].prop_ptr);
}
}
else {
lv_style_prop_t * props = (lv_style_prop_t *)style->values_and_props + style->prop_cnt * sizeof(lv_style_value_t);
for(j = 0; j < style->prop_cnt; j++) {
obj->style_other_prop_is_set |= (uint32_t)1 << (props[j] >> 2);
obj->style_other_prop_is_set |= STYLE_PROP_SHIFTED(props[j]);
}
}
}

View File

@ -6,8 +6,10 @@
**********************************************************************
*/
#include "lv_obj.h"
void lv_obj_set_style_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@ -152,6 +154,22 @@ void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, int32_t value, l
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_PIVOT_Y, v, selector);
}
void lv_obj_set_style_transform_skew_x(struct _lv_obj_t * obj, int32_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_TRANSFORM_SKEW_X, v, selector);
}
void lv_obj_set_style_transform_skew_y(struct _lv_obj_t * obj, int32_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_TRANSFORM_SKEW_Y, v, selector);
}
void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector)
{
lv_style_value_t v = {
@ -664,8 +682,7 @@ void lv_obj_set_style_opa_layered(struct _lv_obj_t * obj, lv_opa_t value, lv_sty
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)
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
@ -697,8 +714,7 @@ void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_TIME, 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

View File

@ -122,6 +122,18 @@ static inline int32_t lv_obj_get_style_transform_pivot_y(const struct _lv_obj_t
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_skew_x(const struct _lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_X);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_transform_skew_y(const struct _lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_Y);
return (int32_t)v.num;
}
static inline int32_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP);
@ -208,8 +220,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_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;
}
@ -269,8 +280,7 @@ static inline lv_color_t lv_obj_get_style_bg_image_recolor(const struct _lv_obj_
static inline lv_color_t lv_obj_get_style_bg_image_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_IMAGE_RECOLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR));
return v.color;
}
@ -294,8 +304,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_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;
}
@ -337,8 +346,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_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;
}
@ -386,8 +394,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_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;
}
@ -411,8 +418,7 @@ static inline lv_color_t lv_obj_get_style_image_recolor(const struct _lv_obj_t *
static inline lv_color_t lv_obj_get_style_image_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_IMAGE_RECOLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR));
return v.color;
}
@ -572,8 +578,7 @@ static inline lv_opa_t lv_obj_get_style_opa_layered(const struct _lv_obj_t * obj
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;
@ -729,6 +734,8 @@ void lv_obj_set_style_transform_scale_y(struct _lv_obj_t * obj, int32_t value, l
void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_skew_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_skew_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector);
@ -793,13 +800,11 @@ void lv_obj_set_style_radius(struct _lv_obj_t * obj, int32_t value, lv_style_sel
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_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_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_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);
@ -808,8 +813,7 @@ void lv_obj_set_style_flex_main_place(struct _lv_obj_t * obj, lv_flex_align_t va
void lv_obj_set_style_flex_cross_place(struct _lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
void lv_obj_set_style_flex_track_place(struct _lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector);
void lv_obj_set_style_flex_grow(struct _lv_obj_t * obj, uint8_t value, lv_style_selector_t selector);
void lv_obj_set_style_grid_column_dsc_array(struct _lv_obj_t * obj, const int32_t * value,
lv_style_selector_t selector);
void lv_obj_set_style_grid_column_dsc_array(struct _lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector);
void lv_obj_set_style_grid_column_align(struct _lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector);
void lv_obj_set_style_grid_row_dsc_array(struct _lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector);
void lv_obj_set_style_grid_row_align(struct _lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector);

View File

@ -938,6 +938,8 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
while(layer_draw_dsc.rotation < 0) layer_draw_dsc.rotation += 3600;
layer_draw_dsc.scale_x = lv_obj_get_style_transform_scale_x(obj, 0);
layer_draw_dsc.scale_y = lv_obj_get_style_transform_scale_y(obj, 0);
layer_draw_dsc.skew_x = lv_obj_get_style_transform_skew_x(obj, 0);
layer_draw_dsc.skew_y = lv_obj_get_style_transform_skew_y(obj, 0);
layer_draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, 0);
layer_draw_dsc.antialias = disp_refr->antialiasing;
layer_draw_dsc.src = new_layer;

View File

@ -45,6 +45,8 @@ typedef struct _lv_draw_image_dsc_t {
int32_t rotation;
int32_t scale_x;
int32_t scale_y;
int32_t skew_x;
int32_t skew_y;
lv_point_t pivot;
lv_color_t recolor;

View File

@ -205,6 +205,21 @@ static int32_t evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
{
LV_UNUSED(draw_unit);
switch(task->type) {
case LV_DRAW_TASK_TYPE_IMAGE:
case LV_DRAW_TASK_TYPE_LAYER: {
lv_draw_image_dsc_t * draw_dsc = task->draw_dsc;
/* not support skew */
if(draw_dsc->skew_x != 0 || draw_dsc->skew_y != 0) {
return 0;
}
}
break;
default:
break;
}
if(task->preference_score >= 100) {
task->preference_score = 100;
task->preferred_draw_unit_id = DRAW_UNIT_ID_SW;

View File

@ -50,6 +50,8 @@ const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PR
[LV_STYLE_TRANSLATE_Y] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE | LV_STYLE_PROP_FLAG_PARENT_LAYOUT_UPDATE,
[LV_STYLE_TRANSFORM_SCALE_X] = LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE | LV_STYLE_PROP_FLAG_LAYER_UPDATE | LV_STYLE_PROP_FLAG_TRANSFORM,
[LV_STYLE_TRANSFORM_SCALE_Y] = LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE | LV_STYLE_PROP_FLAG_LAYER_UPDATE | LV_STYLE_PROP_FLAG_TRANSFORM,
[LV_STYLE_TRANSFORM_SKEW_X] = LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE | LV_STYLE_PROP_FLAG_LAYER_UPDATE | LV_STYLE_PROP_FLAG_TRANSFORM,
[LV_STYLE_TRANSFORM_SKEW_Y] = LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE | LV_STYLE_PROP_FLAG_LAYER_UPDATE | LV_STYLE_PROP_FLAG_TRANSFORM,
[LV_STYLE_TRANSFORM_ROTATION] = LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE | LV_STYLE_PROP_FLAG_LAYER_UPDATE | LV_STYLE_PROP_FLAG_TRANSFORM,
[LV_STYLE_PAD_TOP] = LV_STYLE_PROP_FLAG_EXT_DRAW_UPDATE | LV_STYLE_PROP_FLAG_LAYOUT_UPDATE,

View File

@ -295,29 +295,31 @@ enum _lv_style_prop_t {
LV_STYLE_TRANSFORM_ROTATION = 110,
LV_STYLE_TRANSFORM_PIVOT_X = 111,
LV_STYLE_TRANSFORM_PIVOT_Y = 112,
LV_STYLE_TRANSFORM_SKEW_X = 113,
LV_STYLE_TRANSFORM_SKEW_Y = 114,
#if LV_USE_FLEX
LV_STYLE_FLEX_FLOW = 113,
LV_STYLE_FLEX_MAIN_PLACE = 114,
LV_STYLE_FLEX_CROSS_PLACE = 115,
LV_STYLE_FLEX_TRACK_PLACE = 116,
LV_STYLE_FLEX_GROW = 117,
LV_STYLE_FLEX_FLOW = 115,
LV_STYLE_FLEX_MAIN_PLACE = 116,
LV_STYLE_FLEX_CROSS_PLACE = 117,
LV_STYLE_FLEX_TRACK_PLACE = 118,
LV_STYLE_FLEX_GROW = 119,
#endif
#if LV_USE_GRID
LV_STYLE_GRID_COLUMN_ALIGN = 118,
LV_STYLE_GRID_ROW_ALIGN = 119,
LV_STYLE_GRID_ROW_DSC_ARRAY = 120,
LV_STYLE_GRID_COLUMN_DSC_ARRAY = 121,
LV_STYLE_GRID_CELL_COLUMN_POS = 122,
LV_STYLE_GRID_CELL_COLUMN_SPAN = 123,
LV_STYLE_GRID_CELL_X_ALIGN = 124,
LV_STYLE_GRID_CELL_ROW_POS = 125,
LV_STYLE_GRID_CELL_ROW_SPAN = 126,
LV_STYLE_GRID_CELL_Y_ALIGN = 127,
LV_STYLE_GRID_COLUMN_ALIGN = 120,
LV_STYLE_GRID_ROW_ALIGN = 121,
LV_STYLE_GRID_ROW_DSC_ARRAY = 122,
LV_STYLE_GRID_COLUMN_DSC_ARRAY = 123,
LV_STYLE_GRID_CELL_COLUMN_POS = 124,
LV_STYLE_GRID_CELL_COLUMN_SPAN = 125,
LV_STYLE_GRID_CELL_X_ALIGN = 126,
LV_STYLE_GRID_CELL_ROW_POS = 127,
LV_STYLE_GRID_CELL_ROW_SPAN = 128,
LV_STYLE_GRID_CELL_Y_ALIGN = 129,
#endif
_LV_STYLE_LAST_BUILT_IN_PROP = 128,
_LV_STYLE_LAST_BUILT_IN_PROP = 130,
_LV_STYLE_NUM_BUILT_IN_PROPS = _LV_STYLE_LAST_BUILT_IN_PROP + 1,

View File

@ -188,6 +188,26 @@ void lv_style_set_transform_pivot_y(lv_style_t * style, int32_t value)
const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_Y = LV_STYLE_TRANSFORM_PIVOT_Y;
void lv_style_set_transform_skew_x(lv_style_t * style, int32_t value)
{
lv_style_value_t v = {
.num = (int32_t)value
};
lv_style_set_prop(style, LV_STYLE_TRANSFORM_SKEW_X, v);
}
const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_X = LV_STYLE_TRANSFORM_SKEW_X;
void lv_style_set_transform_skew_y(lv_style_t * style, int32_t value)
{
lv_style_value_t v = {
.num = (int32_t)value
};
lv_style_set_prop(style, LV_STYLE_TRANSFORM_SKEW_Y, v);
}
const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_Y = LV_STYLE_TRANSFORM_SKEW_Y;
void lv_style_set_pad_top(lv_style_t * style, int32_t value)
{
lv_style_value_t v = {

View File

@ -45,6 +45,10 @@ void lv_style_set_transform_pivot_x(lv_style_t * style, int32_t value);
extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_X;
void lv_style_set_transform_pivot_y(lv_style_t * style, int32_t value);
extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_Y;
void lv_style_set_transform_skew_x(lv_style_t * style, int32_t value);
extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_X;
void lv_style_set_transform_skew_y(lv_style_t * style, int32_t value);
extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_Y;
void lv_style_set_pad_top(lv_style_t * style, int32_t value);
extern const lv_style_prop_t _lv_style_const_prop_id_PAD_TOP;
void lv_style_set_pad_bottom(lv_style_t * style, int32_t value);
@ -310,6 +314,16 @@ extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN;
.prop_ptr = &_lv_style_const_prop_id_TRANSFORM_PIVOT_Y, .value = { .num = (int32_t)val } \
}
#define LV_STYLE_CONST_TRANSFORM_SKEW_X(val) \
{ \
.prop_ptr = &_lv_style_const_prop_id_TRANSFORM_SKEW_X, .value = { .num = (int32_t)val } \
}
#define LV_STYLE_CONST_TRANSFORM_SKEW_Y(val) \
{ \
.prop_ptr = &_lv_style_const_prop_id_TRANSFORM_SKEW_Y, .value = { .num = (int32_t)val } \
}
#define LV_STYLE_CONST_PAD_TOP(val) \
{ \
.prop_ptr = &_lv_style_const_prop_id_PAD_TOP, .value = { .num = (int32_t)val } \