diff options
author | 2024-04-10 19:55:27 +0200 | |
---|---|---|
committer | 2024-04-10 19:55:27 +0200 | |
commit | fdd9896dc5f727f4c659ad6252f1ab36cca77762 (patch) | |
tree | 4e2e8fe380346d50cdfa5e10b65f175fb0b8160f /graphics | |
parent | 32cd456fb936117307c178b4d47ae89124c8329a (diff) | |
download | iced-fdd9896dc5f727f4c659ad6252f1ab36cca77762.tar.gz iced-fdd9896dc5f727f4c659ad6252f1ab36cca77762.tar.bz2 iced-fdd9896dc5f727f4c659ad6252f1ab36cca77762.zip |
Track image damage in `iced_tiny_skia`
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/image.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/graphics/src/image.rs b/graphics/src/image.rs index 47a7b30e..c6135e9e 100644 --- a/graphics/src/image.rs +++ b/graphics/src/image.rs @@ -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`]. /// |