RadialBlurOptions Class
Immutable options for ImageProcessingExtensions.RadialBlur.
public sealed class RadialBlurOptionsRemarks
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
| Name | Description |
|---|---|
| RadialBlurOptions(RadialBlurKind, PointD, double) | Initializes a new instance of the RadialBlurOptions class. |
RadialBlurOptions(RadialBlurKind, PointD, double)
RadialBlurOptions.csInitializes a new instance of the RadialBlurOptions class.
public RadialBlurOptions(RadialBlurKind kind, PointD center, double amount)Parameters
kindRadialBlurKind- The direction of the blur.
centerPointD- The center of the blur, in stored-pixel coordinates (finite, at most 1,000,000 in absolute value).
amountdouble- The length of the path (see
RadialBlurOptions.Amount): forRadialBlurKind.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); forRadialBlurKind.Spin, an angle in degrees, greater than 0 and at most 360 (the whole circle).
Exceptions
ArgumentOutOfRangeExceptionkindis not a defined value,centeris not finite or too far, oramountis out of the range of the kind.
Properties
| Name | Description |
|---|---|
| Amount | 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. |
| Center | Gets the center of the blur, in stored-pixel coordinates. |
| EdgeMode | Gets the pixels read beyond the edges of the frame. Defaults to ConvolutionEdgeMode.Clamp. |
| Kind | Gets the direction of the blur. |
| MaxSampleCount | 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. |
| WorkingSpace | 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. |
Amount
RadialBlurOptions.csGets 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
Center
RadialBlurOptions.csEdgeMode
RadialBlurOptions.csGets the pixels read beyond the edges of the frame. Defaults to ConvolutionEdgeMode.Clamp.
public ConvolutionEdgeMode EdgeMode { get; init; }MaxSampleCount
RadialBlurOptions.csGets 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
Exceptions
ArgumentOutOfRangeException- The value is not between 1 and
RadialBlurOptions.MaxSampleCountLimit.
WorkingSpace
RadialBlurOptions.csGets 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
Exceptions
ArgumentOutOfRangeException- The value is not a defined
ConvolutionWorkingSpace.
Constants
| Name | Description |
|---|---|
| MaxSampleCountLimit | The largest value of RadialBlurOptions.MaxSampleCount. |
MaxSampleCountLimit
The largest value of RadialBlurOptions.MaxSampleCount.
public const int MaxSampleCountLimit = 1024