# ConvolveMatrixEffect

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/rendering/composition/effects/struct-convolvematrixeffect/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
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.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L744)

## Members

- [`name`](#struct_field-name)
- [`kernel_width`](#struct_field-kernel_width)
- [`kernel_height`](#struct_field-kernel_height)
- [`kernel_matrix`](#struct_field-kernel_matrix)
- [`divisor`](#struct_field-divisor)
- [`bias`](#struct_field-bias)
- [`border_mode`](#struct_field-border_mode)
- [`preserve_alpha`](#struct_field-preserve_alpha)
- [`clamp_output`](#struct_field-clamp_output)
- [`source`](#struct_field-source)

<a id="struct_field-name"></a>

### name

```rust
name: String
```

The name of the effect.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L746)

<a id="struct_field-kernel_width"></a>

### kernel_width

```rust
kernel_width: u32
```

The number of columns of the kernel (default 3).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L748)

<a id="struct_field-kernel_height"></a>

### kernel_height

```rust
kernel_height: u32
```

The number of rows of the kernel (default 3).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L750)

<a id="struct_field-kernel_matrix"></a>

### kernel_matrix

```rust
kernel_matrix: Vec<f32>
```

The elements of the kernel, row by row, `kernel_width *
kernel_height` of them (default the 3 by 3 identity).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L753)

<a id="struct_field-divisor"></a>

### divisor

```rust
divisor: f32
```

What the weighted sum is divided by (default 1; 0 is taken as 1).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L755)

<a id="struct_field-bias"></a>

### bias

```rust
bias: f32
```

What is added to the result, 0 to 1 a channel (default 0).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L757)

<a id="struct_field-border_mode"></a>

### border_mode

```rust
border_mode: EffectBorderMode
```

How the edges of the source are treated: `Soft` reads transparent
pixels beyond them (the default), `Hard` repeats the edge pixels.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L760)

<a id="struct_field-preserve_alpha"></a>

### preserve_alpha

```rust
preserve_alpha: bool
```

Whether the alpha is kept and the colours are convolved
un-premultiplied (default `false`: the four premultiplied channels
are convolved).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L764)

<a id="struct_field-clamp_output"></a>

### clamp_output

```rust
clamp_output: bool
```

Whether the output is clamped (stored; the drawing contexts clamp).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L766)

<a id="struct_field-source"></a>

### source

```rust
source: Option<GraphicsEffectSource>
```

The input.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/effects/graphics_effects.rs#L768)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `From<ConvolveMatrixEffect>`
- `Clone`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Default`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
