Filter

Trait Filter 

Source
pub trait Filter:
    Send
    + Sync
    + 'static {
    // Required method
    fn test(&self, pixel: &Rgba) -> bool;

    // Provided method
    fn composite<F>(self, other: F) -> CompositeFilter<Self, F>
       where Self: Sized,
             F: Filter { ... }
}
Expand description

A trait for filtering pixels in an image.

Required Methods§

Source

fn test(&self, pixel: &Rgba) -> bool

Tests whether a pixel passes the filter.

§Arguments
  • pixel - The pixel to apply the filter to.
§Returns

true if the pixel passes the filter; false otherwise.

Provided Methods§

Source

fn composite<F>(self, other: F) -> CompositeFilter<Self, F>
where Self: Sized, F: Filter,

Composites this filter with another filter.

§Type Parameters
  • F - The type of the filter to compose with.
§Arguments
  • other - The other filter to compose with.
§Returns

A new filter that applies this filter and then the given filter.

Implementors§

Source§

impl<F> Filter for F
where F: Fn(&Rgba) -> bool + Send + Sync + 'static,

A filter that applies a closure to a pixel.

This filter is useful for creating custom filters that can be passed to the apply method.

§Type Parameters

  • F - The type of the closure.