mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
lv_arc: add rounding feature
This commit is contained in:
parent
bed22463dc
commit
1eb3e1711a
@ -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_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) {
|
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;
|
lv_area_t cir_area;
|
||||||
cir_area.x1 = cir_x + x - thick_2;
|
cir_area.x1 = cir_x + x - thick_2;
|
||||||
cir_area.y1 = cir_y + y - thick_2;
|
cir_area.y1 = cir_y + y - thick_2;
|
||||||
cir_area.x2 = cir_x + x + thick_2;
|
cir_area.x2 = cir_x + x + thick_2;
|
||||||
cir_area.y2 = cir_y + y + 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_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);
|
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.x2 = cir_x + x + thick_2;
|
||||||
cir_area.y2 = cir_y + y + 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user