1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::shape::Shape;
use crate::{DisplayList, Drawing};

pub struct Canvas {
    pub width: u32,
    pub height: u32,
    pub background: Option<Shape>,
    pub display_list: DisplayList,
}

impl Canvas {
    pub fn new(width: u32, height: u32) -> Canvas {
        Canvas {
            width,
            height,
            background: None,
            display_list: DisplayList::new(),
        }
    }

    pub fn drawings(&self) -> &Vec<Drawing> {
        &self.display_list.drawings
    }
}