Description
Line does not get drawn
What MCU/Processor/Board and compiler are you using?
Simulator only currently, gcc 7.5.0
What LVGL version are you using?
v7 latest master
What do you want to achieve?
For learning purposes I would like to draw a white line diagonally over a black container
What have you tried so far?
Created the container, created the line, according to the logs everything is fine
Info: lv_init ready (lv_obj.c #187 lv_init())
Info: Object create ready (lv_obj.c #419 lv_obj_create())
Info: Object create ready (lv_obj.c #419 lv_obj_create())
Info: Object create ready (lv_obj.c #419 lv_obj_create())
Info: Object create ready (lv_obj.c #419 lv_obj_create())
Info: container created (lv_cont.c #118 lv_cont_create())
Info: Object create ready (lv_obj.c #419 lv_obj_create())
Info: line created (lv_line.c #101 lv_line_create())
Code to reproduce
Most of the code is jumbled together from docs
The code block(s) should be formatted like:
lv_obj_t* cont = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_auto_realign(cont, true);
lv_obj_align_origo(cont, NULL, LV_ALIGN_CENTER, 0, 0);
lv_cont_set_fit(cont, LV_FIT_TIGHT);
lv_cont_set_layout(cont, LV_LAYOUT_COLUMN_MID);
lv_obj_set_style_local_bg_color(cont, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
lv_point_t line_points[] = {{0, 0}, {LV_HOR_RES_MAX, LV_VER_RES_MAX}};
static lv_style_t style_line;
lv_style_init(&style_line);
lv_style_set_line_width(&style_line, LV_STATE_DEFAULT, 10);
lv_style_set_line_color(&style_line, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_style_set_line_rounded(&style_line, LV_STATE_DEFAULT, true);
lv_obj_t * line1;
line1 = lv_line_create(cont, NULL);
lv_line_set_points(line1, line_points, 2);
lv_obj_add_style(line1, LV_LINE_PART_MAIN, &style_line); /*Set the points*/
lv_obj_align(line1, NULL, LV_ALIGN_CENTER, 0, 0);
Screenshot and/or video
Not much to show, just a black screen in the simulator
Thank you in advance for any and all replies