summaryrefslogtreecommitdiffstats
path: root/graphics/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-05-03 07:31:34 +0200
committerLibravatar GitHub <noreply@github.com>2024-05-03 07:31:34 +0200
commit1cefe6be210cdae8c6769673e8d23c6781a988f1 (patch)
tree7d4a383412e6bd69d0cc1b32f996ba7cf6ef892e /graphics/src
parentfe240a93aacd15bd3fa75876054753a53bda9054 (diff)
parent4010e3983d40e24a5d7b590d8fec9801651199ce (diff)
downloadiced-1cefe6be210cdae8c6769673e8d23c6781a988f1.tar.gz
iced-1cefe6be210cdae8c6769673e8d23c6781a988f1.tar.bz2
iced-1cefe6be210cdae8c6769673e8d23c6781a988f1.zip
Merge pull request #2334 from DKolter/image-rotation
Adding feature: Image rotation
Diffstat (limited to 'graphics/src')
-rw-r--r--graphics/src/image.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/graphics/src/image.rs b/graphics/src/image.rs
index 04c45057..9d09bf4c 100644
--- a/graphics/src/image.rs
+++ b/graphics/src/image.rs
@@ -2,9 +2,7 @@
#[cfg(feature = "image")]
pub use ::image as image_rs;
-use crate::core::image;
-use crate::core::svg;
-use crate::core::{Color, Rectangle};
+use crate::core::{image, svg, Color, Radians, Rectangle};
/// A raster or vector image.
#[derive(Debug, Clone, PartialEq)]
@@ -19,6 +17,9 @@ pub enum Image {
/// The bounds of the image.
bounds: Rectangle,
+
+ /// The rotation of the image in radians
+ rotation: Radians,
},
/// A vector image.
Vector {
@@ -30,6 +31,9 @@ pub enum Image {
/// The bounds of the image.
bounds: Rectangle,
+
+ /// The rotation of the image in radians
+ rotation: Radians,
},
}
@@ -37,9 +41,12 @@ impl Image {
/// Returns the bounds of the [`Image`].
pub fn bounds(&self) -> Rectangle {
match self {
- Image::Raster { bounds, .. } | Image::Vector { bounds, .. } => {
- *bounds
+ Image::Raster {
+ bounds, rotation, ..
}
+ | Image::Vector {
+ bounds, rotation, ..
+ } => bounds.rotate(*rotation),
}
}
}