Skip to main content

Effect

Trait Effect 

Source
pub trait Effect: Send + Sync {
    // Required method
    fn apply(
        &self,
        input: &[u8],
        output: &mut [u8],
        dimensions: (u32, u32),
        mask: &Mask,
    ) -> Result<()>;
}
Expand description

An image effect that can be evaluated by a Renderer.

Effects are safe to move and share between threads so pipelines retain those properties.

Required Methods§

Source

fn apply( &self, input: &[u8], output: &mut [u8], dimensions: (u32, u32), mask: &Mask, ) -> Result<()>

Writes effected RGBA8 pixels into output.

input and output contain four row-major bytes per pixel and have the supplied dimensions. output initially contains a copy of input. Implementations must leave pixels with zero mask coverage unchanged and write the fully effected value for pixels with non-zero coverage. The renderer blends partial mask coverage after this method returns.

§Errors

Returns a crate::DitherError when the effect cannot be evaluated.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§