pub trait CanvasProgram:
Debug
+ Send
+ 'static {
// Required method
fn draw(&self, pixmap: &mut Pixmap);
// Provided method
fn need_redraw(&mut self) -> bool { ... }
}Available on crate features
resvg or tiny-skia only.Expand description
Required Methods§
Sourcefn draw(&self, pixmap: &mut Pixmap)
fn draw(&self, pixmap: &mut Pixmap)
Draw image
This method should draw an image to the canvas. It is called when the
pixmap is created and resized and when requested by Self::need_redraw.
Note that Layout::draw does not call this method, but instead draws
from a copy of the pixmap (updated each time this method completes).
Provided Methods§
Sourcefn need_redraw(&mut self) -> bool
fn need_redraw(&mut self) -> bool
This method is called each time a frame is drawn. Note that since redrawing is async and non-blocking, the result is expected to be at least one frame late.
The default implementation returns false.