DropShadowFilter Class

A drop shadow: drop-shadow() of CSS, feDropShadow of SVG, the shadow of the HTML canvas.

public sealed class DropShadowFilter : Filter

Remarks

The shadow is the alpha of what is filtered, moved by DropShadowFilter.Offset (between pixels, the four around are interpolated), blurred by a Gaussian blur of standard deviation DropShadowFilter.Sigma (transparent beyond the edges), and painted with DropShadowFilter.Color; what is filtered is then drawn over it, unless DropShadowFilter.ShadowOnly is set.

Inheritance
Filter DropShadowFilter

Constructors

NameDescription
DropShadowFilter(Rgba64, PointD, double)Initializes a new instance of the DropShadowFilter class.

DropShadowFilter(Rgba64, PointD, double)

DropShadowFilter.cs

Initializes a new instance of the DropShadowFilter class.

public DropShadowFilter(Rgba64 color, PointD offset, double sigma)

Parameters

color Rgba64
The color of the shadow, with straight alpha. An Rgba32 converts implicitly.
offset PointD
The distance from what is filtered to its shadow, in units of the drawing.
sigma double
The standard deviation of the blur of the shadow, in units of the drawing: what CSS calls a blur radius is twice that. Must be between 0 and 10000.

Exceptions

ArgumentException
A coordinate of offset, or sigma, is not a finite number.
ArgumentOutOfRangeException
The magnitude of a coordinate of offset exceeds 16777216, or sigma is negative or exceeds 10000.

Properties

NameDescription
ColorGets the color of the shadow.
OffsetGets the distance from what is filtered to its shadow.
ShadowOnlyGets a value indicating whether the result is the shadow alone, without what casts it: the shadow of a drawing of the HTML canvas, drawn before the drawing.
SigmaGets the standard deviation of the blur of the shadow.

Gets the color of the shadow.

public Rgba64 Color { get; }

Property value

Rgba64

Gets the distance from what is filtered to its shadow.

public PointD Offset { get; }

Property value

PointD

Gets a value indicating whether the result is the shadow alone, without what casts it: the shadow of a drawing of the HTML canvas, drawn before the drawing.

public bool ShadowOnly { get; init; }

Property value

bool

Gets the standard deviation of the blur of the shadow.

public double Sigma { get; }

Property value

double