CompositionEffectBrush
struct · ferroui-base · v0.5.0
struct CompositionEffectBrush
A brush that draws an effect graph over its sources (WinUI
Microsoft.UI.Composition.CompositionEffectBrush), made by
CompositionEffectFactory::create_brush.
The source parameters of the graph are bound to composition brushes
with set_source_parameter; the brush
draws the graph over the area of the visual that shows it: a Gaussian
blur is the blur effect of the drawing context around its source
(nothing is blurred on a drawing context without effects), an opacity
pushes an opacity, a cross-fade paints source1 with 1 - weight and
source2 with weight over it, a composite paints its sources in
order, a colour source fills the area.
The properties named as animatable when the factory was made
(Blur.BlurAmount, Crossfade.Weight) are entries of
properties, set to the values of the description:
a change of an entry, or an animation of it (start_animation on the
brush or on its properties), redraws the brush.
As the effect of a LayerVisual,
the first source parameter of the graph is the composed children of the
layer.
Deviation (winui-composition.md): the cross-fade draws its second source over the first, each with its weight, rather than adding them; animations of the effect properties under an animation controller are started on the properties, not on the brush.
Members
from_brush
fn from_brush(brush: &Rc<CompositionBrush>) -> Option<CompositionEffectBrush>
The handle of brush as an effect brush, if it is one.
brush
fn brush(self: &Self) -> &Rc<CompositionBrush>
The brush as a composition brush.
properties
fn properties(self: &Self) -> Rc<CompositionPropertySet>
Properties: the property set whose entries are the animatable
properties of the effect (Blur.BlurAmount). Inserting a value of
such an entry or animating it changes what the brush draws; other
entries are the application's.
source_parameter_names
fn source_parameter_names(self: &Self) -> Vec<String>
The names of the source parameters of the graph, in graph order (empty when the factory did not load its effect).
get_source_parameter
fn get_source_parameter(self: &Self, name: &str) -> Option<Rc<CompositionBrush>>
GetSourceParameter(name): the brush bound to the source parameter
name.
set_source_parameter
fn set_source_parameter(self: &Self, name: &str, source: Option<Rc<CompositionBrush>>)
SetSourceParameter(name, source): binds the source parameter name
to source (None unbinds it; an unbound parameter draws nothing).
Panics when the loaded graph has no source parameter of that name (WinUI throws). A brush whose factory did not load its effect accepts any name.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyToOwnedErasedDestructorIntoEitherCloneDeref
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.