add painter.line() (#5291)

* Closes <https://github.com/emilk/egui/issues/5273>
* [x] I have followed the instructions in the PR template
This commit is contained in:
Nicolas 2024-11-26 15:17:47 +01:00 committed by GitHub
parent e28505077d
commit 12f9d6f42c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -344,6 +344,12 @@ impl Painter {
})
}
/// Paints a line connecting the points.
/// NOTE: all coordinates are screen coordinates!
pub fn line(&self, points: Vec<Pos2>, stroke: impl Into<PathStroke>) -> ShapeIdx {
self.add(Shape::line(points, stroke))
}
/// Paints a horizontal line.
pub fn hline(&self, x: impl Into<Rangef>, y: f32, stroke: impl Into<PathStroke>) -> ShapeIdx {
self.add(Shape::hline(x, y, stroke.into()))