Skip to main content

Module effects

Module effects 

Source
Expand description

The effects of the WinUI composition API (phase 6, scoped): the effect descriptions an effect factory is made from (the FerroUI form of the Win2D effects WinUI takes), the factory, and the loaded graph its brushes draw.

The descriptions are the effects the drawing contexts of FerroUI can express: a Gaussian blur (the blur effect of the drawing context), an opacity, a cross-fade of two sources, composites in every mode but MaskInvert, a colour fill, blends, colour matrices (saturation, tint, invert, grayscale, luminance to alpha), an arithmetic composite with a colour, an alpha mask, a border that tiles a surface and scene lighting (winui-materials.md). A graph with another effect or mode loads with the status Other, and its brushes draw nothing.

Structs§

AlphaMaskEffect
Keeps its source where its mask is opaque (Win2D AlphaMaskEffect): the source multiplied by the alpha of the mask.
ArithmeticCompositeEffect
Combines two sources channel by channel as MultiplyAmount * s1 * s2 + Source1Amount * s1 + Source2Amount * s2 + Offset on premultiplied colours (Win2D ArithmeticCompositeEffect). Animatable: MultiplyAmount, Source1Amount, Source2Amount, Offset.
BlendEffect
Mixes a foreground into a background (Win2D BlendEffect).
BorderEffect
Extends its source beyond its edges (Win2D BorderEffect): a surface brush source tiles over the area of the brush when an edge behaviour is Wrap (or Mirror, drawn as Wrap); any other source, or Clamp on both sides, is drawn as it is.
ColorMatrixEffect
Transforms the colours of its source by a matrix (Win2D ColorMatrixEffect).
ColorSourceEffect
Fills the area with a colour (Win2D ColorSourceEffect). Animatable: Color.
CompositeEffect
Draws its sources over each other, in order (Win2D CompositeEffect).
CompositionEffectFactory
Creates the brushes of one effect graph (WinUI Microsoft.UI.Composition.CompositionEffectFactory), made by Compositor::create_effect_factory.
CompositionEffectSourceParameter
A named leaf of an effect graph that a brush is bound to (WinUI Microsoft.UI.Composition.CompositionEffectSourceParameter): the input of the effect that CompositionEffectBrush::set_source_parameter fills with a composition brush, or the composed children of the layer visual whose effect the brush is.
CrossFadeEffect
Blends two sources by a weight (Win2D CrossFadeEffect): source1 at weight 0, source2 at weight 1. Animatable: Weight (also as CrossFade, the name of the Win2D member).
GaussianBlurEffect
Blurs its source (Win2D GaussianBlurEffect). Animatable: BlurAmount.
GrayscaleEffect
Turns its source grey (Win2D GrayscaleEffect).
InvertEffect
Inverts the colours of its source (Win2D InvertEffect).
LuminanceToAlphaEffect
Turns the luminance of its source into alpha (Win2D LuminanceToAlphaEffect): black with the luminance as its alpha.
OpacityEffect
Multiplies the alpha of its source (Win2D OpacityEffect). Animatable: Opacity.
SaturationEffect
Changes the saturation of its source (Win2D SaturationEffect): a colour matrix (ColorMatrix::saturation). Animatable: Saturation.
SceneLightingEffect
The lighting of the lights that reach the visual that paints the brush (WinUI Microsoft.UI.Composition.Effects.SceneLightingEffect): the sum, for every point of the brush, of the ambient lights times AmbientAmount and of the diffuse light of the other lights times DiffuseAmount, opaque. Animatable: AmbientAmount, DiffuseAmount, SpecularAmount, SpecularShine.
ShadowEffect
The shadow of its source (Win2D ShadowEffect): the alpha of the source in the shadow colour, blurred. Animatable: BlurAmount, ShadowColor.
TintEffect
Multiplies the channels of its source by a colour (Win2D TintEffect). Animatable: Color.

Enums§

BlendEffectMode
How a blend effect mixes its foreground into its background (Win2D BlendEffectMode, the modes of Direct2D’s blend effect).
CanvasComposite
How a composite effect combines its sources (Win2D CanvasComposite): each source is composed onto what the sources before it made.
CanvasEdgeBehavior
How a border effect extends its source beyond its edges (Win2D CanvasEdgeBehavior).
CompositionEffectFactoryError
Why an effect factory did not load its effect: the ExtendedError of WinUI’s factory, as a value.
CompositionEffectFactoryLoadStatus
Whether an effect factory loaded its effect (WinUI Microsoft.UI.Composition.CompositionEffectFactoryLoadStatus).
EffectBorderMode
How a blur treats the edges of its input (Win2D EffectBorderMode): Soft fades the edges (the blur reads transparent pixels beyond its area), Hard keeps them (the blur reads its source beyond the area and its output is cut to the area).
EffectOptimization
The speed and quality trade-off of an effect (Win2D EffectOptimization).
GraphicsEffect
An effect description (WinUI IGraphicsEffect): one of the Win2D effects of this module.
GraphicsEffectSource
An input of an effect (WinUI IGraphicsEffectSource): a source parameter that a brush is bound to, or another effect.

Functions§

blur_amount_to_radius
Converts the BlurAmount of a Win2D blur (the standard deviation of the Gaussian, in device independent pixels) to the radius of the blur effect of the drawing contexts, which both backends turn into a standard deviation as 0.288675 * radius + 0.5. An amount of 0.5 or less is no blur.