pub trait Renderer {
// Required methods
fn start_layer(&mut self, bounds: Rectangle);
fn end_layer(&mut self);
fn start_transformation(&mut self, transformation: Transformation);
fn end_transformation(&mut self);
fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>);
fn reset(&mut self, new_bounds: Rectangle);
fn allocate_image(
&mut self,
handle: &Handle,
callback: impl FnOnce(Result<Allocation, Error>) + Send + 'static,
);
// Provided methods
fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self)) { ... }
fn with_transformation(
&mut self,
transformation: Transformation,
f: impl FnOnce(&mut Self),
) { ... }
fn with_translation(
&mut self,
translation: Vector,
f: impl FnOnce(&mut Self),
) { ... }
}Expand description
A component that can be used by widgets to draw themselves on a screen.
Required Methods§
Sourcefn start_layer(&mut self, bounds: Rectangle)
fn start_layer(&mut self, bounds: Rectangle)
Starts recording a new layer.
Sourcefn end_layer(&mut self)
fn end_layer(&mut self)
Ends recording a new layer.
The new layer will clip its contents to the provided bounds.
Sourcefn start_transformation(&mut self, transformation: Transformation)
fn start_transformation(&mut self, transformation: Transformation)
Starts recording with a new Transformation.
Sourcefn end_transformation(&mut self)
fn end_transformation(&mut self)
Ends recording a new layer.
The new layer will clip its contents to the provided bounds.
Sourcefn fill_quad(&mut self, quad: Quad, background: impl Into<Background>)
fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>)
Fills a Quad with the provided Background.
Sourcefn reset(&mut self, new_bounds: Rectangle)
fn reset(&mut self, new_bounds: Rectangle)
Resets the Renderer to start drawing in the new_bounds from scratch.
Sourcefn allocate_image(
&mut self,
handle: &Handle,
callback: impl FnOnce(Result<Allocation, Error>) + Send + 'static,
)
fn allocate_image( &mut self, handle: &Handle, callback: impl FnOnce(Result<Allocation, Error>) + Send + 'static, )
Creates an image::Allocation for the given image::Handle and calls the given callback with it.
Provided Methods§
Sourcefn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self))
fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self))
Draws the primitives recorded in the given closure in a new layer.
The layer will clip its contents to the provided bounds.
Sourcefn with_transformation(
&mut self,
transformation: Transformation,
f: impl FnOnce(&mut Self),
)
fn with_transformation( &mut self, transformation: Transformation, f: impl FnOnce(&mut Self), )
Applies a Transformation to the primitives recorded in the given closure.
Sourcefn with_translation(&mut self, translation: Vector, f: impl FnOnce(&mut Self))
fn with_translation(&mut self, translation: Vector, f: impl FnOnce(&mut Self))
Applies a translation to the primitives recorded in the given closure.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".