Update drawing round-ending lines for the canvas's obj
@@ -658,9 +658,34 @@ void lv_canvas_draw_line(lv_obj_t * canvas, const lv_point_t * points, uint32_t
lv_disp_t * refr_ori = lv_refr_get_disp_refreshing();
lv_refr_set_disp_refreshing(&disp);
+ lv_style_t circle_style_tmp; /*If rounded...*/
+ lv_style_copy(&circle_style_tmp, style);
+ circle_style_tmp.body.radius = LV_RADIUS_CIRCLE;
+ circle_style_tmp.body.main_color = style->line.color;
+ circle_style_tmp.body.grad_color = style->line.color;
+ circle_style_tmp.body.opa = style->line.opa;
+ lv_area_t circle_area;
+
uint32_t i;
for(i = 0; i < point_cnt - 1; i++) {
lv_draw_line(&points[i], &points[i + 1], &mask, style, LV_OPA_COVER);
+
+ /*Draw circle on the joints if enabled*/
+ if(style->line.rounded) {
+ circle_area.x1 = points[i].x - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
+ circle_area.y1 = points[i].y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
+ circle_area.x2 = points[i].x + ((style->line.width - 1) >> 1);
+ circle_area.y2 = points[i].y + ((style->line.width - 1) >> 1);
+ lv_draw_rect(&circle_area, &mask, &circle_style_tmp, LV_OPA_COVER);
+ }
+ }
+ /*Draw circle on the last point too if enabled*/
+ if(style->line.rounded) {
+ circle_area.x1 = points[i].x - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
+ circle_area.y1 = points[i].y - ((style->line.width - 1) >> 1) - ((style->line.width - 1) & 0x1);
+ circle_area.x2 = points[i].x + ((style->line.width - 1) >> 1);
+ circle_area.y2 = points[i].y + ((style->line.width - 1) >> 1);
+ lv_draw_rect(&circle_area, &mask, &circle_style_tmp, LV_OPA_COVER);
}
lv_refr_set_disp_refreshing(refr_ori);
