How to draw a more beautiful rouned line?

Description

lvgl dev-7.0 there are more advanced drawing systems.

I want to know that how to draw a more beautiful rouned line.

What do you want to achieve?

As shown in the figure, I feel that there is more pixels on the edge of the line, I believe it can be more perfect.

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.
image

Best regards.

That looks like a bug… the size of the circle should match the line. Possibly there is an off-by-one error somewhere?

Do you have a code snippet that can be used to reproduce this?

YES, this can be reproduced, as long as you try to rotate it at different angles, you may see this effect.

Do you mean rotating it with a canvas or simply placing one point above/below the other?

Hi, you can run the code to see the effect.
This effect is not very obvious, but it can also be seen.

   lv_obj_t* line = lv_line_create(lv_scr_act(), NULL);
   static const lv_point_t line_points[2] = {
       { 0,   0   },
       { 66, 101 },
   };
   static lv_style_t line_style;
   lv_style_copy(&line_style, lv_obj_get_style(line));
   line_style.line.color   = LV_COLOR_MAGENTA;
   line_style.line.width   = 32;
   line_style.line.rounded = 1;
   lv_obj_set_style(line, &line_style);
   lv_obj_set_drag(line, true);
   lv_line_set_points(line, line_points, 2);
   lv_obj_align(line, NULL, LV_ALIGN_CENTER, 0, 0);

image

I’ve tried my best to correct those error but it’s rally not perfect yet.
The rounded end are added in lv_line_design in lv_line.c. @Anda would have time and interest to fix it?

Hi, I am very glad to fix it, and I am thinking of any way to optimize this. :grinning:

Awesome! Waiting for the Pull request! :slight_smile:

You can also provide good ideas. :smiley:

About “how to open a pull request” or “how to solve the issue”? :smiley:

Haha :grinning:
About “how to solve the issue” advice

Unfortunately, I can’t give good advice. It was error and trial for me to get to this point. :frowning:

That’s all right. I will try my best to make it more better.

1 Like