Track image damage in iced_tiny_skia

This commit is contained in:
Héctor Ramón Jiménez 2024-04-10 19:55:27 +02:00
parent 32cd456fb9
commit fdd9896dc5
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 20 additions and 1 deletions

View file

@ -7,7 +7,7 @@ use crate::core::svg;
use crate::core::{Color, Rectangle};
/// A raster or vector image.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub enum Image {
/// A raster image.
Raster {
@ -33,6 +33,17 @@ pub enum Image {
},
}
impl Image {
/// Returns the bounds of the [`Image`].
pub fn bounds(&self) -> Rectangle {
match self {
Image::Raster { bounds, .. } | Image::Vector { bounds, .. } => {
*bounds
}
}
}
}
#[cfg(feature = "image")]
/// Tries to load an image by its [`Handle`].
///