[−][src]Struct dither::ditherer::Ditherer
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
impl<'a> Ditherer<'a>
[src]
Trait Implementations
impl<'a> Clone for Ditherer<'a>
[src]
impl<'a> Debug for Ditherer<'a>
[src]
impl<'a> Default for Ditherer<'a>
[src]
impl<'a> Display for Ditherer<'a>
[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]
P: Add<Output = P> + Clone + Default,
P: Mul<f64, Output = P> + Div<f64, Output = P>,
fn dither(&self, img: Img<P>, quantize: impl FnMut(P) -> (P, P)) -> Img<P>
[src]
dither an image using the specified offsets and divisor.
P
is the type of pixel; in practice, it is either f64 or [RGB<f64]
impl<'a> Eq for Ditherer<'a>
[src]
impl FromStr for Ditherer<'static>
[src]
type Err = ErrorUnknownDitherer
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl<'a> PartialEq<Ditherer<'a>> for Ditherer<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Ditherer<'a>
impl<'a> Send for Ditherer<'a>
impl<'a> Sync for Ditherer<'a>
impl<'a> Unpin for Ditherer<'a>
impl<'a> UnwindSafe for Ditherer<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,