RadialBlurOptions Class

public sealed class RadialBlurOptions

Remarks

Every pixel becomes the mean of the frame sampled along a path centered on the pixel: a segment of the line through RadialBlurOptions.Center for RadialBlurKind.Zoom, an arc of the circle around it for RadialBlurKind.Spin. The path grows with the distance to the center, so the center stays sharp. Its samples are evenly spaced, at most one pixel apart up to RadialBlurOptions.MaxSampleCount samples, and read with bilinear interpolation.

The coordinates are those of the stored pixels, where a frame covers [0, width] x [0, height] and the center of pixel (i, j) is (i + 1/2, j + 1/2): the center of a 100×80 frame is (50, 40). The center may be outside the frame.

Constructors

NameDescription
RadialBlurOptions(RadialBlurKind, PointD, double)Initializes a new instance of the RadialBlurOptions class.

RadialBlurOptions(RadialBlurKind, PointD, double)

RadialBlurOptions.cs

Initializes a new instance of the RadialBlurOptions class.

public RadialBlurOptions(RadialBlurKind kind, PointD center, double amount)

Parameters

kind RadialBlurKind
The direction of the blur.
center PointD
The center of the blur, in stored-pixel coordinates (finite, at most 1,000,000 in absolute value).
amount double
The length of the path (see RadialBlurOptions.Amount): for RadialBlurKind.Zoom, a fraction of the distance to the center, greater than 0 and at most 2 (0.2 blurs a pixel 500 pixels away from the center over 100 pixels); for RadialBlurKind.Spin, an angle in degrees, greater than 0 and at most 360 (the whole circle).

Exceptions

ArgumentOutOfRangeException
kind is not a defined value, center is not finite or too far, or amount is out of the range of the kind.

Properties

NameDescription
AmountGets the length of the path: for RadialBlurKind.Zoom, the length of the segment as a fraction of the distance between the pixel and the center (the pixel is sampled at the scales 1 - Amount / 2 to 1 + Amount / 2 of its offset from the center); for RadialBlurKind.Spin, the angle of the arc, in degrees.
CenterGets the center of the blur, in stored-pixel coordinates.
EdgeModeGets the pixels read beyond the edges of the frame. Defaults to ConvolutionEdgeMode.Clamp.
KindGets the direction of the blur.
MaxSampleCountGets the largest number of samples of a path, from 1 to RadialBlurOptions.MaxSampleCountLimit. Defaults to 64. A path longer than MaxSampleCount - 1 pixels has samples more than one pixel apart, which shows as copies of the details instead of a smooth streak; the time per pixel grows with the number of samples.
WorkingSpaceGets the numeric space in which the samples are averaged. Defaults to ConvolutionWorkingSpace.Encoded; ConvolutionWorkingSpace.LinearSrgb averages light, as a camera does, with the rules of the convolution.

Gets the length of the path: for RadialBlurKind.Zoom, the length of the segment as a fraction of the distance between the pixel and the center (the pixel is sampled at the scales 1 - Amount / 2 to 1 + Amount / 2 of its offset from the center); for RadialBlurKind.Spin, the angle of the arc, in degrees.

public double Amount { get; }

Property value

double

Gets the center of the blur, in stored-pixel coordinates.

public PointD Center { get; }

Property value

PointD

Gets the pixels read beyond the edges of the frame. Defaults to ConvolutionEdgeMode.Clamp.

public ConvolutionEdgeMode EdgeMode { get; init; }

Property value

ConvolutionEdgeMode

Exceptions

ArgumentOutOfRangeException
The value is not a defined ConvolutionEdgeMode.

Gets the direction of the blur.

public RadialBlurKind Kind { get; }

Property value

RadialBlurKind

MaxSampleCount

RadialBlurOptions.cs

Gets the largest number of samples of a path, from 1 to RadialBlurOptions.MaxSampleCountLimit. Defaults to 64. A path longer than MaxSampleCount - 1 pixels has samples more than one pixel apart, which shows as copies of the details instead of a smooth streak; the time per pixel grows with the number of samples.

public int MaxSampleCount { get; init; }

Property value

int

Exceptions

ArgumentOutOfRangeException
The value is not between 1 and RadialBlurOptions.MaxSampleCountLimit.

Gets the numeric space in which the samples are averaged. Defaults to ConvolutionWorkingSpace.Encoded; ConvolutionWorkingSpace.LinearSrgb averages light, as a camera does, with the rules of the convolution.

public ConvolutionWorkingSpace WorkingSpace { get; init; }

Property value

ConvolutionWorkingSpace

Exceptions

ArgumentOutOfRangeException
The value is not a defined ConvolutionWorkingSpace.

Constants

NameDescription
MaxSampleCountLimitThe largest value of RadialBlurOptions.MaxSampleCount.

MaxSampleCountLimit

The largest value of RadialBlurOptions.MaxSampleCount.

public const int MaxSampleCountLimit = 1024