diff options
author | metamuffin <yvchraiqi@protonmail.com> | 2022-06-05 17:19:53 +0200 |
---|---|---|
committer | metamuffin <yvchraiqi@protonmail.com> | 2022-06-05 17:19:53 +0200 |
commit | ed2ff677f1977d2c163322ce9e7a55f0740d1f1a (patch) | |
tree | bad9701c11004f2faa05ce21d31a97cd4d874ef3 /src/transform.rs | |
parent | 280cc84e641872564e35d801fbdc7990e013a0e7 (diff) | |
download | blubcat-ed2ff677f1977d2c163322ce9e7a55f0740d1f1a.tar blubcat-ed2ff677f1977d2c163322ce9e7a55f0740d1f1a.tar.bz2 blubcat-ed2ff677f1977d2c163322ce9e7a55f0740d1f1a.tar.zst |
thing
Diffstat (limited to 'src/transform.rs')
-rw-r--r-- | src/transform.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/transform.rs b/src/transform.rs index 3994f1d..0b65728 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -23,12 +23,19 @@ impl Sample for Polar { } } +pub struct Transpose(pub Box<dyn Sample>); +impl Sample for Transpose { + fn sample(&mut self, x: f64, y: f64) -> Color { + self.0.sample(y, x) + } +} + pub struct Translate { pub inner: Box<dyn Sample>, pub offset: (f64, f64), } impl Sample for Translate { fn sample(&mut self, x: f64, y: f64) -> Color { - self.inner.sample(x + self.offset.0, y + self.offset.1) + self.inner.sample(x - self.offset.0, y - self.offset.1) } } |