From f34407bfdaf06c4bf204dc31b152be9451c243b8 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 12 Feb 2020 07:08:49 +0100 Subject: Implement `Frame::fill` and `Frame::stroke` --- wgpu/src/widget/canvas.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'wgpu/src/widget/canvas.rs') diff --git a/wgpu/src/widget/canvas.rs b/wgpu/src/widget/canvas.rs index 7b84f36c..6bfeed9a 100644 --- a/wgpu/src/widget/canvas.rs +++ b/wgpu/src/widget/canvas.rs @@ -133,6 +133,16 @@ impl Default for LineCap { } } +impl From for lyon::tessellation::LineCap { + fn from(line_cap: LineCap) -> lyon::tessellation::LineCap { + match line_cap { + LineCap::Butt => lyon::tessellation::LineCap::Butt, + LineCap::Square => lyon::tessellation::LineCap::Square, + LineCap::Round => lyon::tessellation::LineCap::Round, + } + } +} + #[derive(Debug, Clone, Copy)] pub enum LineJoin { Miter, @@ -146,6 +156,16 @@ impl Default for LineJoin { } } +impl From for lyon::tessellation::LineJoin { + fn from(line_join: LineJoin) -> lyon::tessellation::LineJoin { + match line_join { + LineJoin::Miter => lyon::tessellation::LineJoin::Miter, + LineJoin::Round => lyon::tessellation::LineJoin::Round, + LineJoin::Bevel => lyon::tessellation::LineJoin::Bevel, + } + } +} + #[derive(Debug, Clone, Copy)] pub enum Fill { Color(Color), -- cgit