summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-14 07:08:12 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-14 07:08:12 +0200
commit3df49bebd47e8ff7c54934d6474336b7439176f9 (patch)
treed1e125376d809a18fe02bc63da48aa3484e44daf /wgpu
parent46cd0891d25c2dd48e182747d8c1f9579b066490 (diff)
downloadiced-3df49bebd47e8ff7c54934d6474336b7439176f9.tar.gz
iced-3df49bebd47e8ff7c54934d6474336b7439176f9.tar.bz2
iced-3df49bebd47e8ff7c54934d6474336b7439176f9.zip
Implement `canvas::Path::line` helper method
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/src/widget/canvas/path.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/wgpu/src/widget/canvas/path.rs b/wgpu/src/widget/canvas/path.rs
index 19d8879a..c26bf187 100644
--- a/wgpu/src/widget/canvas/path.rs
+++ b/wgpu/src/widget/canvas/path.rs
@@ -35,6 +35,17 @@ impl Path {
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
/// corner coordinate and its `Size`.
///