aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c37
-rw-r--r--examples/widgets/chart/lv_example_chart_4.c7
-rw-r--r--examples/widgets/table/lv_example_table_1.c24
3 files changed, 37 insertions, 31 deletions
diff --git a/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c b/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c
index 97a340e38..f355e37d5 100644
--- a/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c
+++ b/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c
@@ -15,33 +15,36 @@ static void event_cb(lv_event_t * e)
/*Change the draw descriptor of the 2nd button*/
if(base_dsc->id1 == 1) {
- if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
- lv_draw_rect_dsc_t * rect_draw_dsc = draw_task->draw_dsc;
- rect_draw_dsc->radius = 0;
- if(pressed) rect_draw_dsc->bg_color = lv_palette_darken(LV_PALETTE_BLUE, 3);
- else rect_draw_dsc->bg_color = lv_palette_main(LV_PALETTE_BLUE);
- rect_draw_dsc->shadow_width = 6;
- rect_draw_dsc->shadow_offset_x = 3;
- rect_draw_dsc->shadow_offset_y = 3;
+ lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task);
+ if(fill_draw_dsc) {
+ fill_draw_dsc->radius = 0;
+ if(pressed) fill_draw_dsc->color = lv_palette_darken(LV_PALETTE_BLUE, 3);
+ else fill_draw_dsc->color = lv_palette_main(LV_PALETTE_BLUE);
+ }
+ lv_draw_box_shadow_dsc_t * box_shadow_draw_dsc = lv_draw_task_get_box_shadow_dsc(draw_task);
+ if(box_shadow_draw_dsc) {
+ box_shadow_draw_dsc->width = 6;
+ box_shadow_draw_dsc->ofs_x = 3;
+ box_shadow_draw_dsc->ofs_y = 3;
}
- if(draw_task->type == LV_DRAW_TASK_TYPE_LABEL) {
- lv_draw_label_dsc_t * label_draw_dsc = draw_task->draw_dsc;
+ lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task);
+ if(label_draw_dsc) {
label_draw_dsc->color = lv_color_white();
}
}
/*Change the draw descriptor of the 3rd button*/
else if(base_dsc->id1 == 2) {
- if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
- lv_draw_rect_dsc_t * rect_draw_dsc = draw_task->draw_dsc;
- rect_draw_dsc->radius = LV_RADIUS_CIRCLE;
- if(pressed) rect_draw_dsc->bg_color = lv_palette_darken(LV_PALETTE_RED, 3);
- else rect_draw_dsc->bg_color = lv_palette_main(LV_PALETTE_RED);
+ lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task);
+ if(fill_draw_dsc) {
+ fill_draw_dsc->radius = LV_RADIUS_CIRCLE;
+ if(pressed) fill_draw_dsc->color = lv_palette_darken(LV_PALETTE_RED, 3);
+ else fill_draw_dsc->color = lv_palette_main(LV_PALETTE_RED);
}
}
else if(base_dsc->id1 == 3) {
- if(draw_task->type == LV_DRAW_TASK_TYPE_LABEL) {
- lv_draw_label_dsc_t * label_draw_dsc = draw_task->draw_dsc;
+ lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task);
+ if(label_draw_dsc) {
label_draw_dsc->opa = 0;
}
if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
diff --git a/examples/widgets/chart/lv_example_chart_4.c b/examples/widgets/chart/lv_example_chart_4.c
index e8aebd613..c1004f1d1 100644
--- a/examples/widgets/chart/lv_example_chart_4.c
+++ b/examples/widgets/chart/lv_example_chart_4.c
@@ -7,9 +7,12 @@ static void draw_event_cb(lv_event_t * e)
lv_draw_task_t * draw_task = lv_event_get_draw_task(e);
lv_draw_dsc_base_t * base_dsc = draw_task->draw_dsc;
- if(base_dsc->part == LV_PART_ITEMS && draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
- lv_draw_fill_dsc_t * fill_dsc = draw_task->draw_dsc;
+ if(base_dsc->part != LV_PART_ITEMS) {
+ return;
+ }
+ lv_draw_fill_dsc_t * fill_dsc = lv_draw_task_get_fill_dsc(draw_task);
+ if(fill_dsc) {
lv_obj_t * chart = lv_event_get_target(e);
int32_t * y_array = lv_chart_get_y_array(chart, lv_chart_get_series_next(chart, NULL));
int32_t v = y_array[base_dsc->id2];
diff --git a/examples/widgets/table/lv_example_table_1.c b/examples/widgets/table/lv_example_table_1.c
index 4f26c3ac8..e9d663a5f 100644
--- a/examples/widgets/table/lv_example_table_1.c
+++ b/examples/widgets/table/lv_example_table_1.c
@@ -12,30 +12,30 @@ static void draw_event_cb(lv_event_t * e)
/*Make the texts in the first cell center aligned*/
if(row == 0) {
- if(draw_task->type == LV_DRAW_TASK_TYPE_LABEL) {
- lv_draw_label_dsc_t * label_draw_dsc = draw_task->draw_dsc;
+ lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task);
+ if(label_draw_dsc) {
label_draw_dsc->align = LV_TEXT_ALIGN_CENTER;
}
- if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
- lv_draw_rect_dsc_t * rect_draw_dsc = draw_task->draw_dsc;
- rect_draw_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_BLUE), rect_draw_dsc->bg_color, LV_OPA_20);
- rect_draw_dsc->bg_opa = LV_OPA_COVER;
+ lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task);
+ if(fill_draw_dsc) {
+ fill_draw_dsc->color = lv_color_mix(lv_palette_main(LV_PALETTE_BLUE), fill_draw_dsc->color, LV_OPA_20);
+ fill_draw_dsc->opa = LV_OPA_COVER;
}
}
/*In the first column align the texts to the right*/
else if(col == 0) {
- if(draw_task->type == LV_DRAW_TASK_TYPE_LABEL) {
- lv_draw_label_dsc_t * label_draw_dsc = draw_task->draw_dsc;
+ lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task);
+ if(label_draw_dsc) {
label_draw_dsc->align = LV_TEXT_ALIGN_RIGHT;
}
}
/*Make every 2nd row grayish*/
if((row != 0 && row % 2) == 0) {
- if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
- lv_draw_rect_dsc_t * rect_draw_dsc = draw_task->draw_dsc;
- rect_draw_dsc->bg_color = lv_color_mix(lv_palette_main(LV_PALETTE_GREY), rect_draw_dsc->bg_color, LV_OPA_10);
- rect_draw_dsc->bg_opa = LV_OPA_COVER;
+ lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task);
+ if(fill_draw_dsc) {
+ fill_draw_dsc->color = lv_color_mix(lv_palette_main(LV_PALETTE_GREY), fill_draw_dsc->color, LV_OPA_10);
+ fill_draw_dsc->opa = LV_OPA_COVER;
}
}
}