Struct dither::ditherer::Ditherer [−][src]
pub struct Ditherer<'a> { /* fields omitted */ }
A type of Dither. See the documentation for the constants (i.e, ATKINSON) for the dither matrices themselves.
A ditherer carries error from quantiation to nearby pixels after dividing by div
and multiplying by the given scalar in offset; “spreading” the error,
eg, take floyd-steinberg dithering: div=16
. x 7
7 5 1
Suppose we have an grayscale image where the f64
pixel “p
”“ at (x=3, y=0)
is 100., and we quantize to black (0.0) and white(255.0)
The ditherer sets p=0
and has a carried error of 100.
The spread error is then:
. ---- . --- 43.75
43.75 31.25 6.25
See tanner helland’s excellent writeup on dithering algorithms for details.
Implementations
Trait Implementations
impl<'a, P> Dither<P> for Ditherer<'a> where
P: Add<Output = P> + Clone + Default,
P: Mul<f64, Output = P> + Div<f64, Output = P>,
[src]
impl<'a, P> Dither<P> for Ditherer<'a> where
P: Add<Output = P> + Clone + Default,
P: Mul<f64, Output = P> + Div<f64, Output = P>,
[src]Auto Trait Implementations
impl<'a> RefUnwindSafe for Ditherer<'a>
impl<'a> RefUnwindSafe for Ditherer<'a>
impl<'a> UnwindSafe for Ditherer<'a>
impl<'a> UnwindSafe for Ditherer<'a>