pub trait Renderer {
// Required methods
fn render(&mut self, graph: &SceneGraph, options: &RenderOptions) -> Image;
fn render_list(
&mut self,
graph: &SceneGraph,
items: &[DrawItem],
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.
Sourcefn render_list(
&mut self,
graph: &SceneGraph,
items: &[DrawItem],
options: &RenderOptions,
) -> Image
fn render_list( &mut self, graph: &SceneGraph, items: &[DrawItem], options: &RenderOptions, ) -> Image
Draws items, a part of graph’s draw list, and returns the pixels
without presenting. graph gives the scene size.
The engine calls this for a frame where a shader reads drawn pixels
(lens_drops, an effect): it draws the list in parts and runs the
shader between them.
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".