diff options
author | 2020-02-12 03:47:36 +0100 | |
---|---|---|
committer | 2020-02-12 03:47:36 +0100 | |
commit | f436f20eb86b2324126a54d4164b4cedf2134a45 (patch) | |
tree | a19be4a267640d459ae4cbd6b5a26e3c69120189 /wgpu/src/widget/canvas/frame.rs | |
parent | 8daf798e5760a0d35d5491027d51a5dd96898b0d (diff) | |
download | iced-f436f20eb86b2324126a54d4164b4cedf2134a45.tar.gz iced-f436f20eb86b2324126a54d4164b4cedf2134a45.tar.bz2 iced-f436f20eb86b2324126a54d4164b4cedf2134a45.zip |
Draft `Canvas` types and `clock` example
Diffstat (limited to 'wgpu/src/widget/canvas/frame.rs')
-rw-r--r-- | wgpu/src/widget/canvas/frame.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/wgpu/src/widget/canvas/frame.rs b/wgpu/src/widget/canvas/frame.rs new file mode 100644 index 00000000..65c22c0c --- /dev/null +++ b/wgpu/src/widget/canvas/frame.rs @@ -0,0 +1,39 @@ +use iced_native::Point; + +use crate::{ + canvas::{Fill, Path, Stroke}, + triangle, +}; + +#[derive(Debug)] +pub struct Frame { + width: u32, + height: u32, + buffers: lyon::tessellation::VertexBuffers<triangle::Vertex2D, u16>, +} + +impl Frame { + pub(crate) fn new(width: u32, height: u32) -> Frame { + Frame { + width, + height, + buffers: lyon::tessellation::VertexBuffers::new(), + } + } + + pub fn width(&self) -> u32 { + self.width + } + + pub fn height(&self) -> u32 { + self.height + } + + pub fn center(&self) -> Point { + Point::new(self.width as f32 / 2.0, self.height as f32 / 2.0) + } + + pub fn fill(&mut self, path: Path, fill: Fill) {} + + pub fn stroke(&mut self, path: Path, stroke: Stroke) {} +} |