Trait image2::Filter

source ·
pub trait Filter<T: Type, C: Color, U: Type = T, D: Color = C>: Debug + Sync {
    // Required method
    fn compute_at(
        &self,
        pt: Point,
        input: &Input<'_, T, C>,
        dest: &mut DataMut<'_, U, D>
    );

    // Provided methods
    fn schedule(&self) -> Schedule { ... }
    fn output_size(
        &self,
        _input: &Input<'_, T, C>,
        dest: &mut Image<U, D>
    ) -> Size { ... }
    fn eval_partial(
        &self,
        roi: Region,
        input: &[&Image<T, C>],
        output: &mut Image<U, D>
    ) { ... }
    fn eval_partial_in_place(&self, roi: Region, output: &mut Image<U, D>) { ... }
    fn eval(&self, input: &[&Image<T, C>], output: &mut Image<U, D>) { ... }
    fn eval_in_place(&self, output: &mut Image<U, D>) { ... }
}
Expand description

Filters are used to manipulate images in a generic, composable manner

Required Methods§

source

fn compute_at( &self, pt: Point, input: &Input<'_, T, C>, dest: &mut DataMut<'_, U, D> )

Compute filter at the given point for the provided input

  • pt: Current output point
  • input: Input images, input pixel from previous filters in chain
  • dest: Single pixel output buffer

Provided Methods§

source

fn schedule(&self) -> Schedule

Determines whether a filter should be executed one pixel at a time, or a whole image at a time

source

fn output_size(&self, _input: &Input<'_, T, C>, dest: &mut Image<U, D>) -> Size

Get filter output size, this is typically the destination image size, however when used as part of a pipeline a single filter might have a different output size

source

fn eval_partial( &self, roi: Region, input: &[&Image<T, C>], output: &mut Image<U, D> )

Evaluate a filter on part of an image

source

fn eval_partial_in_place(&self, roi: Region, output: &mut Image<U, D>)

Evaluate filter on part of an image using the same image for input and output

source

fn eval(&self, input: &[&Image<T, C>], output: &mut Image<U, D>)

Evaluate filter

source

fn eval_in_place(&self, output: &mut Image<U, D>)

Evaluate filter using the same image for input and output

Implementors§

source§

impl<T: Type, C: Color, U: Type, D: Color> Filter<T, C, U, D> for Kernel

source§

impl<T: Type, C: Color, U: Type, D: Color> Filter<T, C, U, D> for Transform