Struct flo_canvas::Canvas
source · pub struct Canvas { /* private fields */ }
Expand description
A canvas is an abstract interface for drawing graphics. It doesn’t actually provide a means to render anything, but rather a way to describe how things should be drawn and pass those on to a renderer elsewhere.
A canvas can be cloned and sent between threads, so it’s possible for multiple sources to write to the same drawing target.
Canvases maintain a copy of enough of the drawing instructions sent to them to reproduce the rendering on a new render target.
Implementations§
source§impl Canvas
impl Canvas
sourcepub fn draw<FnAction>(&self, action: FnAction)where
FnAction: Send + FnOnce(&mut CanvasGraphicsContext<'_>),
pub fn draw<FnAction>(&self, action: FnAction)where FnAction: Send + FnOnce(&mut CanvasGraphicsContext<'_>),
Provides a way to draw on this canvas via a GC
sourcepub fn stream(&self) -> impl Stream<Item = Draw> + Send
pub fn stream(&self) -> impl Stream<Item = Draw> + Send
Creates a stream for reading the instructions from this canvas
sourcepub fn get_drawing(&self) -> Vec<Draw>
pub fn get_drawing(&self) -> Vec<Draw>
Retrieves the list of drawing actions in this canvas