ConvolveMatrixEffect
struct · ferroui-base · v0.5.0
struct ConvolveMatrixEffect
Convolves its source with a kernel (Win2D ConvolveMatrixEffect, the
SVG feConvolveMatrix primitive): each pixel becomes the sum of the
pixels around it weighted by the kernel, divided by divisor, plus
bias (ConvolveMatrix has the exact
rule). The kernel steps over device pixels. Animatable: Divisor, Bias
and the elements of the kernel, KernelMatrix0 to KernelMatrix24
(row by row).
Deviation (winui-composition.md): kernels of up to 5 by 5 elements load
(a larger one is EffectTypeNotSupported); KernelOffset,
KernelScale and InterpolationMode are not members; the elements of the
kernel are animatable (WinUI animates none of them), so that a custom
effect can derive its kernel from its parameters.
Members
namekernel_widthkernel_heightkernel_matrixdivisorbiasborder_modepreserve_alphaclamp_outputsource
name
name: String
The name of the effect.
kernel_width
kernel_width: u32
The number of columns of the kernel (default 3).
kernel_height
kernel_height: u32
The number of rows of the kernel (default 3).
kernel_matrix
kernel_matrix: Vec<f32>
The elements of the kernel, row by row, kernel_width * kernel_height of them (default the 3 by 3 identity).
divisor
divisor: f32
What the weighted sum is divided by (default 1; 0 is taken as 1).
bias
bias: f32
What is added to the result, 0 to 1 a channel (default 0).
border_mode
border_mode: EffectBorderMode
How the edges of the source are treated: Soft reads transparent
pixels beyond them (the default), Hard repeats the edge pixels.
preserve_alpha
preserve_alpha: bool
Whether the alpha is kept and the colours are convolved
un-premultiplied (default false: the four premultiplied channels
are convolved).
clamp_output
clamp_output: bool
Whether the output is clamped (stored; the drawing contexts clamp).
source
source: Option<GraphicsEffectSource>
The input.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherFrom<ConvolveMatrixEffect>CloneDebugStructuralPartialEqPartialEqDefault
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.