pub trait Renderer {
// Required method
fn render(&mut self, graph: &SceneGraph, options: &RenderOptions) -> Image;
// Provided methods
fn render_pixels(
&mut self,
graph: &SceneGraph,
options: &RenderOptions,
) -> Image { ... }
fn present_image(&mut self, _image: &Image) { ... }
}Expand description
Draws a scene graph into an image.
Required Methods§
Sourcefn render(&mut self, graph: &SceneGraph, options: &RenderOptions) -> Image
fn render(&mut self, graph: &SceneGraph, options: &RenderOptions) -> Image
Draws the current state of graph and returns the picture.
A renderer that presents straight to a surface may return an empty
image after showing the frame. Transitions need the pixels, so they
call render_pixels and then
present_image.
Provided Methods§
Sourcefn render_pixels(
&mut self,
graph: &SceneGraph,
options: &RenderOptions,
) -> Image
fn render_pixels( &mut self, graph: &SceneGraph, options: &RenderOptions, ) -> Image
Draws graph and returns the pixels, without presenting.
The default is render, which already returns pixels.
Sourcefn present_image(&mut self, _image: &Image)
fn present_image(&mut self, _image: &Image)
Shows a frame that was blended from pixels. The default does nothing,
because render already showed the frame.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".