diff options
author | 2020-04-28 03:14:05 +0200 | |
---|---|---|
committer | 2020-04-28 03:14:05 +0200 | |
commit | b0825ce38bb9d496193f40e5d2cc7a4654455396 (patch) | |
tree | 74d2d9f1af255cdae92a64aa1896b46da579cbc9 /wgpu/src/widget | |
parent | 56dbd683269b82da16d8eae3f98f352301750bf5 (diff) | |
download | iced-b0825ce38bb9d496193f40e5d2cc7a4654455396.tar.gz iced-b0825ce38bb9d496193f40e5d2cc7a4654455396.tar.bz2 iced-b0825ce38bb9d496193f40e5d2cc7a4654455396.zip |
Add convenient builder methods to `canvas::Stroke`
Diffstat (limited to 'wgpu/src/widget')
-rw-r--r-- | wgpu/src/widget/canvas/stroke.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/wgpu/src/widget/canvas/stroke.rs b/wgpu/src/widget/canvas/stroke.rs index 46d669c4..e20379cd 100644 --- a/wgpu/src/widget/canvas/stroke.rs +++ b/wgpu/src/widget/canvas/stroke.rs @@ -14,6 +14,24 @@ pub struct Stroke { pub line_join: LineJoin, } +impl Stroke { + pub fn with_color(self, color: Color) -> Stroke { + Stroke { color, ..self } + } + + pub fn with_width(self, width: f32) -> Stroke { + Stroke { width, ..self } + } + + pub fn with_line_cap(self, line_cap: LineCap) -> Stroke { + Stroke { line_cap, ..self } + } + + pub fn with_line_join(self, line_join: LineJoin) -> Stroke { + Stroke { line_join, ..self } + } +} + impl Default for Stroke { fn default() -> Stroke { Stroke { |