Struct MaskBlur
A Gaussian blur of a shape's coverage before the paint is applied, as Skia's blur mask filter: Sigma is in device pixels, so it does not scale with the canvas transform. Set it as Blur. Egami blurs with its fast blur; an axis-aligned rectangle with Normal is computed exactly from the error function, which is faster still.
public readonly record struct MaskBlur : IEquatable<MaskBlur>
- Implements
- Inherited Members
Examples
using (RasterCanvas<Rgba8> canvas = raster.CreateCanvas())
{
// A soft-edged card (exact, from the error function) and a neon outline: the stroke's outer blur only, then the stroke.
canvas.FillRoundRect(new RoundRect(new RectF(20, 20, 110, 80), 12), new SolidPaint(new Rgba8(30, 30, 30, 255)) { Blur = new MaskBlur(6) });
Path ring = Path.Circle(new Vector2(220, 60), 40);
canvas.StrokePath(ring, new Stroke(4), new SolidPaint(new Rgba8(255, 40, 200, 255)) { Blur = new MaskBlur(8, BlurStyle.Outer) });
canvas.StrokePath(ring, new Stroke(4), new Rgba8(255, 200, 250, 255));
}
Constructors
MaskBlur(float, BlurStyle)
Initializes a new instance of the MaskBlur struct.
public MaskBlur(float sigma, BlurStyle style = BlurStyle.Normal)
Parameters
sigmafloatThe blur's standard deviation in device pixels, from 0 (no blur) to 1000.
styleBlurStyleWhat of the blur is kept.
Exceptions
- ArgumentOutOfRangeException
sigmais outside 0 to 1000, orstyleis not defined.
Fields
MaxSigma
The largest sigma, as for Egami's blurs.
public const float MaxSigma = 1000
Field Value
Properties
Sigma
Gets the blur's standard deviation in device pixels.
public float Sigma { get; }
Property Value
Style
Gets what of the blur is kept.
public BlurStyle Style { get; }