DitherMethod2D

Trait DitherMethod2D 

Source
pub trait DitherMethod2D: Send + Sync {
    // Required method
    fn compute(&self, x: u32, y: u32) -> f32;

    // Provided methods
    fn dither_2d<T>(
        &self,
        value: T,
        min: T,
        one: T,
        dither_amplitude: T,
        x: u32,
        y: u32,
    ) -> T
       where T: DitherFloat,
             Self: Sized { ... }
    fn simple_dither_2d<T>(&self, value: T, one: T, x: u32, y: u32) -> T
       where T: DitherFloat + Number + CastableFrom<f32>,
             Self: Sized { ... }
    fn dither_slice_2d<T>(
        &self,
        values: &mut [T],
        width: usize,
        min: T,
        one: T,
        dither_amplitude: T,
    )
       where T: DitherFloat + Send + Sync,
             Self: Sized { ... }
    fn simple_dither_slice_2d<T>(&self, values: &mut [T], width: usize, one: T)
       where T: DitherFloat + Number + CastableFrom<f32> + Send + Sync,
             Self: Sized { ... }
}
Expand description

Trait for 2D dithering methods.

Required Methods§

Source

fn compute(&self, x: u32, y: u32) -> f32

Compute dither offset for given 2D coordinates. Returns a value in range [-1, 1] to be scaled by amplitude.

Provided Methods§

Source

fn dither_2d<T>( &self, value: T, min: T, one: T, dither_amplitude: T, x: u32, y: u32, ) -> T
where T: DitherFloat, Self: Sized,

Dither a single value using 2D coordinates.

Source

fn simple_dither_2d<T>(&self, value: T, one: T, x: u32, y: u32) -> T
where T: DitherFloat + Number + CastableFrom<f32>, Self: Sized,

Simple dither for a single value using 2D coordinates.

Source

fn dither_slice_2d<T>( &self, values: &mut [T], width: usize, min: T, one: T, dither_amplitude: T, )
where T: DitherFloat + Send + Sync, Self: Sized,

Dither a 2D image stored as a flat slice (parallel version).

Source

fn simple_dither_slice_2d<T>(&self, values: &mut [T], width: usize, one: T)
where T: DitherFloat + Number + CastableFrom<f32> + Send + Sync, Self: Sized,

Simple dither for a 2D image stored as a flat slice (parallel version).

Implementors§