Anda
January 6, 2020, 5:04am
1
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.
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?
Anda
January 6, 2020, 12:07pm
3
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?
Anda
January 6, 2020, 12:59pm
5
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);
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?
Anda
January 10, 2020, 2:31am
7
Hi, I am very glad to fix it, and I am thinking of any way to optimize this.
Awesome! Waiting for the Pull request!
Anda
January 13, 2020, 6:41am
9
You can also provide good ideas.
About “how to open a pull request” or “how to solve the issue”?
Anda
January 14, 2020, 7:39am
11
Haha
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.
Anda
January 18, 2020, 3:17am
13
That’s all right. I will try my best to make it more better.
1 Like