Implement canvas::Path::line
helper method
This commit is contained in:
parent
46cd0891d2
commit
3df49bebd4
@ -35,6 +35,17 @@ impl Path {
|
|||||||
builder.build()
|
builder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a new [`Path`] representing a line segment given its starting
|
||||||
|
/// and end points.
|
||||||
|
///
|
||||||
|
/// [`Path`]: struct.Path.html
|
||||||
|
pub fn line(from: Point, to: Point) -> Self {
|
||||||
|
Self::new(|p| {
|
||||||
|
p.move_to(from);
|
||||||
|
p.line_to(to);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates a new [`Path`] representing a rectangle given its top-left
|
/// Creates a new [`Path`] representing a rectangle given its top-left
|
||||||
/// corner coordinate and its `Size`.
|
/// corner coordinate and its `Size`.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user