pub struct LayerFilter {
pub image: Option<ImageFilter>,
pub color: Option<ColorFilter>,
pub mask: Option<ShaderMask>,
pub backdrop: Option<Backdrop>,
pub blend: Option<BlendMode>,
}Expand description
What a layer does at compositing, for painting a scene by hand.
Everything a layer applies to its own pixels at compositing time. All three are
optional and independent; LayerFilter::is_none is the fast path the renderer
takes when nothing is asked for, which is nearly always.
Fields§
§image: Option<ImageFilter>Treats the layer as an image: a blur, a dilate, an erode.
color: Option<ColorFilter>A function of one pixel: a tint, a greyscale, a contrast curve.
mask: Option<ShaderMask>A colour blended over the result.
backdrop: Option<Backdrop>A filter over what is painted underneath, drawn before the layer’s own content. Not one of the three above: it never touches the layer’s pixels.
blend: Option<BlendMode>How the layer meets what is underneath (milestone 646): None paints it
over, as every layer has always been. Any other mode reads the frame painted so
far under the layer and combines the two by it, in the space colours are
written in, the way a paint’s blend mode does in the reference. The layer’s clip
shape is its coverage: outside it, what was there stays.
Implementations§
Source§impl LayerFilter
impl LayerFilter
Sourcepub const NONE: LayerFilter
pub const NONE: LayerFilter
Nothing at all — the default, and what every layer that is only an opacity group or a clip carries.
Sourcepub fn is_none(&self) -> bool
pub fn is_none(&self) -> bool
true when this layer asks for no effect, so compositing can take its
original path unchanged.
Sourcepub fn merge(self, other: LayerFilter) -> Option<LayerFilter>
pub fn merge(self, other: LayerFilter) -> Option<LayerFilter>
Folds other into this filter, keeping what is already set.
This is what lets two filter widgets wrapped one inside the other share a
single layer instead of nesting two. It returns None when both sides ask
for the same slot, because there the outer one is a filter of the
inner’s result and merging would silently drop one of them.
A backdrop refuses to share with a filter of the layer itself. It is a
filter of what lies underneath, drawn before the layer’s content; a colour
filter sharing the layer would be applied to the content and not to the
backdrop, and the picture would quietly differ from what the two widgets read
as. It shares happily with nothing at all, which is what a clip is, and that
case matters: a clip around a backdrop is the shape the backdrop should take.
A blend mode shares with nothing but nothing either. It is how the whole layer meets what is under it, so a filter folded in beside it would be applied before or after the blend depending on which widget it came from.
Sourcepub fn scaled_xy(self, sx: f32, sy: f32) -> LayerFilter
pub fn scaled_xy(self, sx: f32, sy: f32) -> LayerFilter
Scales the geometry per axis, as DPI does. A colour matrix has no length in it and is left alone; the blur radius and the mask both have one.
Sourcepub fn translated(self, dx: f32, dy: f32) -> LayerFilter
pub fn translated(self, dx: f32, dy: f32) -> LayerFilter
Moves the geometry with the subtree it covers. Only the mask has any: a blur radius is a length, not a place.
Sourcepub fn resolve_mask(shader: FractionalMask, box_rect: Rect) -> MaskShader
pub fn resolve_mask(shader: FractionalMask, box_rect: Rect) -> MaskShader
Resolves a mask written in fractions of box_rect into the absolute
geometry a scene holds. A radial radius is a fraction of the box smaller
side, so a circle stays a circle in a box that is not square.
Trait Implementations§
Source§impl Clone for LayerFilter
impl Clone for LayerFilter
Source§fn clone(&self) -> LayerFilter
fn clone(&self) -> LayerFilter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more