Implement image support for canvas widget

This commit is contained in:
Héctor Ramón Jiménez 2024-08-04 03:28:43 +02:00
parent 87a613edd1
commit 0ceee1cf3a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
16 changed files with 485 additions and 29 deletions

View file

@ -330,6 +330,7 @@ impl graphics::geometry::Renderer for Renderer {
match geometry {
Geometry::Live {
primitives,
images,
text,
clip_bounds,
} => {
@ -339,6 +340,10 @@ impl graphics::geometry::Renderer for Renderer {
transformation,
);
for image in images {
layer.draw_image(&image, transformation);
}
layer.draw_text_group(text, clip_bounds, transformation);
}
Geometry::Cache(cache) => {
@ -348,6 +353,10 @@ impl graphics::geometry::Renderer for Renderer {
transformation,
);
for image in cache.images.iter() {
layer.draw_image(image, transformation);
}
layer.draw_text_cache(
cache.text,
cache.clip_bounds,
@ -381,7 +390,7 @@ impl core::image::Renderer for Renderer {
opacity: f32,
) {
let (layer, transformation) = self.layers.current_mut();
layer.draw_image(
layer.draw_raster(
handle,
filter_method,
bounds,