mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -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:
@@ -360,6 +360,38 @@ impl Painter {
|
|||||||
self.add(Shape::vline(x, y, stroke.into()))
|
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(
|
pub fn circle(
|
||||||
&self,
|
&self,
|
||||||
center: Pos2,
|
center: Pos2,
|
||||||
|
|||||||
Reference in New Issue
Block a user