imgsyn/src/ops/axial.rs
2026-02-09 16:10:13 +01:00

29 lines
653 B
Rust

use crate::{
Canvas, ImgSyn,
assist::{axial, polar},
};
#[derive(Clone, Copy)]
pub struct ImgSynAxial<Prev: ImgSyn>(pub(crate) Prev);
impl<Prev> ImgSyn for ImgSynAxial<Prev>
where
Prev: ImgSyn,
{
fn getpx(&self, meta: Canvas, x: f32, y: f32) -> crate::Pixel {
let (x, y) = axial(x, y, meta);
self.0.getpx(meta, x, y)
}
}
#[derive(Clone, Copy)]
pub struct ImgSynPolar<Prev: ImgSyn>(pub(crate) Prev);
impl<Prev> ImgSyn for ImgSynPolar<Prev>
where
Prev: ImgSyn,
{
fn getpx(&self, meta: Canvas, x: f32, y: f32) -> crate::Pixel {
let (x, y) = polar(x, y, meta);
self.0.getpx(meta, x, y)
}
}