feat(color): use colors from material design

Use function instead of color macros
This commit is contained in:
Gabor Kiss-Vamosi
2021-02-23 15:03:06 +01:00
parent 8740046efc
commit cbfbcb47f9
60 changed files with 475 additions and 222 deletions
@@ -14,22 +14,22 @@ void lv_example_get_started_2(void)
lv_style_init(&style_btn); lv_style_init(&style_btn);
lv_style_set_radius(&style_btn, 10); lv_style_set_radius(&style_btn, 10);
lv_style_set_bg_opa(&style_btn, LV_OPA_COVER); lv_style_set_bg_opa(&style_btn, LV_OPA_COVER);
lv_style_set_bg_color(&style_btn, LV_COLOR_SILVER); lv_style_set_bg_color(&style_btn, lv_color_grey_lighten_3());
lv_style_set_bg_grad_color(&style_btn, LV_COLOR_GRAY); lv_style_set_bg_grad_color(&style_btn, lv_color_grey());
lv_style_set_bg_grad_dir(&style_btn, LV_GRAD_DIR_VER); lv_style_set_bg_grad_dir(&style_btn, LV_GRAD_DIR_VER);
/*Add a border*/ /*Add a border*/
lv_style_set_border_color(&style_btn, LV_COLOR_WHITE); lv_style_set_border_color(&style_btn, lv_color_white());
lv_style_set_border_opa(&style_btn, LV_OPA_70); lv_style_set_border_opa(&style_btn, LV_OPA_70);
lv_style_set_border_width(&style_btn, 2); lv_style_set_border_width(&style_btn, 2);
/*Set the text style*/ /*Set the text style*/
lv_style_set_text_color(&style_btn, LV_COLOR_WHITE); lv_style_set_text_color(&style_btn, lv_color_white());
/*Create a red style. Change only some colors.*/ /*Create a red style. Change only some colors.*/
lv_style_init(&style_btn_red); lv_style_init(&style_btn_red);
lv_style_set_bg_color(&style_btn_red, LV_COLOR_RED); lv_style_set_bg_color(&style_btn_red, lv_color_red());
lv_style_set_bg_grad_color(&style_btn_red, LV_COLOR_MAROON); lv_style_set_bg_grad_color(&style_btn_red, lv_color_red_darken_3());
/*Create a style for the pressed state. Add color filter to make every color darker*/ /*Create a style for the pressed state. Add color filter to make every color darker*/
lv_style_init(&style_btn_pressed); lv_style_init(&style_btn_pressed);
-2
View File
@@ -27,8 +27,6 @@ extern "C" {
**********************/ **********************/
void lv_example_scroll_1(void); void lv_example_scroll_1(void);
void lv_example_scroll_2(void); void lv_example_scroll_2(void);
void lv_example_scroll_3(void);
void lv_example_scroll_4(void);
/********************** /**********************
* MACROS * MACROS
+2 -2
View File
@@ -12,8 +12,8 @@ void lv_example_style_1(void)
/*Make a gradient*/ /*Make a gradient*/
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_bg_color(&style, LV_COLOR_SILVER); lv_style_set_bg_color(&style, lv_color_grey_lighten_3());
lv_style_set_bg_grad_color(&style, LV_COLOR_BLUE); lv_style_set_bg_grad_color(&style, lv_color_blue());
lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER); lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER);
/*Shift the gradient to the bottom*/ /*Shift the gradient to the bottom*/
+2 -2
View File
@@ -12,10 +12,10 @@ typedef int _keep_pedantic_happy;
// /*Set a background color and a radius*/ // /*Set a background color and a radius*/
// lv_style_set_radius(&style, LV_STATE_DEFAULT, 5); // lv_style_set_radius(&style, LV_STATE_DEFAULT, 5);
// lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER); // lv_style_set_bg_opa(&style, LV_STATE_DEFAULT, LV_OPA_COVER);
// lv_style_set_bg_color(&style, LV_STATE_DEFAULT, LV_COLOR_SILVER); // lv_style_set_bg_color(&style, LV_STATE_DEFAULT, lv_color_grey_lighten_3());
// //
// /*Set different background color in pressed state*/ // /*Set different background color in pressed state*/
// lv_style_set_bg_color(&style, LV_STATE_PRESSED, LV_COLOR_GRAY); // lv_style_set_bg_color(&style, LV_STATE_PRESSED, lv_color_grey());
// //
// /*Set different transition time in default and pressed state // /*Set different transition time in default and pressed state
// *fast press, slower revert to default*/ // *fast press, slower revert to default*/
+1 -1
View File
@@ -9,7 +9,7 @@ void lv_example_style_11(void)
static lv_style_t style; static lv_style_t style;
lv_style_init(&style); lv_style_init(&style);
lv_style_set_arc_color(&style, LV_COLOR_RED); lv_style_set_arc_color(&style, lv_color_red());
lv_style_set_arc_width(&style, 4); lv_style_set_arc_width(&style, 4);
+2 -2
View File
@@ -12,10 +12,10 @@ void lv_example_style_2(void)
/*Set a background color and a radius*/ /*Set a background color and a radius*/
lv_style_set_radius(&style, 10); lv_style_set_radius(&style, 10);
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_bg_color(&style, LV_COLOR_SILVER); lv_style_set_bg_color(&style, lv_color_grey_lighten_3());
/*Add border to the bottom+right*/ /*Add border to the bottom+right*/
lv_style_set_border_color(&style, LV_COLOR_BLUE); lv_style_set_border_color(&style, lv_color_blue());
lv_style_set_border_width(&style, 5); lv_style_set_border_width(&style, 5);
lv_style_set_border_opa(&style, LV_OPA_50); lv_style_set_border_opa(&style, LV_OPA_50);
lv_style_set_border_side(&style, LV_BORDER_SIDE_BOTTOM | LV_BORDER_SIDE_RIGHT); lv_style_set_border_side(&style, LV_BORDER_SIDE_BOTTOM | LV_BORDER_SIDE_RIGHT);
+2 -2
View File
@@ -12,11 +12,11 @@ void lv_example_style_3(void)
/*Set a background color and a radius*/ /*Set a background color and a radius*/
lv_style_set_radius(&style, 5); lv_style_set_radius(&style, 5);
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_bg_color(&style, LV_COLOR_SILVER); lv_style_set_bg_color(&style, lv_color_grey_lighten_3());
/*Add outline*/ /*Add outline*/
lv_style_set_outline_width(&style, 2); lv_style_set_outline_width(&style, 2);
lv_style_set_outline_color(&style, LV_COLOR_BLUE); lv_style_set_outline_color(&style, lv_color_blue());
lv_style_set_outline_pad(&style, 8); lv_style_set_outline_pad(&style, 8);
/*Create an object with the new style*/ /*Create an object with the new style*/
+2 -2
View File
@@ -12,11 +12,11 @@ void lv_example_style_4(void)
/*Set a background color and a radius*/ /*Set a background color and a radius*/
lv_style_set_radius(&style, 5); lv_style_set_radius(&style, 5);
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_bg_color(&style, LV_COLOR_SILVER); lv_style_set_bg_color(&style, lv_color_grey_lighten_3());
/*Add a shadow*/ /*Add a shadow*/
lv_style_set_shadow_width(&style, 8); lv_style_set_shadow_width(&style, 8);
lv_style_set_shadow_color(&style, LV_COLOR_BLUE); lv_style_set_shadow_color(&style, lv_color_blue());
lv_style_set_shadow_ofs_x(&style, 10); lv_style_set_shadow_ofs_x(&style, 10);
lv_style_set_shadow_ofs_y(&style, 20); lv_style_set_shadow_ofs_y(&style, 20);
+2 -2
View File
@@ -12,10 +12,10 @@ void lv_example_style_6(void)
/*Set a background color and a radius*/ /*Set a background color and a radius*/
lv_style_set_radius(&style, 5); lv_style_set_radius(&style, 5);
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_bg_color(&style, LV_COLOR_SILVER); lv_style_set_bg_color(&style, lv_color_grey_lighten_3());
/*Add a value text properties*/ /*Add a value text properties*/
lv_style_set_content_color(&style, LV_COLOR_BLUE); lv_style_set_content_color(&style, lv_color_blue());
lv_style_set_content_align(&style, LV_ALIGN_IN_BOTTOM_RIGHT); lv_style_set_content_align(&style, LV_ALIGN_IN_BOTTOM_RIGHT);
lv_style_set_content_ofs_x(&style, -5); lv_style_set_content_ofs_x(&style, -5);
lv_style_set_content_ofs_y(&style, -5); lv_style_set_content_ofs_y(&style, -5);
+3 -3
View File
@@ -11,12 +11,12 @@ void lv_example_style_7(void)
lv_style_set_radius(&style, 5); lv_style_set_radius(&style, 5);
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_bg_color(&style, LV_COLOR_SILVER); lv_style_set_bg_color(&style, lv_color_grey_lighten_3());
lv_style_set_border_width(&style, 2); lv_style_set_border_width(&style, 2);
lv_style_set_border_color(&style, LV_COLOR_BLUE); lv_style_set_border_color(&style, lv_color_blue());
lv_style_set_pad_all(&style, 10); lv_style_set_pad_all(&style, 10);
lv_style_set_text_color(&style, LV_COLOR_BLUE); lv_style_set_text_color(&style, lv_color_blue());
lv_style_set_text_letter_space(&style, 5); lv_style_set_text_letter_space(&style, 5);
lv_style_set_text_line_space(&style, 20); lv_style_set_text_line_space(&style, 20);
lv_style_set_text_decor(&style, LV_TEXT_DECOR_UNDERLINE); lv_style_set_text_decor(&style, LV_TEXT_DECOR_UNDERLINE);
+1 -1
View File
@@ -9,7 +9,7 @@ void lv_example_style_8(void)
static lv_style_t style; static lv_style_t style;
lv_style_init(&style); lv_style_init(&style);
lv_style_set_line_color(&style, LV_COLOR_GRAY); lv_style_set_line_color(&style, lv_color_grey());
lv_style_set_line_width(&style, 6); lv_style_set_line_width(&style, 6);
lv_style_set_line_rounded(&style, true); lv_style_set_line_rounded(&style, true);
+3 -3
View File
@@ -12,13 +12,13 @@ void lv_example_style_9(void)
/*Set a background color and a radius*/ /*Set a background color and a radius*/
lv_style_set_radius(&style, 5); lv_style_set_radius(&style, 5);
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_bg_color(&style, LV_COLOR_SILVER); lv_style_set_bg_color(&style, lv_color_grey_lighten_3());
lv_style_set_border_width(&style, 2); lv_style_set_border_width(&style, 2);
lv_style_set_border_color(&style, LV_COLOR_BLUE); lv_style_set_border_color(&style, lv_color_blue());
// lv_style_set_pad_all(&style, 10); // lv_style_set_pad_all(&style, 10);
lv_style_set_img_recolor(&style, LV_COLOR_BLUE); lv_style_set_img_recolor(&style, lv_color_blue());
lv_style_set_img_recolor_opa(&style, LV_OPA_50); lv_style_set_img_recolor_opa(&style, LV_OPA_50);
lv_style_set_transform_angle(&style, 300); lv_style_set_transform_angle(&style, 300);
+2 -2
View File
@@ -10,7 +10,7 @@ void lv_example_bar_2(void)
static lv_style_t style_indic; static lv_style_t style_indic;
lv_style_init(&style_bg); lv_style_init(&style_bg);
lv_style_set_border_color(&style_bg, LV_COLOR_BLUE); lv_style_set_border_color(&style_bg, lv_color_blue());
lv_style_set_border_width(&style_bg, 2); lv_style_set_border_width(&style_bg, 2);
lv_style_set_pad_all(&style_bg, 6); /*To make the indicator smaller*/ lv_style_set_pad_all(&style_bg, 6); /*To make the indicator smaller*/
lv_style_set_radius(&style_bg, 6); lv_style_set_radius(&style_bg, 6);
@@ -18,7 +18,7 @@ void lv_example_bar_2(void)
lv_style_init(&style_indic); lv_style_init(&style_indic);
lv_style_set_bg_opa(&style_indic, LV_OPA_COVER); lv_style_set_bg_opa(&style_indic, LV_OPA_COVER);
lv_style_set_bg_color(&style_indic, LV_COLOR_BLUE); lv_style_set_bg_color(&style_indic, lv_color_blue());
lv_style_set_radius(&style_indic, 3); lv_style_set_radius(&style_indic, 3);
lv_obj_t * bar = lv_bar_create(lv_scr_act(), NULL); lv_obj_t * bar = lv_bar_create(lv_scr_act(), NULL);
+3 -3
View File
@@ -19,12 +19,12 @@ void lv_example_bar_3(void)
lv_style_init(&style_indic); lv_style_init(&style_indic);
lv_style_set_bg_opa(&style_indic, LV_OPA_COVER); lv_style_set_bg_opa(&style_indic, LV_OPA_COVER);
lv_style_set_bg_color(&style_indic, LV_COLOR_RED); lv_style_set_bg_color(&style_indic, lv_color_red());
lv_style_set_bg_grad_color(&style_indic, LV_COLOR_BLUE); lv_style_set_bg_grad_color(&style_indic, lv_color_blue());
lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_VER); lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_VER);
lv_style_set_content_align(&style_indic, LV_ALIGN_OUT_LEFT_TOP); lv_style_set_content_align(&style_indic, LV_ALIGN_OUT_LEFT_TOP);
lv_style_set_content_ofs_x(&style_indic, -3); lv_style_set_content_ofs_x(&style_indic, -3);
lv_style_set_content_color(&style_indic, LV_COLOR_GRAY); lv_style_set_content_color(&style_indic, lv_color_grey());
lv_obj_t * bar = lv_bar_create(lv_scr_act(), NULL); lv_obj_t * bar = lv_bar_create(lv_scr_act(), NULL);
lv_obj_add_style(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, &style_indic); lv_obj_add_style(bar, LV_PART_INDICATOR, LV_STATE_DEFAULT, &style_indic);
+2 -2
View File
@@ -26,13 +26,13 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
if(lv_area_get_width(&bar->indic_area) > txt_size.x + 20) { if(lv_area_get_width(&bar->indic_area) > txt_size.x + 20) {
txt_area.x2 = bar->indic_area.x2 - 5; txt_area.x2 = bar->indic_area.x2 - 5;
txt_area.x1 = txt_area.x2 - txt_size.x + 1; txt_area.x1 = txt_area.x2 - txt_size.x + 1;
dsc.color = LV_COLOR_WHITE; dsc.color = lv_color_white();
} }
/*If the indicator is still short put the text out of it on the right */ /*If the indicator is still short put the text out of it on the right */
else { else {
txt_area.x1 = bar->indic_area.x2 + 5; txt_area.x1 = bar->indic_area.x2 + 5;
txt_area.x2 = txt_area.x1 + txt_size.x - 1; txt_area.x2 = txt_area.x1 + txt_size.x - 1;
dsc.color = LV_COLOR_BLACK; dsc.color = lv_color_black();
} }
txt_area.y1 = bar->indic_area.y1 + (lv_area_get_height(&bar->indic_area) - txt_size.y) / 2; txt_area.y1 = bar->indic_area.y1 + (lv_area_get_height(&bar->indic_area) - txt_size.y) / 2;
+5 -5
View File
@@ -17,20 +17,20 @@ void lv_example_btn_2(void)
lv_style_set_radius(&style, 3); lv_style_set_radius(&style, 3);
lv_style_set_bg_opa(&style, LV_OPA_70); lv_style_set_bg_opa(&style, LV_OPA_70);
lv_style_set_bg_color(&style, LV_COLOR_BLUE); lv_style_set_bg_color(&style, lv_color_blue());
lv_style_set_bg_grad_color(&style, LV_COLOR_AQUA); lv_style_set_bg_grad_color(&style, lv_color_blue_darken_4());
lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER); lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER);
lv_style_set_border_opa(&style, LV_OPA_40); lv_style_set_border_opa(&style, LV_OPA_40);
lv_style_set_border_width(&style, 2); lv_style_set_border_width(&style, 2);
lv_style_set_border_color(&style, LV_COLOR_GRAY); lv_style_set_border_color(&style, lv_color_grey());
lv_style_set_shadow_width(&style, 8); lv_style_set_shadow_width(&style, 8);
lv_style_set_shadow_color(&style, LV_COLOR_GRAY); lv_style_set_shadow_color(&style, lv_color_grey());
lv_style_set_shadow_ofs_x(&style, 8); lv_style_set_shadow_ofs_x(&style, 8);
lv_style_set_shadow_ofs_y(&style, 8); lv_style_set_shadow_ofs_y(&style, 8);
lv_style_set_text_color(&style, LV_COLOR_WHITE); lv_style_set_text_color(&style, lv_color_white());
/*Init the pressed style*/ /*Init the pressed style*/
lv_style_set_shadow_ofs_x(&style_pr, 4); lv_style_set_shadow_ofs_x(&style_pr, 4);
@@ -10,21 +10,21 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
/*Change the draw descriptor the 2nd button */ /*Change the draw descriptor the 2nd button */
if(dsc->id == 1) { if(dsc->id == 1) {
dsc->rect_dsc->radius = 0; dsc->rect_dsc->radius = 0;
if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = LV_COLOR_NAVY; if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_blue_darken_3();
else dsc->rect_dsc->bg_color = LV_COLOR_BLUE; else dsc->rect_dsc->bg_color = lv_color_blue();
dsc->rect_dsc->shadow_width = 6; dsc->rect_dsc->shadow_width = 6;
dsc->rect_dsc->shadow_ofs_x = 3; dsc->rect_dsc->shadow_ofs_x = 3;
dsc->rect_dsc->shadow_ofs_y = 3; dsc->rect_dsc->shadow_ofs_y = 3;
dsc->label_dsc->color = LV_COLOR_WHITE; dsc->label_dsc->color = lv_color_white();
} }
/*Change the draw descriptor the 3rd button */ /*Change the draw descriptor the 3rd button */
else if(dsc->id == 2) { else if(dsc->id == 2) {
dsc->rect_dsc->radius = LV_RADIUS_CIRCLE; dsc->rect_dsc->radius = LV_RADIUS_CIRCLE;
if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = LV_COLOR_MAROON; if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) dsc->rect_dsc->bg_color = lv_color_red_darken_3();
else dsc->rect_dsc->bg_color = LV_COLOR_RED; else dsc->rect_dsc->bg_color = lv_color_red();
dsc->label_dsc->color = LV_COLOR_WHITE; dsc->label_dsc->color = lv_color_white();
} }
else if(dsc->id == 3) { else if(dsc->id == 3) {
dsc->label_dsc->opa = LV_OPA_TRANSP; /*Hide the text if any*/ dsc->label_dsc->opa = LV_OPA_TRANSP; /*Hide the text if any*/
@@ -49,7 +49,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
lv_draw_img_dsc_t img_draw_dsc; lv_draw_img_dsc_t img_draw_dsc;
lv_draw_img_dsc_init(&img_draw_dsc); lv_draw_img_dsc_init(&img_draw_dsc);
img_draw_dsc.recolor = LV_COLOR_BLACK; img_draw_dsc.recolor = lv_color_black();
if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) img_draw_dsc.recolor_opa = LV_OPA_30; if(lv_btnmatrix_get_pressed_btn(obj) == dsc->id) img_draw_dsc.recolor_opa = LV_OPA_30;
lv_draw_img(&a, dsc->clip_area, &img_star, &img_draw_dsc); lv_draw_img(&a, dsc->clip_area, &img_star, &img_draw_dsc);
@@ -41,7 +41,7 @@ void lv_example_btnmatrix_3(void)
lv_style_set_radius(&style_btn, 0); lv_style_set_radius(&style_btn, 0);
lv_style_set_border_width(&style_btn, 1); lv_style_set_border_width(&style_btn, 1);
lv_style_set_border_opa(&style_btn, LV_OPA_50); lv_style_set_border_opa(&style_btn, LV_OPA_50);
lv_style_set_border_color(&style_btn, LV_COLOR_GRAY); lv_style_set_border_color(&style_btn, lv_color_grey());
lv_style_set_border_side(&style_btn, LV_BORDER_SIDE_INTERNAL); lv_style_set_border_side(&style_btn, LV_BORDER_SIDE_INTERNAL);
lv_style_set_radius(&style_btn, 0); lv_style_set_radius(&style_btn, 0);
@@ -12,25 +12,25 @@ void lv_example_canvas_1(void)
rect_dsc.radius = 10; rect_dsc.radius = 10;
rect_dsc.bg_opa = LV_OPA_COVER; rect_dsc.bg_opa = LV_OPA_COVER;
rect_dsc.bg_grad_dir = LV_GRAD_DIR_HOR; rect_dsc.bg_grad_dir = LV_GRAD_DIR_HOR;
rect_dsc.bg_color = LV_COLOR_RED; rect_dsc.bg_color = lv_color_red();
rect_dsc.bg_grad_color = LV_COLOR_BLUE; rect_dsc.bg_grad_color = lv_color_blue();
rect_dsc.border_width = 2; rect_dsc.border_width = 2;
rect_dsc.border_opa = LV_OPA_90; rect_dsc.border_opa = LV_OPA_90;
rect_dsc.border_color = LV_COLOR_WHITE; rect_dsc.border_color = lv_color_white();
rect_dsc.shadow_width = 5; rect_dsc.shadow_width = 5;
rect_dsc.shadow_ofs_x = 5; rect_dsc.shadow_ofs_x = 5;
rect_dsc.shadow_ofs_y = 5; rect_dsc.shadow_ofs_y = 5;
lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc); lv_draw_label_dsc_init(&label_dsc);
label_dsc.color = LV_COLOR_YELLOW; label_dsc.color = lv_color_yellow();
static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)]; static lv_color_t cbuf[LV_CANVAS_BUF_SIZE_TRUE_COLOR(CANVAS_WIDTH, CANVAS_HEIGHT)];
lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL); lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL);
lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR); lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_TRUE_COLOR);
lv_obj_align(canvas, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(canvas, NULL, LV_ALIGN_CENTER, 0, 0);
lv_canvas_fill_bg(canvas, LV_COLOR_SILVER, LV_OPA_COVER); lv_canvas_fill_bg(canvas, lv_color_grey_lighten_3(), LV_OPA_COVER);
lv_canvas_draw_rect(canvas, 70, 60, 100, 70, &rect_dsc); lv_canvas_draw_rect(canvas, 70, 60, 100, 70, &rect_dsc);
@@ -46,7 +46,7 @@ void lv_example_canvas_1(void)
img.header.w = CANVAS_WIDTH; img.header.w = CANVAS_WIDTH;
img.header.h = CANVAS_HEIGHT; img.header.h = CANVAS_HEIGHT;
lv_canvas_fill_bg(canvas, LV_COLOR_SILVER, LV_OPA_COVER); lv_canvas_fill_bg(canvas, lv_color_grey_lighten_3(), LV_OPA_COVER);
lv_canvas_transform(canvas, &img, 30, LV_IMG_ZOOM_NONE, 0, 0, CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2, true); lv_canvas_transform(canvas, &img, 30, LV_IMG_ZOOM_NONE, 0, 0, CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2, true);
} }
@@ -19,7 +19,7 @@ void lv_example_canvas_2(void)
lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL); lv_obj_t * canvas = lv_canvas_create(lv_scr_act(), NULL);
lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_INDEXED_1BIT); lv_canvas_set_buffer(canvas, cbuf, CANVAS_WIDTH, CANVAS_HEIGHT, LV_IMG_CF_INDEXED_1BIT);
lv_canvas_set_palette(canvas, 0, LV_COLOR_CHROMA_KEY); lv_canvas_set_palette(canvas, 0, LV_COLOR_CHROMA_KEY);
lv_canvas_set_palette(canvas, 1, LV_COLOR_RED); lv_canvas_set_palette(canvas, 1, lv_color_red());
/*Create colors with the indices of the palette*/ /*Create colors with the indices of the palette*/
lv_color_t c0; lv_color_t c0;
+2 -2
View File
@@ -11,8 +11,8 @@ void lv_example_chart_1(void)
lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/ lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
/*Add two data series*/ /*Add two data series*/
lv_chart_series_t * ser1 = lv_chart_add_series(chart, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y);
lv_chart_series_t * ser2 = lv_chart_add_series(chart, LV_COLOR_GREEN, LV_CHART_AXIS_SECONDARY_Y); lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_color_green(), LV_CHART_AXIS_SECONDARY_Y);
/*Set the next points on 'ser1'*/ /*Set the next points on 'ser1'*/
lv_chart_set_next_value(chart, ser1, 10); lv_chart_set_next_value(chart, ser1, 10);
+2 -2
View File
@@ -68,8 +68,8 @@ void lv_example_chart_2(void)
lv_obj_add_event_cb(chart1, event_cb, NULL); lv_obj_add_event_cb(chart1, event_cb, NULL);
/*Add two data series*/ /*Add two data series*/
ser1 = lv_chart_add_series(chart1, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); ser1 = lv_chart_add_series(chart1, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y);
ser2 = lv_chart_add_series(chart1, LV_COLOR_BLUE, LV_CHART_AXIS_SECONDARY_Y); ser2 = lv_chart_add_series(chart1, lv_color_blue(), LV_CHART_AXIS_SECONDARY_Y);
uint32_t i; uint32_t i;
for(i = 0; i < 10; i++) { for(i = 0; i < 10; i++) {
+2 -2
View File
@@ -38,8 +38,8 @@ void lv_example_chart_3(void)
lv_chart_set_zoom_x(chart, 800); lv_chart_set_zoom_x(chart, 800);
/*Add two data series*/ /*Add two data series*/
lv_chart_series_t * ser1 = lv_chart_add_series(chart, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_color_green_lighten_2(), LV_CHART_AXIS_PRIMARY_Y);
lv_chart_series_t * ser2 = lv_chart_add_series(chart, LV_COLOR_GREEN, LV_CHART_AXIS_SECONDARY_Y); lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_color_green_darken_2(), LV_CHART_AXIS_SECONDARY_Y);
/*Set the next points on 'ser1'*/ /*Set the next points on 'ser1'*/
lv_chart_set_next_value(chart, ser1, 31); lv_chart_set_next_value(chart, ser1, 31);
+4 -4
View File
@@ -30,11 +30,11 @@ static void event_cb(lv_obj_t * chart, lv_event_t e)
lv_draw_rect_dsc_t draw_rect_dsc; lv_draw_rect_dsc_t draw_rect_dsc;
lv_draw_rect_dsc_init(&draw_rect_dsc); lv_draw_rect_dsc_init(&draw_rect_dsc);
draw_rect_dsc.bg_color = LV_COLOR_BLACK; draw_rect_dsc.bg_color = lv_color_black();
draw_rect_dsc.bg_opa = LV_OPA_50; draw_rect_dsc.bg_opa = LV_OPA_50;
draw_rect_dsc.radius = 3; draw_rect_dsc.radius = 3;
draw_rect_dsc.content_text = buf; draw_rect_dsc.content_text = buf;
draw_rect_dsc.content_color = LV_COLOR_WHITE; draw_rect_dsc.content_color = lv_color_white();
lv_area_t a; lv_area_t a;
a.x1 = chart->coords.x1 + p.x - 20; a.x1 = chart->coords.x1 + p.x - 20;
@@ -68,8 +68,8 @@ void lv_example_chart_4(void)
lv_chart_set_zoom_x(chart, 800); lv_chart_set_zoom_x(chart, 800);
/*Add two data series*/ /*Add two data series*/
lv_chart_series_t * ser1 = lv_chart_add_series(chart, LV_COLOR_RED, LV_CHART_AXIS_PRIMARY_Y); lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_color_red(), LV_CHART_AXIS_PRIMARY_Y);
lv_chart_series_t * ser2 = lv_chart_add_series(chart, LV_COLOR_GREEN, LV_CHART_AXIS_PRIMARY_Y); lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_color_green(), LV_CHART_AXIS_PRIMARY_Y);
uint32_t i; uint32_t i;
for(i = 0; i < 10; i++) { for(i = 0; i < 10; i++) {
lv_chart_set_next_value(chart, ser1, lv_rand(60,90)); lv_chart_set_next_value(chart, ser1, lv_rand(60,90));
+4 -4
View File
@@ -14,10 +14,10 @@ static lv_obj_t * img1;
void lv_example_img_2(void) void lv_example_img_2(void)
{ {
/*Create 4 sliders to adjust RGB color and re-color intensity*/ /*Create 4 sliders to adjust RGB color and re-color intensity*/
red_slider = create_slider(LV_COLOR_RED); red_slider = create_slider(lv_color_red());
green_slider = create_slider(LV_COLOR_LIME); green_slider = create_slider(lv_color_green());
blue_slider = create_slider(LV_COLOR_BLUE); blue_slider = create_slider(lv_color_blue());
intense_slider = create_slider(LV_COLOR_GRAY); intense_slider = create_slider(lv_color_grey());
lv_slider_set_value(red_slider, LV_OPA_20, LV_ANIM_OFF); lv_slider_set_value(red_slider, LV_OPA_20, LV_ANIM_OFF);
lv_slider_set_value(green_slider, LV_OPA_90, LV_ANIM_OFF); lv_slider_set_value(green_slider, LV_OPA_90, LV_ANIM_OFF);
+2 -2
View File
@@ -15,10 +15,10 @@ void lv_example_img_4(void)
static lv_style_t style; static lv_style_t style;
lv_style_init(&style); lv_style_init(&style);
lv_style_set_bg_color(&style, LV_COLOR_YELLOW); lv_style_set_bg_color(&style, lv_color_yellow());
lv_style_set_bg_opa(&style, LV_OPA_COVER); lv_style_set_bg_opa(&style, LV_OPA_COVER);
lv_style_set_img_recolor_opa(&style, LV_OPA_COVER); lv_style_set_img_recolor_opa(&style, LV_OPA_COVER);
lv_style_set_img_recolor(&style, LV_COLOR_BLACK); lv_style_set_img_recolor(&style, lv_color_black());
lv_obj_t * img = lv_img_create(lv_scr_act(), NULL); lv_obj_t * img = lv_img_create(lv_scr_act(), NULL);
lv_obj_add_style(img, LV_PART_MAIN, LV_STATE_DEFAULT, &style); lv_obj_add_style(img, LV_PART_MAIN, LV_STATE_DEFAULT, &style);
@@ -14,14 +14,14 @@ void lv_example_imgbtn_1(void)
static lv_style_t style_def; static lv_style_t style_def;
lv_style_init(&style_def); lv_style_init(&style_def);
lv_style_set_text_color(&style_def, LV_COLOR_WHITE); lv_style_set_text_color(&style_def, lv_color_white());
lv_style_set_transition(&style_def, &tr); lv_style_set_transition(&style_def, &tr);
/*Darken the button when pressed and make it wider*/ /*Darken the button when pressed and make it wider*/
static lv_style_t style_pr; static lv_style_t style_pr;
lv_style_init(&style_pr); lv_style_init(&style_pr);
lv_style_set_img_recolor_opa(&style_pr, LV_OPA_30); lv_style_set_img_recolor_opa(&style_pr, LV_OPA_30);
lv_style_set_img_recolor(&style_pr, LV_COLOR_BLACK); lv_style_set_img_recolor(&style_pr, lv_color_black());
lv_style_set_transform_width(&style_pr, 20); lv_style_set_transform_width(&style_pr, 20);
/*Create an image button*/ /*Create an image button*/
+1 -1
View File
@@ -10,7 +10,7 @@ void lv_example_label_2(void)
static lv_style_t style_shadow; static lv_style_t style_shadow;
lv_style_init(&style_shadow); lv_style_init(&style_shadow);
lv_style_set_text_opa(&style_shadow, LV_OPA_30); lv_style_set_text_opa(&style_shadow, LV_OPA_30);
lv_style_set_text_color(&style_shadow, LV_COLOR_BLACK); lv_style_set_text_color(&style_shadow, lv_color_black());
/*Create a label for the shadow first (it's in the background) */ /*Create a label for the shadow first (it's in the background) */
lv_obj_t * shadow_label = lv_label_create(lv_scr_act(), NULL); lv_obj_t * shadow_label = lv_label_create(lv_scr_act(), NULL);
+1 -1
View File
@@ -15,7 +15,7 @@ void lv_example_led_1(void)
lv_obj_t * led2 = lv_led_create(lv_scr_act()); lv_obj_t * led2 = lv_led_create(lv_scr_act());
lv_obj_align(led2, NULL, LV_ALIGN_CENTER, 0, 0); lv_obj_align(led2, NULL, LV_ALIGN_CENTER, 0, 0);
lv_led_set_brightness(led2, 150); lv_led_set_brightness(led2, 150);
lv_led_set_color(led2, LV_COLOR_RED); lv_led_set_color(led2, lv_color_red());
/*Copy the previous LED and switch it ON*/ /*Copy the previous LED and switch it ON*/
lv_obj_t * led3 = lv_led_create(lv_scr_act()); lv_obj_t * led3 = lv_led_create(lv_scr_act());
+1 -1
View File
@@ -10,7 +10,7 @@ void lv_example_line_1(void)
static lv_style_t style_line; static lv_style_t style_line;
lv_style_init(&style_line); lv_style_init(&style_line);
lv_style_set_line_width(&style_line, 8); lv_style_set_line_width(&style_line, 8);
lv_style_set_line_color(&style_line, LV_COLOR_BLUE); lv_style_set_line_color(&style_line, lv_color_blue());
lv_style_set_line_rounded(&style_line, true); lv_style_set_line_rounded(&style_line, true);
/*Create a line and apply the new style*/ /*Create a line and apply the new style*/
+5 -5
View File
@@ -18,23 +18,23 @@ void lv_example_meter_1(void)
/*Add a scale first*/ /*Add a scale first*/
lv_meter_scale_t * scale = lv_meter_add_scale(meter); lv_meter_scale_t * scale = lv_meter_add_scale(meter);
lv_meter_set_scale_ticks(meter, scale, 51, 2, 10, LV_COLOR_GRAY); lv_meter_set_scale_ticks(meter, scale, 51, 2, 10, lv_color_grey());
lv_meter_set_scale_major_ticks(meter, scale, 10, 4, 15, LV_COLOR_BLACK, 10); lv_meter_set_scale_major_ticks(meter, scale, 10, 4, 15, lv_color_black(), 10);
lv_meter_indicator_t * indic; lv_meter_indicator_t * indic;
/*Add a red arc to the end */ /*Add a red arc to the end */
indic = lv_meter_add_arc(meter, scale, 3, LV_COLOR_RED, 1); indic = lv_meter_add_arc(meter, scale, 3, lv_color_red(), 1);
lv_meter_set_indicator_start_value(meter, indic, 80); lv_meter_set_indicator_start_value(meter, indic, 80);
lv_meter_set_indicator_end_value(meter, indic, 100); lv_meter_set_indicator_end_value(meter, indic, 100);
/*Make the tick lines red at the end of the scale*/ /*Make the tick lines red at the end of the scale*/
indic = lv_meter_add_scale_lines(meter, scale, LV_COLOR_RED, LV_COLOR_RED, false, 0); indic = lv_meter_add_scale_lines(meter, scale, lv_color_red(), lv_color_red(), false, 0);
lv_meter_set_indicator_start_value(meter, indic, 80); lv_meter_set_indicator_start_value(meter, indic, 80);
lv_meter_set_indicator_end_value(meter, indic, 100); lv_meter_set_indicator_end_value(meter, indic, 100);
/*Add a needle line indicator*/ /*Add a needle line indicator*/
indic = lv_meter_add_needle_line(meter, scale, 4, LV_COLOR_GRAY, -10); indic = lv_meter_add_needle_line(meter, scale, 4, lv_color_grey(), -10);
/*Create an animation to set the value*/ /*Create an animation to set the value*/
lv_anim_t a; lv_anim_t a;
+4 -4
View File
@@ -22,14 +22,14 @@ void lv_example_meter_2(void)
/*Add a scale first*/ /*Add a scale first*/
lv_meter_scale_t * scale = lv_meter_add_scale(meter); lv_meter_scale_t * scale = lv_meter_add_scale(meter);
lv_meter_set_scale_ticks(meter, scale, 11, 2, 10, LV_COLOR_GRAY); lv_meter_set_scale_ticks(meter, scale, 11, 2, 10, lv_color_grey());
lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 10); lv_meter_set_scale_major_ticks(meter, scale, 1, 2, 30, lv_color_hex3(0xeee), 10);
lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90); lv_meter_set_scale_range(meter, scale, 0, 100, 270, 90);
/*Add a three arc indicator */ /*Add a three arc indicator */
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, LV_COLOR_RED, 0); lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, 10, lv_color_red(), 0);
lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, LV_COLOR_GREEN, -10); lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, 10, lv_color_green(), -10);
lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, LV_COLOR_BLUE, -20); lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, 10, lv_color_blue(), -20);
/*Create an animation to set the value*/ /*Create an animation to set the value*/
lv_anim_t a; lv_anim_t a;
+3 -3
View File
@@ -20,13 +20,13 @@ void lv_example_meter_3(void)
/*Create a scale for the minutes*/ /*Create a scale for the minutes*/
/*61 ticks in a 360 degrees range (the last and the first line overlaps)*/ /*61 ticks in a 360 degrees range (the last and the first line overlaps)*/
lv_meter_scale_t * scale_min = lv_meter_add_scale(meter); lv_meter_scale_t * scale_min = lv_meter_add_scale(meter);
lv_meter_set_scale_ticks(meter, scale_min, 61, 1, 10, LV_COLOR_GRAY); lv_meter_set_scale_ticks(meter, scale_min, 61, 1, 10, lv_color_grey());
lv_meter_set_scale_range(meter, scale_min, 0, 60, 360, 270); lv_meter_set_scale_range(meter, scale_min, 0, 60, 360, 270);
/*Create an other scale for the hours. It's only visual and contains only major ticks*/ /*Create an other scale for the hours. It's only visual and contains only major ticks*/
lv_meter_scale_t * scale_hour = lv_meter_add_scale(meter); lv_meter_scale_t * scale_hour = lv_meter_add_scale(meter);
lv_meter_set_scale_ticks(meter, scale_hour, 12, 0, 0, LV_COLOR_GRAY); /*12 ticks*/ lv_meter_set_scale_ticks(meter, scale_hour, 12, 0, 0, lv_color_grey()); /*12 ticks*/
lv_meter_set_scale_major_ticks(meter, scale_hour, 1, 2, 20, LV_COLOR_BLACK, 10); /*Every tick is major*/ lv_meter_set_scale_major_ticks(meter, scale_hour, 1, 2, 20, lv_color_black(), 10); /*Every tick is major*/
lv_meter_set_scale_range(meter, scale_hour, 1, 12, 330, 300); /*[1..12] values in an almost full circle*/ lv_meter_set_scale_range(meter, scale_hour, 1, 12, 330, 300); /*[1..12] values in an almost full circle*/
LV_IMG_DECLARE(img_hand) LV_IMG_DECLARE(img_hand)
+4 -4
View File
@@ -15,20 +15,20 @@ void lv_example_meter_4(void)
/*Add a scale first with no ticks.*/ /*Add a scale first with no ticks.*/
lv_meter_scale_t * scale = lv_meter_add_scale(meter); lv_meter_scale_t * scale = lv_meter_add_scale(meter);
lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, LV_COLOR_BLACK); lv_meter_set_scale_ticks(meter, scale, 0, 0, 0, lv_color_black());
lv_meter_set_scale_range(meter, scale, 0, 100, 360, 0); lv_meter_set_scale_range(meter, scale, 0, 100, 360, 0);
/*Add a three arc indicator */ /*Add a three arc indicator */
lv_coord_t indic_w = lv_obj_get_width(meter) / 2; lv_coord_t indic_w = lv_obj_get_width(meter) / 2;
lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, LV_COLOR_ORANGE, 0); lv_meter_indicator_t * indic1 = lv_meter_add_arc(meter, scale, indic_w, lv_color_orange(), 0);
lv_meter_set_indicator_start_value(meter, indic1, 0); lv_meter_set_indicator_start_value(meter, indic1, 0);
lv_meter_set_indicator_end_value(meter, indic1, 40); lv_meter_set_indicator_end_value(meter, indic1, 40);
lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, indic_w, LV_COLOR_GREEN, 0); lv_meter_indicator_t * indic2 = lv_meter_add_arc(meter, scale, indic_w, lv_color_green(), 0);
lv_meter_set_indicator_start_value(meter, indic2, 40); /*Start from the previous*/ lv_meter_set_indicator_start_value(meter, indic2, 40); /*Start from the previous*/
lv_meter_set_indicator_end_value(meter, indic2, 80); lv_meter_set_indicator_end_value(meter, indic2, 80);
lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, indic_w, LV_COLOR_BLUE, 0); lv_meter_indicator_t * indic3 = lv_meter_add_arc(meter, scale, indic_w, lv_color_blue(), 0);
lv_meter_set_indicator_start_value(meter, indic3, 80); /*Start from the previous*/ lv_meter_set_indicator_start_value(meter, indic3, 80); /*Start from the previous*/
lv_meter_set_indicator_end_value(meter, indic3, 100); lv_meter_set_indicator_end_value(meter, indic3, 100);
} }
+1 -1
View File
@@ -12,7 +12,7 @@ void lv_example_obj_1(void)
lv_style_init(&style_shadow); lv_style_init(&style_shadow);
lv_style_set_shadow_width(&style_shadow, 10); lv_style_set_shadow_width(&style_shadow, 10);
lv_style_set_shadow_spread(&style_shadow, 5); lv_style_set_shadow_spread(&style_shadow, 5);
lv_style_set_shadow_color(&style_shadow, LV_COLOR_BLUE); lv_style_set_shadow_color(&style_shadow, lv_color_blue());
lv_obj_t * obj3; lv_obj_t * obj3;
obj3 = lv_obj_create(lv_scr_act(), NULL); obj3 = lv_obj_create(lv_scr_act(), NULL);
@@ -21,7 +21,7 @@ void lv_example_slider_3(void)
/*Now use only a local style.*/ /*Now use only a local style.*/
lv_obj_set_style_content_ofs_y(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, -20); lv_obj_set_style_content_ofs_y(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, -20);
lv_obj_set_style_content_color(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, LV_COLOR_GRAY); lv_obj_set_style_content_color(slider, LV_PART_INDICATOR, LV_STATE_DEFAULT, lv_color_grey_darken_3());
/*To update the value text*/ /*To update the value text*/
lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL); lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
+2 -2
View File
@@ -13,7 +13,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
/*Make the texts in the first cell center aligned*/ /*Make the texts in the first cell center aligned*/
if(row == 0) { if(row == 0) {
hook_dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER; hook_dsc->label_dsc->align = LV_TEXT_ALIGN_CENTER;
hook_dsc->rect_dsc->bg_color = lv_color_mix(LV_COLOR_BLUE, hook_dsc->rect_dsc->bg_color, LV_OPA_20); hook_dsc->rect_dsc->bg_color = lv_color_mix(lv_color_blue(), hook_dsc->rect_dsc->bg_color, LV_OPA_20);
hook_dsc->rect_dsc->bg_opa = LV_OPA_COVER; hook_dsc->rect_dsc->bg_opa = LV_OPA_COVER;
} }
/*In the first column align the texts to the right*/ /*In the first column align the texts to the right*/
@@ -23,7 +23,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
/*MAke every 2nd row grayish*/ /*MAke every 2nd row grayish*/
if((row != 0 && row % 2) == 0) { if((row != 0 && row % 2) == 0) {
hook_dsc->rect_dsc->bg_color = lv_color_mix(LV_COLOR_GRAY, hook_dsc->rect_dsc->bg_color, LV_OPA_10); hook_dsc->rect_dsc->bg_color = lv_color_mix(lv_color_grey(), hook_dsc->rect_dsc->bg_color, LV_OPA_10);
hook_dsc->rect_dsc->bg_opa = LV_OPA_COVER; hook_dsc->rect_dsc->bg_opa = LV_OPA_COVER;
} }
} }
+13 -13
View File
@@ -25,7 +25,7 @@
/*SCREEN*/ /*SCREEN*/
//#define COLOR_SCR (IS_LIGHT ? lv_color_hex(0xf5f8fa) : lv_color_hex(0x444b5a)) //#define COLOR_SCR (IS_LIGHT ? lv_color_hex(0xf5f8fa) : lv_color_hex(0x444b5a))
#define COLOR_SCR (IS_LIGHT ? lv_color_hex(0xf3f6f7) : lv_color_hex(0x444b5a)) #define COLOR_SCR (IS_LIGHT ? lv_color_blue_grey_lighten_5() : lv_color_hex(0x444b5a))
#define COLOR_SCR_TEXT (IS_LIGHT ? lv_color_hex(0x3b3e42) : lv_color_hex(0xe7e9ec)) #define COLOR_SCR_TEXT (IS_LIGHT ? lv_color_hex(0x3b3e42) : lv_color_hex(0xe7e9ec))
/*BUTTON*/ /*BUTTON*/
@@ -312,14 +312,14 @@ static void style_init(void)
style_init_reset(&styles->bg_color_primary); style_init_reset(&styles->bg_color_primary);
lv_style_set_bg_color(&styles->bg_color_primary, theme.color_primary); lv_style_set_bg_color(&styles->bg_color_primary, theme.color_primary);
lv_style_set_text_color(&styles->bg_color_primary, LV_COLOR_WHITE); lv_style_set_text_color(&styles->bg_color_primary, lv_color_white());
lv_style_set_content_color(&styles->bg_color_primary, LV_COLOR_WHITE); lv_style_set_content_color(&styles->bg_color_primary, lv_color_white());
lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER); lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER);
style_init_reset(&styles->bg_color_secondary); style_init_reset(&styles->bg_color_secondary);
lv_style_set_bg_color(&styles->bg_color_secondary, theme.color_secondary); lv_style_set_bg_color(&styles->bg_color_secondary, theme.color_secondary);
lv_style_set_text_color(&styles->bg_color_secondary, LV_COLOR_WHITE); lv_style_set_text_color(&styles->bg_color_secondary, lv_color_white());
lv_style_set_content_color(&styles->bg_color_secondary, LV_COLOR_WHITE); lv_style_set_content_color(&styles->bg_color_secondary, lv_color_white());
lv_style_set_bg_opa(&styles->bg_color_secondary, LV_OPA_COVER); lv_style_set_bg_opa(&styles->bg_color_secondary, LV_OPA_COVER);
style_init_reset(&styles->bg_color_gray); style_init_reset(&styles->bg_color_gray);
@@ -329,7 +329,7 @@ static void style_init(void)
lv_style_set_content_color(&styles->bg_color_gray, CARD_TEXT_COLOR); lv_style_set_content_color(&styles->bg_color_gray, CARD_TEXT_COLOR);
style_init_reset(&styles->bg_color_panel); style_init_reset(&styles->bg_color_panel);
lv_style_set_bg_color(&styles->bg_color_panel, LV_COLOR_WHITE); lv_style_set_bg_color(&styles->bg_color_panel, lv_color_white());
lv_style_set_bg_opa(&styles->bg_color_panel, LV_OPA_COVER); lv_style_set_bg_opa(&styles->bg_color_panel, LV_OPA_COVER);
lv_style_set_text_color(&styles->bg_color_panel, CARD_TEXT_COLOR); lv_style_set_text_color(&styles->bg_color_panel, CARD_TEXT_COLOR);
lv_style_set_content_color(&styles->bg_color_panel, CARD_TEXT_COLOR); lv_style_set_content_color(&styles->bg_color_panel, CARD_TEXT_COLOR);
@@ -347,7 +347,7 @@ static void style_init(void)
#endif #endif
style_init_reset(&styles->knob); style_init_reset(&styles->knob);
lv_style_set_bg_color(&styles->knob, IS_LIGHT ? theme.color_primary : LV_COLOR_WHITE); lv_style_set_bg_color(&styles->knob, IS_LIGHT ? theme.color_primary : lv_color_white());
lv_style_set_bg_opa(&styles->knob, LV_OPA_COVER); lv_style_set_bg_opa(&styles->knob, LV_OPA_COVER);
lv_style_set_pad_all(&styles->knob, LV_DPX(5)); lv_style_set_pad_all(&styles->knob, LV_DPX(5));
lv_style_set_radius(&styles->knob, LV_RADIUS_CIRCLE); lv_style_set_radius(&styles->knob, LV_RADIUS_CIRCLE);
@@ -375,13 +375,13 @@ static void style_init(void)
lv_style_set_pad_all(&styles->cb_marker, LV_DPX(3)); lv_style_set_pad_all(&styles->cb_marker, LV_DPX(3));
lv_style_set_border_width(&styles->cb_marker, BORDER_WIDTH); lv_style_set_border_width(&styles->cb_marker, BORDER_WIDTH);
lv_style_set_border_color(&styles->cb_marker, theme.color_primary); lv_style_set_border_color(&styles->cb_marker, theme.color_primary);
lv_style_set_bg_color(&styles->cb_marker, LV_COLOR_WHITE); lv_style_set_bg_color(&styles->cb_marker, lv_color_white());
lv_style_set_bg_opa(&styles->cb_marker, LV_OPA_COVER); lv_style_set_bg_opa(&styles->cb_marker, LV_OPA_COVER);
lv_style_set_radius(&styles->cb_marker, RADIUS_DEFAULT / 2); lv_style_set_radius(&styles->cb_marker, RADIUS_DEFAULT / 2);
style_init_reset(&styles->cb_marker_checked); style_init_reset(&styles->cb_marker_checked);
lv_style_set_content_text(&styles->cb_marker_checked, LV_SYMBOL_OK); lv_style_set_content_text(&styles->cb_marker_checked, LV_SYMBOL_OK);
lv_style_set_content_color(&styles->cb_marker_checked, LV_COLOR_WHITE); lv_style_set_content_color(&styles->cb_marker_checked, lv_color_white());
lv_style_set_content_font(&styles->cb_marker_checked, theme.font_small); lv_style_set_content_font(&styles->cb_marker_checked, theme.font_small);
style_init_reset(&styles->cb_bg_outline_pad); style_init_reset(&styles->cb_bg_outline_pad);
@@ -478,11 +478,11 @@ static void style_init(void)
#if LV_USE_LED #if LV_USE_LED
lv_style_init(&styles->led); lv_style_init(&styles->led);
lv_style_set_bg_opa(&styles->led, LV_OPA_COVER); lv_style_set_bg_opa(&styles->led, LV_OPA_COVER);
lv_style_set_bg_color(&styles->led, LV_COLOR_WHITE); lv_style_set_bg_color(&styles->led, lv_color_white());
lv_style_set_bg_grad_color(&styles->led, LV_COLOR_GRAY); lv_style_set_bg_grad_color(&styles->led, lv_color_grey());
lv_style_set_radius(&styles->led, LV_RADIUS_CIRCLE); lv_style_set_radius(&styles->led, LV_RADIUS_CIRCLE);
lv_style_set_shadow_width(&styles->led, LV_DPX(15)); lv_style_set_shadow_width(&styles->led, LV_DPX(15));
lv_style_set_shadow_color(&styles->led, LV_COLOR_WHITE); lv_style_set_shadow_color(&styles->led, lv_color_white());
lv_style_set_shadow_spread(&styles->led, LV_DPX(5)); lv_style_set_shadow_spread(&styles->led, LV_DPX(5));
#endif #endif
} }
@@ -880,7 +880,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
static lv_color_t gray_filter(lv_color_t color, lv_opa_t opa) static lv_color_t gray_filter(lv_color_t color, lv_opa_t opa)
{ {
return lv_color_mix(LV_COLOR_SILVER, color, opa); return lv_color_mix(lv_color_grey_lighten_2(), color, opa);
} }
static void style_init_reset(lv_style_t * style) static void style_init_reset(lv_style_t * style)
{ {
+1 -1
View File
@@ -267,7 +267,7 @@ static void draw_event_cb(lv_obj_t * obj, lv_event_t e)
else if(lv_btnmatrix_has_btn_ctrl(obj, hook_dsc->id, LV_BTNMATRIX_CTRL_DISABLED)) { else if(lv_btnmatrix_has_btn_ctrl(obj, hook_dsc->id, LV_BTNMATRIX_CTRL_DISABLED)) {
hook_dsc->rect_dsc->bg_opa = LV_OPA_TRANSP; hook_dsc->rect_dsc->bg_opa = LV_OPA_TRANSP;
hook_dsc->rect_dsc->border_opa = LV_OPA_TRANSP; hook_dsc->rect_dsc->border_opa = LV_OPA_TRANSP;
hook_dsc->label_dsc->color = LV_COLOR_GRAY; hook_dsc->label_dsc->color = lv_color_grey();
} }
if(lv_btnmatrix_has_btn_ctrl(obj, hook_dsc->id, LV_CALENDAR_CTRL_HIGHLIGHT)) { if(lv_btnmatrix_has_btn_ctrl(obj, hook_dsc->id, LV_CALENDAR_CTRL_HIGHLIGHT)) {
+10 -10
View File
@@ -175,18 +175,18 @@ static lv_draw_res_t lv_led_draw(lv_obj_t * obj, const lv_area_t * clip_area, lv
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &rect_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &rect_dsc);
/*Use the original colors brightness to modify color->led*/ /*Use the original colors brightness to modify color->led*/
rect_dsc.bg_color = lv_color_mix(led->color, LV_COLOR_BLACK, lv_color_brightness(rect_dsc.bg_color)); rect_dsc.bg_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.bg_color));
rect_dsc.bg_grad_color = lv_color_mix(led->color, LV_COLOR_BLACK, lv_color_brightness(rect_dsc.bg_grad_color)); rect_dsc.bg_grad_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.bg_grad_color));
rect_dsc.shadow_color = lv_color_mix(led->color, LV_COLOR_BLACK, lv_color_brightness(rect_dsc.shadow_color)); rect_dsc.shadow_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.shadow_color));
rect_dsc.border_color = lv_color_mix(led->color, LV_COLOR_BLACK, lv_color_brightness(rect_dsc.border_color)); rect_dsc.border_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.border_color));
rect_dsc.outline_color = lv_color_mix(led->color, LV_COLOR_BLACK, lv_color_brightness(rect_dsc.outline_color)); rect_dsc.outline_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.outline_color));
/*Mix. the color with black proportionally with brightness*/ /*Mix. the color with black proportionally with brightness*/
rect_dsc.bg_color = lv_color_mix(rect_dsc.bg_color, LV_COLOR_BLACK, led->bright); rect_dsc.bg_color = lv_color_mix(rect_dsc.bg_color, lv_color_black(), led->bright);
rect_dsc.bg_grad_color = lv_color_mix(rect_dsc.bg_grad_color, LV_COLOR_BLACK, led->bright); rect_dsc.bg_grad_color = lv_color_mix(rect_dsc.bg_grad_color, lv_color_black(), led->bright);
rect_dsc.border_color = lv_color_mix(rect_dsc.border_color, LV_COLOR_BLACK, led->bright); rect_dsc.border_color = lv_color_mix(rect_dsc.border_color, lv_color_black(), led->bright);
rect_dsc.shadow_color = lv_color_mix(rect_dsc.shadow_color, LV_COLOR_BLACK, led->bright); rect_dsc.shadow_color = lv_color_mix(rect_dsc.shadow_color, lv_color_black(), led->bright);
rect_dsc.outline_color = lv_color_mix(rect_dsc.outline_color, LV_COLOR_BLACK, led->bright); rect_dsc.outline_color = lv_color_mix(rect_dsc.outline_color, lv_color_black(), led->bright);
/*Set the current shadow width according to brightness proportionally between LV_LED_BRIGHT_OFF /*Set the current shadow width according to brightness proportionally between LV_LED_BRIGHT_OFF
* and LV_LED_BRIGHT_ON*/ * and LV_LED_BRIGHT_ON*/
+1 -1
View File
@@ -49,7 +49,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b
lv_obj_set_size(parent, LV_SIZE_PCT(100), LV_SIZE_PCT(100)); lv_obj_set_size(parent, LV_SIZE_PCT(100), LV_SIZE_PCT(100));
lv_obj_remove_style(parent, LV_PART_ANY, LV_STATE_ANY, NULL); lv_obj_remove_style(parent, LV_PART_ANY, LV_STATE_ANY, NULL);
lv_obj_set_style_bg_color(parent, LV_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); lv_obj_set_style_bg_color(parent, LV_PART_MAIN, LV_STATE_DEFAULT, lv_color_grey());
lv_obj_set_style_bg_opa(parent, LV_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); lv_obj_set_style_bg_opa(parent, LV_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50);
lv_obj_t * mbox = lv_obj_create_from_class(&lv_msgbox_class, parent, NULL); lv_obj_t * mbox = lv_obj_create_from_class(&lv_msgbox_class, parent, NULL);
+2 -2
View File
@@ -123,7 +123,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_proc_t * proc)
proc->types.pointer.scroll_throw_vect.y = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.y, st, sb); proc->types.pointer.scroll_throw_vect.y = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.y, st, sb);
_lv_obj_scroll_by_raw(scroll_obj, 0, proc->types.pointer.scroll_throw_vect.y); lv_obj_scroll_by(scroll_obj, 0, proc->types.pointer.scroll_throw_vect.y, LV_ANIM_OFF);
} }
/*With snapping find the nearest snap point and scroll there*/ /*With snapping find the nearest snap point and scroll there*/
else { else {
@@ -146,7 +146,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_proc_t * proc)
proc->types.pointer.scroll_throw_vect.x = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.x, sl ,sr); proc->types.pointer.scroll_throw_vect.x = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.x, sl ,sr);
_lv_obj_scroll_by_raw(scroll_obj, proc->types.pointer.scroll_throw_vect.x, 0); lv_obj_scroll_by(scroll_obj, proc->types.pointer.scroll_throw_vect.x, 0, LV_ANIM_OFF);
} }
/*With snapping find the nearest snap point and scroll there*/ /*With snapping find the nearest snap point and scroll there*/
else { else {
+19 -18
View File
@@ -32,6 +32,7 @@ void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_dif
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
static void scroll_x_anim(void * obj, int32_t v); static void scroll_x_anim(void * obj, int32_t v);
static void scroll_y_anim(void * obj, int32_t v); static void scroll_y_anim(void * obj, int32_t v);
static void scroll_anim_ready_cb(lv_anim_t * a); static void scroll_anim_ready_cb(lv_anim_t * a);
@@ -234,21 +235,6 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end)
* Other functions * Other functions
*====================*/ *====================*/
void _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
{
if(x == 0 && y == 0) return;
lv_obj_allocate_spec_attr(obj);
obj->spec_attr->scroll.x += x;
obj->spec_attr->scroll.y += y;
lv_obj_move_children_by(obj, x, y);
lv_res_t res = lv_signal_send(obj, LV_SIGNAL_SCROLL, NULL);
if(res != LV_RES_OK) return;
lv_obj_invalidate(obj);
}
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en) void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
{ {
if(x == 0 && y == 0) return; if(x == 0 && y == 0) return;
@@ -304,7 +290,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
/*Remove pending animations*/ /*Remove pending animations*/
lv_anim_del(obj, scroll_y_anim); lv_anim_del(obj, scroll_y_anim);
lv_anim_del(obj, scroll_x_anim); lv_anim_del(obj, scroll_x_anim);
_lv_obj_scroll_by_raw(obj, x, y); scroll_by_raw(obj, x, y);
} }
} }
@@ -557,15 +543,30 @@ void lv_obj_scrollbar_invalidate(lv_obj_t * obj)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static void scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
{
if(x == 0 && y == 0) return;
lv_obj_allocate_spec_attr(obj);
obj->spec_attr->scroll.x += x;
obj->spec_attr->scroll.y += y;
lv_obj_move_children_by(obj, x, y);
lv_res_t res = lv_signal_send(obj, LV_SIGNAL_SCROLL, NULL);
if(res != LV_RES_OK) return;
lv_obj_invalidate(obj);
}
static void scroll_x_anim(void * obj, int32_t v) static void scroll_x_anim(void * obj, int32_t v)
{ {
_lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0); scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0);
} }
static void scroll_y_anim(void * obj, int32_t v) static void scroll_y_anim(void * obj, int32_t v)
{ {
printf("scrl_anim %d\n", v); printf("scrl_anim %d\n", v);
_lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj)); scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
} }
static void scroll_anim_ready_cb(lv_anim_t * a) static void scroll_anim_ready_cb(lv_anim_t * a)
-10
View File
@@ -182,16 +182,6 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end);
* Other functions * Other functions
*====================*/ *====================*/
/**
* The most basic function to scroll by a given amount of pixels.
* Used internally.
* @param obj pointer to an object to scroll
* @param x pixels to scroll horizontally
* @param y pixels to scroll vertically
* @note > 0 value means scroll right/bottom (show the more content on the right/bottom)
*/
void _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
/** /**
* *
* Scroll by a given amount of pixels * Scroll by a given amount of pixels
+3 -3
View File
@@ -229,8 +229,8 @@ void _lv_disp_refr_task(lv_timer_t * tmr)
if(perf_label == NULL) { if(perf_label == NULL) {
perf_label = lv_label_create(lv_layer_sys(), NULL); perf_label = lv_label_create(lv_layer_sys(), NULL);
lv_obj_set_style_bg_opa(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); lv_obj_set_style_bg_opa(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_obj_set_style_bg_color(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_obj_set_style_bg_color(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, lv_color_black());
lv_obj_set_style_text_color(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_obj_set_style_text_color(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, lv_color_white());
lv_obj_set_style_pad_top(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_pad_top(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_pad_bottom(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_pad_bottom(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, 3);
lv_obj_set_style_pad_left(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_pad_left(perf_label, LV_PART_MAIN, LV_STATE_DEFAULT, 3);
@@ -646,7 +646,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
lv_event_send(obj, LV_EVENT_DRAW_MAIN_END, &obj_ext_mask); lv_event_send(obj, LV_EVENT_DRAW_MAIN_END, &obj_ext_mask);
#if MASK_AREA_DEBUG #if MASK_AREA_DEBUG
static lv_color_t debug_color = LV_COLOR_RED; static lv_color_t debug_color = lv_color_red();
lv_draw_rect_dsc_t draw_dsc; lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc); lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_color.full = debug_color.full; draw_dsc.bg_color.full = debug_color.full;
+1 -1
View File
@@ -64,7 +64,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
lv_memset_00(dsc, sizeof(lv_draw_arc_dsc_t)); lv_memset_00(dsc, sizeof(lv_draw_arc_dsc_t));
dsc->width = 1; dsc->width = 1;
dsc->opa = LV_OPA_COVER; dsc->opa = LV_OPA_COVER;
dsc->color = LV_COLOR_BLACK; dsc->color = lv_color_black();
} }
/** /**
+2 -2
View File
@@ -361,7 +361,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
/* Fall down to SW render in case of error */ /* Fall down to SW render in case of error */
} }
#endif #endif
lv_color_t last_dest_color = LV_COLOR_BLACK; lv_color_t last_dest_color = lv_color_black();
lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa); lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa);
uint16_t color_premult[3]; uint16_t color_premult[3];
@@ -540,7 +540,7 @@ static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, co
/*Simple fill (maybe with opacity), no masking*/ /*Simple fill (maybe with opacity), no masking*/
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) { if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) {
lv_color_t last_dest_color = LV_COLOR_BLACK; lv_color_t last_dest_color = lv_color_black();
lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa); lv_color_t last_res_color = lv_color_mix(color, last_dest_color, opa);
for(y = draw_area->y1; y <= draw_area->y2; y++) { for(y = draw_area->y1; y <= draw_area->y2; y++) {
for(x = draw_area->x1; x <= draw_area->x2; x++) { for(x = draw_area->x1; x <= draw_area->x2; x++) {
+2 -2
View File
@@ -57,7 +57,7 @@ static void draw_cleanup(lv_img_cache_entry_t * cache);
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc) void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
{ {
lv_memset_00(dsc, sizeof(lv_draw_img_dsc_t)); lv_memset_00(dsc, sizeof(lv_draw_img_dsc_t));
dsc->recolor = LV_COLOR_BLACK; dsc->recolor = lv_color_black();
dsc->opa = LV_OPA_COVER; dsc->opa = LV_OPA_COVER;
dsc->zoom = LV_IMG_ZOOM_NONE; dsc->zoom = LV_IMG_ZOOM_NONE;
dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0; dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
@@ -632,7 +632,7 @@ static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, co
{ {
lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_t rect_dsc;
lv_draw_rect_dsc_init(&rect_dsc); lv_draw_rect_dsc_init(&rect_dsc);
rect_dsc.bg_color = LV_COLOR_WHITE; rect_dsc.bg_color = lv_color_white();
lv_draw_rect(coords, clip_area, &rect_dsc); lv_draw_rect(coords, clip_area, &rect_dsc);
lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_t label_dsc;
+3 -3
View File
@@ -95,12 +95,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
{ {
lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t)); lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
dsc->opa = LV_OPA_COVER; dsc->opa = LV_OPA_COVER;
dsc->color = LV_COLOR_BLACK; dsc->color = lv_color_black();
dsc->font = LV_THEME_FONT_NORMAL; dsc->font = LV_THEME_FONT_NORMAL;
dsc->sel_start = LV_DRAW_LABEL_NO_TXT_SEL; dsc->sel_start = LV_DRAW_LABEL_NO_TXT_SEL;
dsc->sel_end = LV_DRAW_LABEL_NO_TXT_SEL; dsc->sel_end = LV_DRAW_LABEL_NO_TXT_SEL;
dsc->sel_color = LV_COLOR_BLACK; dsc->sel_color = lv_color_black();
dsc->sel_bg_color = LV_COLOR_BLUE; dsc->sel_bg_color = lv_color_blue();
dsc->bidi_dir = LV_BIDI_DIR_LTR; dsc->bidi_dir = LV_BIDI_DIR_LTR;
} }
+1 -1
View File
@@ -53,7 +53,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
lv_memset_00(dsc, sizeof(lv_draw_line_dsc_t)); lv_memset_00(dsc, sizeof(lv_draw_line_dsc_t));
dsc->width = 1; dsc->width = 1;
dsc->opa = LV_OPA_COVER; dsc->opa = LV_OPA_COVER;
dsc->color = LV_COLOR_BLACK; dsc->color = lv_color_black();
} }
/** /**

Some files were not shown because too many files have changed in this diff Show More