Draw round-ending lines in a canvas can't be rounded, how to fix it?


When I draw round-ending lines by lv_line’s obj, it can be rounded well.
However, when I draw round-ending lines on lv_canvas’ obj, it can’t display rounded lines.
How to fix it?

What MCU/Processor/Board and compiler are you using?


What do you want to achieve?

Round-ending lines can be shown correctly on a canvas.

What have you tried so far?

Code to reproduce

  static lv_point_t points[] = { {10,10}, {200,100}, {100,220} };

  static lv_style_t line_style; 
    lv_style_copy(&line_style, &lv_style_plain);
    line_style.line.width    = 10;
    line_style.line.rounded  = true;   // set round-ending
    line_style.line.color    = LV_COLOR_BLUE;

  lv_color_t *cbuf = (lv_color_t*) lv_mem_alloc( LV_CANVAS_BUF_SIZE_TRUE_COLOR(240,240));
  lv_obj_t* canvas = lv_canvas_create(lv_scr_act(),NULL);
    lv_canvas_set_buffer(canvas, cbuf, 240, 240, LV_IMG_CF_TRUE_COLOR);
    lv_canvas_fill_bg(canvas, LV_COLOR_BLACK);
    lv_canvas_draw_line(canvas, points, 3, &line_style);

Screenshot and/or video


Already solved.
and add pull requeat for fixing round-ending lines in the canvas’ obj at

1 Like

How can I solve this problem with lvgl version 8.3.x ?

Is there no solution? I do not understand the function of the structure parameters in the LVGL documentation…