Table of Contents

Class ConvolveMatrixEffect.Props

Namespace
PaintDotNet.Direct2D1.Effects
Assembly
PaintDotNet.Windows.Core.dll
public sealed class ConvolveMatrixEffect.Props : DeviceEffectProperties
Inheritance
ConvolveMatrixEffect.Props
Inherited Members

Constructors

Props()

Properties

Bias

The effect applies the kernel matrix, the divisor, and then the bias is added to the result. The bias is unbounded and unitless. The default value is 0.

BorderMode

The mode used to calculate the border of the image, soft or hard. The default value is BorderMode.Soft.
If set to BorderMode.Soft, the effect pads the input image with transparent black pixels for samples outside of the input bounds when it applies the convolution kernel. This creates a soft edge for the image, and in the process expands the output bitmap by the size of the kernel.
If set to BorderMode.Hard, the effect extends the input image with a mirror-type border transform for samples outside of the input bounds. The size of the output bitmap is equal to the size of the input bitmap.

ClampOutput

Whether the effect clamps color values to between 0 and 1 before the effect passes the values to the next effect in the graph. The effect clamps the values before it premultiplies the alpha. If you set this to true, the effect will clamp the values. If you set this to false, the effect will not clamp the color values, but other effects and the output surface may clamp the values if they are not of high enough precision. The default value is false.

ClassID

Implemented by the derived class to specify the effect's class ID (CLSID) when registering and creating the effect and for binding to an IDeviceEffectProperties.
Note that this is different than the ID property accessor, which queries the IDeviceEffectProperties for the actual runtime effect class ID.
Overriding this property is only necessary in advanced scenarios, such as when wrapping an existing effect (e.g. built-in Direct2D effects), or when working with CustomEffects that have their own generic type arguments (e.g. PixelShaderEffect).

Divisor

The kernel matrix is applied to a pixel and then the result is divided by this value. 0 behaves as a value of float epsilon. The default value is 1.

Input
KernelMatrix

The kernel matrix to be applied to the image. The kernel elements aren't bounded and are specified as floats. The first set of KernelSizeX numbers in the FLOAT[] corresponds to the first row in the kernel. The second set of KernelSizeX numbers correspond to the second row, and so on up to KernelSizeY rows. The default value is { 0, 0, 0, 0, 1, 0, 0, 0, 0 }.

KernelOffset

Shifts the convolution kernel from a centered position on the output pixel to a position you specify left/right and up/down. The offset is defined in kernel units. With some offsets and kernel sizes, the convolution kernel's samples won't land on a pixel image center. The pixel values for the kernel sample are computed by bilinear interpolation. The default values is { 0, 0 }.

KernelSizeX

The width of the kernel matrix. The units are specified in kernel units. The default value is 3.

KernelSizeY

The height of the kernel matrix. The units are specified in kernel units. The default value is 3.

KernelUnitLength

The size of one unit in the kernel. The units are in (DIPs/kernel unit), where a kernel unit is the size of the element in the convolution kernel. A value of 1 (DIP/kernel unit) corresponds to one pixel in a image at 96 DPI. The default value is 1.

PreserveAlpha

Specifies whether the convolution kernel is applied to the alpha channel or only the color channels. If you set this to true, the convolution kernel is applied only to the color channels. If you set this to false, the convolution kernel is applied to all channels. The default value is false.

ScaleMode

The interpolation mode the effect uses to scale the image to the corresponding kernel unit length. There are six scale modes that range in quality and speed. The default value is ConvolveMatrixScaleMode.Linear.

Methods

SetKernelMatrixAndSize(IReadOnlyList<IReadOnlyList<float>>)

A helper method that sets the KernelMatrix, KernelY, and KernelX properties.

SetKernelMatrixAndSize(float[,])

A helper method that sets the KernelMatrix, KernelY, and KernelX properties.