Struct ada::Canvas [−][src]
pub struct Canvas { /* fields omitted */ }
Expand description
Container for drawing the shapes
Implementations
impl Canvas
[src]
impl Canvas
[src]pub fn new(width: usize, height: usize) -> Result<Canvas>
[src]
pub fn new(width: usize, height: usize) -> Result<Canvas>
[src]creates a new canvas. Takes:
ⓘ
width: width of the canvas height: height of the canvas
Canvas does not create a internal buffer, it takes a buffer during draw
pub fn draw(&mut self, shape: &dyn Shape, color: &Color, buffer: &mut [u8])
[src]
pub fn draw(&mut self, shape: &dyn Shape, color: &Color, buffer: &mut [u8])
[src]Draw the shape within the bounds in the canvas
Provide a mutable buffer to fill the values. It assumes color mode to RGBA.