summaryrefslogtreecommitdiffstats
path: root/graphics/src/image.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-04 04:30:12 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-04 04:30:12 +0200
commit92bd3ecd6b4a6618f0fc725dea3694c3b40e5314 (patch)
tree8040fe0f758eb41cbf587119c5d972f5ebaa8567 /graphics/src/image.rs
parent974ae6d1e7cd9df6967762a6d308106f4fe03edc (diff)
downloadiced-92bd3ecd6b4a6618f0fc725dea3694c3b40e5314.tar.gz
iced-92bd3ecd6b4a6618f0fc725dea3694c3b40e5314.tar.bz2
iced-92bd3ecd6b4a6618f0fc725dea3694c3b40e5314.zip
Introduce `Image` struct in `core::image`
Diffstat (limited to '')
-rw-r--r--graphics/src/image.rs28
1 files changed, 3 insertions, 25 deletions
diff --git a/graphics/src/image.rs b/graphics/src/image.rs
index 0e8f2fe3..2e4f4b5a 100644
--- a/graphics/src/image.rs
+++ b/graphics/src/image.rs
@@ -8,28 +8,8 @@ use crate::core::{image, svg, Color, Radians, Rectangle};
#[derive(Debug, Clone, PartialEq)]
pub enum Image {
/// A raster image.
- Raster {
- /// The handle of a raster image.
- handle: image::Handle,
+ Raster(image::Image, Rectangle),
- /// The filter method of a raster image.
- filter_method: image::FilterMethod,
-
- /// The bounds of the image.
- bounds: Rectangle,
-
- /// The rotation of the image.
- rotation: Radians,
-
- /// The opacity of the image.
- opacity: f32,
-
- /// If set to `true`, the image will be snapped to the pixel grid.
- ///
- /// This can avoid graphical glitches, specially when using a
- /// [`image::FilterMethod::Nearest`].
- snap: bool,
- },
/// A vector image.
Vector {
/// The handle of a vector image.
@@ -53,10 +33,8 @@ impl Image {
/// Returns the bounds of the [`Image`].
pub fn bounds(&self) -> Rectangle {
match self {
- Image::Raster {
- bounds, rotation, ..
- }
- | Image::Vector {
+ Image::Raster(image, bounds) => bounds.rotate(image.rotation),
+ Image::Vector {
bounds, rotation, ..
} => bounds.rotate(*rotation),
}