Introduce explicit image::allocate API
This commit is contained in:
parent
6fa54f7f6b
commit
23039e758e
15 changed files with 355 additions and 51 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#[cfg(debug_assertions)]
|
||||
mod null;
|
||||
|
||||
use crate::image;
|
||||
use crate::{
|
||||
Background, Border, Color, Font, Pixels, Rectangle, Shadow, Size,
|
||||
Transformation, Vector,
|
||||
|
|
@ -62,6 +63,13 @@ pub trait Renderer {
|
|||
|
||||
/// Resets the [`Renderer`] to start drawing in the `new_bounds` from scratch.
|
||||
fn reset(&mut self, new_bounds: Rectangle);
|
||||
|
||||
/// Creates an [`image::Allocation`] for the given [`image::Handle`] and calls the given callback with it.
|
||||
fn allocate_image(
|
||||
&mut self,
|
||||
handle: &image::Handle,
|
||||
callback: impl FnOnce(image::Allocation) + Send + 'static,
|
||||
);
|
||||
}
|
||||
|
||||
/// A polygon with four sides.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue