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
Dilate
The brightest neighbour within the radius wins: light shapes grow. The building block of an outer glow or a fattened outline.
Fields
Erode
The dimmest neighbour within the radius wins: light shapes shrink.
Implementations§
Source§impl ImageFilter
impl ImageFilter
Sourcepub const fn blur(sigma: f32) -> ImageFilter
pub const fn blur(sigma: f32) -> ImageFilter
A Gaussian blur, the same in both directions.
Sourcepub fn radius(self) -> (f32, f32)
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.
Sourcepub fn is_identity(self) -> bool
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.
Sourcepub fn scaled_xy(self, sx: f32, sy: f32) -> ImageFilter
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.
Trait Implementations§
Source§impl Clone for ImageFilter
impl Clone for ImageFilter
Source§fn clone(&self) -> ImageFilter
fn clone(&self) -> ImageFilter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more