Table of Contents

Class DropShadowOptions

Namespace
Egami.Operations
Assembly
Egami.dll

The less common settings of DropShadow(float, float, float, Rgba8, DropShadowOptions?): a different vertical blur, whether the canvas grows, whether only the shadow is kept, and how the blur is computed.

public sealed record DropShadowOptions : IEquatable<DropShadowOptions>
Inheritance
DropShadowOptions
Implements
Inherited Members

Examples

// Skia's DropShadow: 6 px right and down, blurred with sigma 8, black at 55%; the canvas grows to hold the shadow.
using Raster shadowed = logo.Derive(ops => ops.DropShadow(6, 6, 8, new Rgba8(0, 0, 0, 140)), Ct);

// Keep the size, or keep only the shadow (as Skia's DropShadowOnly and ImageMagick's -shadow).
using Raster same = logo.Derive(ops => ops.DropShadow(4, 4, 3, Rgba8.Black, new DropShadowOptions { Expand = false }), Ct);
using Raster shadow = logo.Derive(ops => ops.DropShadow(0, 10, 12, Rgba8.Black, new DropShadowOptions { ShadowOnly = true, SigmaY = 6 }), Ct);

Properties

Expand

Gets a value indicating whether the canvas grows to hold the whole shadow: by 3σ plus the offset, on the sides the shadow reaches past the image, so nothing is cut off. Defaults to true; then the step changes the size and cannot run inside Within(Rect, Action<RasterOps>). false keeps the size, clipping the shadow at the image's edges.

public bool Expand { get; init; }

Property Value

bool

Method

Gets how the blur is computed. Defaults to Fast, whose cost does not grow with σ; Exact uses the Gaussian kernel itself.

public BlurMethod Method { get; init; }

Property Value

BlurMethod

Exceptions

ArgumentOutOfRangeException

The value is not defined.

ShadowOnly

Gets a value indicating whether only the shadow is kept, without the image on it, as Skia's DropShadowOnly and ImageMagick's -shadow. Defaults to false.

public bool ShadowOnly { get; init; }

Property Value

bool

SigmaY

Gets the vertical blur in pixels, from 0 to 1000, as Skia's sigmaY; null (the default) uses the horizontal sigma.

public float? SigmaY { get; init; }

Property Value

float?

Exceptions

ArgumentOutOfRangeException

The value is negative, above 1000 or not a number.