1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

lv_arc: add rounding feature

This commit is contained in:
Gabor Kiss-Vamosi 2018-06-13 11:08:19 +02:00
parent bed22463dc
commit 1eb3e1711a

View File

@ -223,18 +223,23 @@ static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode
lv_draw_arc(x, y, r, mask, ext->angle_start, ext->angle_end, style);
lv_coord_t thick_2 = style->body.thickness / 2;
lv_coord_t cir_x = ((r - thick_2) * lv_trigo_sin(ext->angle_start) >> LV_TRIGO_SHIFT);
lv_coord_t cir_y = ((r - thick_2) * lv_trigo_sin(ext->angle_start + 90) >> LV_TRIGO_SHIFT);
if(style->body.radius == LV_RADIUS_CIRCLE) {
lv_coord_t thick_2 = style->body.thickness / 2;
lv_coord_t cir_x = ((r - thick_2) * lv_trigo_sin(ext->angle_start) >> LV_TRIGO_SHIFT);
lv_coord_t cir_y = ((r - thick_2) * lv_trigo_sin(ext->angle_start + 90) >> LV_TRIGO_SHIFT);
lv_style_t cir_style;
lv_style_copy(&cir_style, style);
cir_style.body.empty = 0;
cir_style.body.aux_color = style->body.main_color;
lv_area_t cir_area;
cir_area.x1 = cir_x + x - thick_2;
cir_area.y1 = cir_y + y - thick_2;
cir_area.x2 = cir_x + x + thick_2;
cir_area.y2 = cir_y + y + thick_2;
lv_draw_rect(&cir_area, mask, &style);
lv_draw_rect(&cir_area, mask, &cir_style);
cir_x = ((r - thick_2) * lv_trigo_sin(ext->angle_end) >> LV_TRIGO_SHIFT);
cir_y = ((r - thick_2) * lv_trigo_sin(ext->angle_end + 90) >> LV_TRIGO_SHIFT);
@ -244,7 +249,7 @@ static bool lv_arc_design(lv_obj_t * arc, const lv_area_t * mask, lv_design_mode
cir_area.x2 = cir_x + x + thick_2;
cir_area.y2 = cir_y + y + thick_2;
lv_draw_rect(&cir_area, mask, &style);
lv_draw_rect(&cir_area, mask, &cir_style);
}
}