Introduce explicit image::allocate API

This commit is contained in:
Héctor Ramón Jiménez 2025-10-25 00:07:13 +02:00
parent 6fa54f7f6b
commit 23039e758e
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
15 changed files with 355 additions and 51 deletions

View file

@ -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.