summaryrefslogtreecommitdiffstats
path: root/renderer
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-10-23 03:14:22 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-02 01:53:28 +0100
commit9b8614a4e2252f0b74d1a1b38b5e5bb55b1af995 (patch)
treea2b74570fb79dbc99bb609add8a9f938ec5abdce /renderer
parent5467c19c80c992f03890264ed58156305a26b19a (diff)
downloadiced-9b8614a4e2252f0b74d1a1b38b5e5bb55b1af995.tar.gz
iced-9b8614a4e2252f0b74d1a1b38b5e5bb55b1af995.tar.bz2
iced-9b8614a4e2252f0b74d1a1b38b5e5bb55b1af995.zip
Implement `transform` method for `Geometry`
Diffstat (limited to 'renderer')
-rw-r--r--renderer/src/geometry.rs35
1 files changed, 25 insertions, 10 deletions
diff --git a/renderer/src/geometry.rs b/renderer/src/geometry.rs
index cd2140dc..9cf506a8 100644
--- a/renderer/src/geometry.rs
+++ b/renderer/src/geometry.rs
@@ -4,12 +4,17 @@ pub use cache::Cache;
use crate::core::{Point, Rectangle, Size, Vector};
use crate::graphics::geometry::{Fill, Path, Stroke, Text};
+use crate::graphics::Transformation;
use crate::Renderer;
-pub enum Frame {
- TinySkia(iced_tiny_skia::geometry::Frame),
- #[cfg(feature = "wgpu")]
- Wgpu(iced_wgpu::geometry::Frame),
+macro_rules! delegate {
+ ($frame:expr, $name:ident, $body:expr) => {
+ match $frame {
+ Self::TinySkia($name) => $body,
+ #[cfg(feature = "wgpu")]
+ Self::Wgpu($name) => $body,
+ }
+ };
}
pub enum Geometry {
@@ -18,14 +23,24 @@ pub enum Geometry {
Wgpu(iced_wgpu::Primitive),
}
-macro_rules! delegate {
- ($frame:expr, $name:ident, $body:expr) => {
- match $frame {
- Self::TinySkia($name) => $body,
+impl Geometry {
+ pub fn transform(self, transformation: Transformation) -> Self {
+ match self {
+ Self::TinySkia(primitive) => {
+ Self::TinySkia(primitive.transform(transformation))
+ }
#[cfg(feature = "wgpu")]
- Self::Wgpu($name) => $body,
+ Self::Wgpu(primitive) => {
+ Self::Wgpu(primitive.transform(transformation))
+ }
}
- };
+ }
+}
+
+pub enum Frame {
+ TinySkia(iced_tiny_skia::geometry::Frame),
+ #[cfg(feature = "wgpu")]
+ Wgpu(iced_wgpu::geometry::Frame),
}
impl Frame {