Skip to main content

FilterEffects

Trait FilterEffects 

Source
pub trait FilterEffects: Drawable {
    // Provided method
    fn fx<T>(self, value: T) -> Self
       where T: Into<Filter> { ... }
}
Expand description

Capability for applying filter effects to a node.

Provided Methods§

Source

fn fx<T>(self, value: T) -> Self
where T: Into<Filter>,

Sets a filter effect applied to the node.

§Arguments
  • value: The filter configuration convertible into a Filter.
§Examples

Applying a single filter to node.


let scene = decal! {
    Text("hello")
        .fx(Filter::invert(0.5))
};

Applying multiple filters to node.


let scene = decal! {
    Text("hello")
        .fx([Filter::blur(5.0), Filter::contrast(1.5)])
};

Using a custom Filter builder.


let scene = decal! {
    Text("hello")
        .fx(Filter::new(|ctx| {
            ctx.gaussian_blur().std_deviation(5.0).finish();
        }))
};
§Returns

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§