summaryrefslogtreecommitdiffstats
path: root/wgpu/src/widget/canvas/frame.rs
blob: e5daeedbbef44bb246a68ca9609a9d2282d8747d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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) {}
}