summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget/canvas/stroke.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-05-05 00:05:47 +0200
committerLibravatar GitHub <noreply@github.com>2020-05-05 00:05:47 +0200
commit7dc02a5e16a3143b7c3ba9270207e3ebda71d567 (patch)
treedd727f138641fbda008af8e7827369cc99420749 /wgpu/src/widget/canvas/stroke.rs
parent27aad74a32fd8ac2b12f9d32df8a3b61a3175457 (diff)
parent93c6be5eef577f0778b5787dac37351c035ed471 (diff)
downloadiced-7dc02a5e16a3143b7c3ba9270207e3ebda71d567.tar.gz
iced-7dc02a5e16a3143b7c3ba9270207e3ebda71d567.tar.bz2
iced-7dc02a5e16a3143b7c3ba9270207e3ebda71d567.zip
Merge pull request #325 from hecrj/feature/canvas-interaction
Canvas interactivity and Game of Life example
Diffstat (limited to 'wgpu/src/widget/canvas/stroke.rs')
-rw-r--r--wgpu/src/widget/canvas/stroke.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/wgpu/src/widget/canvas/stroke.rs b/wgpu/src/widget/canvas/stroke.rs
index 46d669c4..5b6fc56a 100644
--- a/wgpu/src/widget/canvas/stroke.rs
+++ b/wgpu/src/widget/canvas/stroke.rs
@@ -14,6 +14,38 @@ pub struct Stroke {
pub line_join: LineJoin,
}
+impl Stroke {
+ /// Sets the color of the [`Stroke`].
+ ///
+ /// [`Stroke`]: struct.Stroke.html
+ pub fn with_color(self, color: Color) -> Stroke {
+ Stroke { color, ..self }
+ }
+
+ /// Sets the width of the [`Stroke`].
+ ///
+ /// [`Stroke`]: struct.Stroke.html
+ pub fn with_width(self, width: f32) -> Stroke {
+ Stroke { width, ..self }
+ }
+
+ /// Sets the [`LineCap`] of the [`Stroke`].
+ ///
+ /// [`LineCap`]: enum.LineCap.html
+ /// [`Stroke`]: struct.Stroke.html
+ pub fn with_line_cap(self, line_cap: LineCap) -> Stroke {
+ Stroke { line_cap, ..self }
+ }
+
+ /// Sets the [`LineJoin`] of the [`Stroke`].
+ ///
+ /// [`LineJoin`]: enum.LineJoin.html
+ /// [`Stroke`]: struct.Stroke.html
+ pub fn with_line_join(self, line_join: LineJoin) -> Stroke {
+ Stroke { line_join, ..self }
+ }
+}
+
impl Default for Stroke {
fn default() -> Stroke {
Stroke {