feat(draw): support transforming widgets and improfe sw transform
For details see: https://docs.lvgl.io/master/overview/style.html
This commit is contained in:
@@ -89,3 +89,10 @@ Extending the current theme
|
||||
:language: c
|
||||
|
||||
|
||||
Opacity and Transformations
|
||||
""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: styles/lv_example_style_15
|
||||
:language: c
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ void lv_example_style_11(void);
|
||||
void lv_example_style_12(void);
|
||||
void lv_example_style_13(void);
|
||||
void lv_example_style_14(void);
|
||||
void lv_example_style_15(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
50
examples/styles/lv_example_style_15.c
Normal file
50
examples/styles/lv_example_style_15.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES && LV_USE_BTN && LV_USE_LABEL
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Opacity and Transformations
|
||||
*/
|
||||
void lv_example_style_15(void)
|
||||
{
|
||||
lv_obj_t * btn;
|
||||
lv_obj_t * label;
|
||||
|
||||
/*Normal button*/
|
||||
btn = lv_btn_create(lv_scr_act());
|
||||
lv_obj_set_size(btn, 100, 40);
|
||||
lv_obj_align(btn, LV_ALIGN_CENTER, 0, -70);
|
||||
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Normal");
|
||||
lv_obj_center(label);
|
||||
|
||||
/*Set opacity
|
||||
*The button and the label is rendered to a layer first and that layer is blended*/
|
||||
btn = lv_btn_create(lv_scr_act());
|
||||
lv_obj_set_size(btn, 100, 40);
|
||||
lv_obj_set_style_opa(btn, LV_OPA_50, 0);
|
||||
lv_obj_align(btn, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Opa:50%");
|
||||
lv_obj_center(label);
|
||||
|
||||
/*Set transformations
|
||||
*The button and the label is rendered to a layer first and that layer is transformed*/
|
||||
btn = lv_btn_create(lv_scr_act());
|
||||
lv_obj_set_size(btn, 100, 40);
|
||||
lv_obj_set_style_transform_angle(btn, 150, 0); /*150 deg*/
|
||||
lv_obj_set_style_transform_zoom(btn, 256 + 64, 0); /*1.25x*/
|
||||
lv_obj_set_style_transform_pivot_x(btn, 50, 0);
|
||||
lv_obj_set_style_transform_pivot_y(btn, 20, 0);
|
||||
lv_obj_set_style_opa(btn, LV_OPA_50, 0);
|
||||
lv_obj_align(btn, LV_ALIGN_CENTER, 0, 70);
|
||||
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "Transf.");
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user