SceneConvolveMatrixPrimitive Class
A primitive that computes each pixel from the pixels around it with a matrix of weights: feConvolveMatrix of SVG.
public sealed class SceneConvolveMatrixPrimitive : SceneFilterPrimitiveRemarks
With a matrix of orderX columns and orderY rows and a target (tx, ty), a pixel of the result is sum(I(x - tx + j, y - ty + i) K(orderX - j - 1, orderY - i - 1)) / divisor + bias. The weights are one pixel of the rendered image apart.
- Inheritance
SceneFilterPrimitiveSceneConvolveMatrixPrimitive
Constructors
| Name | Description |
|---|---|
| SceneConvolveMatrixPrimitive(int, int, ReadOnlySpan<double>) | Initializes a new instance of the SceneConvolveMatrixPrimitive class. |
SceneConvolveMatrixPrimitive(int, int, ReadOnlySpan<double>)
SceneConvolveMatrixPrimitive.csInitializes a new instance of the SceneConvolveMatrixPrimitive class.
public SceneConvolveMatrixPrimitive(int orderX, int orderY, params scoped ReadOnlySpan<double> kernel)Parameters
orderXint- The number of columns of the matrix:
order. Must be between 1 and 255. orderYint- The number of rows of the matrix. Must be between 1 and 255.
kernelReadOnlySpan<double>- The weights, row by row:
kernelMatrix. They are copied.
Exceptions
ArgumentOutOfRangeException- An order is not between 1 and 255.
ArgumentException- The number of weights is not
orderX orderY, or a weight is not a finite number.
Properties
| Name | Description |
|---|---|
| Bias | Gets what is added to every component of the result: bias. |
| Divisor | Gets what the sum is divided by: divisor. The default is null: the sum of the weights, or 1 when it is zero. |
| EdgeMode | Gets what is read beyond the edges of the input: edgeMode. The default is SceneFilterEdgeMode.Duplicate, as in SVG. |
| Input | Gets the input: in. |
| Kernel | Gets the weights, row by row. |
| OrderX | Gets the number of columns of the matrix. |
| OrderY | Gets the number of rows of the matrix. |
| PreserveAlpha | Gets a value indicating whether the colors are computed without their alpha, which each pixel keeps: preserveAlpha. |
| TargetX | Gets the column of the matrix that is on the pixel: targetX. The default is null: floor(orderX / 2). |
| TargetY | Gets the row of the matrix that is on the pixel: targetY. The default is null: floor(orderY / 2). |
Gets what is added to every component of the result: bias.
public double Bias { get; init; }Gets what the sum is divided by: divisor. The default is null: the sum of the weights, or 1 when it is zero.
public double? Divisor { get; init; }EdgeMode
SceneConvolveMatrixPrimitive.csGets what is read beyond the edges of the input: edgeMode. The default is SceneFilterEdgeMode.Duplicate, as in SVG.
public SceneFilterEdgeMode EdgeMode { get; init; }PreserveAlpha
SceneConvolveMatrixPrimitive.csGets the column of the matrix that is on the pixel: targetX. The default is null: floor(orderX / 2).
public int? TargetX { get; init; }Gets the row of the matrix that is on the pixel: targetY. The default is null: floor(orderY / 2).
public int? TargetY { get; init; }