Skip to content

Commit

Permalink
add painter.line() (#5291)
Browse files Browse the repository at this point in the history
* Closes <#5273>
* [x] I have followed the instructions in the PR template
  • Loading branch information
bircni authored Nov 26, 2024
1 parent e285050 commit 12f9d6f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/egui/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit 12f9d6f

Please sign in to comment.