1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

egui: Enhance Painter with arc and pie Methods

Introduces convenient methods for drawing arcs and pies directly within the UI.
This commit is contained in:
Varphone Wong
2024-07-17 16:43:24 +08:00
parent 3f9cb13499
commit 74dbacdf33

View File

@@ -360,6 +360,38 @@ impl Painter {
self.add(Shape::vline(x, y, stroke.into()))
}
/// Paints an arc line.
pub fn arc(
&self,
center: Pos2,
radius: f32,
start_angle: f32,
end_angle: f32,
stroke: impl Into<PathStroke>,
) -> ShapeIdx {
self.add(Shape::arc(center, radius, start_angle, end_angle, stroke))
}
/// Paints a pie slice.
pub fn pie(
&self,
center: Pos2,
radius: f32,
start_angle: f32,
end_angle: f32,
fill: impl Into<Color32>,
stroke: impl Into<PathStroke>,
) -> ShapeIdx {
self.add(Shape::pie(
center,
radius,
start_angle,
end_angle,
fill,
stroke,
))
}
pub fn circle(
&self,
center: Pos2,