Skip to main content

ImageFilter

Enum ImageFilter 

Source
pub enum ImageFilter {
    Blur {
        sigma_x: f32,
        sigma_y: f32,
    },
    Dilate {
        radius_x: f32,
        radius_y: f32,
    },
    Erode {
        radius_x: f32,
        radius_y: f32,
    },
}
Expand description

A filter that treats the subtree as an image, so a pixel’s result depends on its neighbours: a blur, a spread, a shrink.

There is no matrix variant. A layer already carries an affine transform, which is what a matrix image filter is, and the widget that reaches it is Transform; a second spelling here would be the same feature under a different name.

Variants§

§

Blur

A Gaussian blur, with a separate standard deviation per axis, in logical pixels. sigma_x and sigma_y may differ, which is how a directional smear is written.

Fields

§sigma_x: f32

The standard deviation along x, in logical pixels.

§sigma_y: f32

The standard deviation along y, in logical pixels.

§

Dilate

The brightest neighbour within the radius wins: light shapes grow. The building block of an outer glow or a fattened outline.

Fields

§radius_x: f32

The search radius along x, in logical pixels.

§radius_y: f32

The search radius along y, in logical pixels.

§

Erode

The dimmest neighbour within the radius wins: light shapes shrink.

Fields

§radius_x: f32

The search radius along x, in logical pixels.

§radius_y: f32

The search radius along y, in logical pixels.

Implementations§

Source§

impl ImageFilter

Source

pub const fn blur(sigma: f32) -> ImageFilter

A Gaussian blur, the same in both directions.

Source

pub fn radius(self) -> (f32, f32)

The filter’s reach in pixels, per axis — how far a pixel can pull from. A Gaussian is truncated at three standard deviations, past which it contributes under half a percent.

Source

pub fn is_identity(self) -> bool

true when the filter would leave every pixel alone, so the whole pre-pass can be skipped. A zero radius is the only such case, and it is a common one: an animated blur passes through zero at both ends.

Source

pub fn scaled_xy(self, sx: f32, sy: f32) -> ImageFilter

Scales the filter’s geometry per axis, as DPI does. A radius is a length and follows its own axis.

Source

pub const fn code(self) -> u32

The shader’s rank for this kind.

Trait Implementations§

Source§

impl Clone for ImageFilter

Source§

fn clone(&self) -> ImageFilter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ImageFilter

Source§

impl Debug for ImageFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ImageFilter

Source§

fn eq(&self, other: &ImageFilter) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ImageFilter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.