diff options
author | 2024-05-02 15:21:22 +0200 | |
---|---|---|
committer | 2024-05-02 17:28:28 +0200 | |
commit | a57313b23ecb9843856ca0ea08635b6121fcb2cb (patch) | |
tree | 42a88a4e42031ae99ae87aeb92fea85ab590b01e /core/src/rectangle.rs | |
parent | 09a6bcfffc24f5abdc8709403bab7ae1e01563f1 (diff) | |
download | iced-a57313b23ecb9843856ca0ea08635b6121fcb2cb.tar.gz iced-a57313b23ecb9843856ca0ea08635b6121fcb2cb.tar.bz2 iced-a57313b23ecb9843856ca0ea08635b6121fcb2cb.zip |
Simplify image rotation API and its internals
Diffstat (limited to 'core/src/rectangle.rs')
-rw-r--r-- | core/src/rectangle.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 2ab50137..fb66131a 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -227,3 +227,19 @@ where } } } + +impl<T> std::ops::Mul<Vector<T>> for Rectangle<T> +where + T: std::ops::Mul<Output = T> + Copy, +{ + type Output = Rectangle<T>; + + fn mul(self, scale: Vector<T>) -> Self { + Rectangle { + x: self.x * scale.x, + y: self.y * scale.y, + width: self.width * scale.x, + height: self.height * scale.y, + } + } +} |