HypernovaDesktop Components · docs
Binarymission
WPFShaders Library › VignetteEffect

VignetteEffect

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Shaders.Library.CustomEffects

A pixel shader effect that darkens its input towards the corners, the way a lens falls off at the edge of its coverage.

public class VignetteEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

Everything inside InnerRadius is left alone, so a portrait keeps its face and loses its background. Animate Amount to bring the vignette in and out.

Members at a glance

VignetteEffectInitializes a new instance of the VignetteEffect class.
AmountHow dark the corners are driven, from 0 (no vignette) to 1 (black).
CenterXYThe point the vignette is centred on, in texture coordinates, where (0,0) is the top left of the element and (1,1) the bottom right.
InnerRadiusWhere the darkening begins, as a fraction of the distance from CenterXY to a corner. Everything nearer the centre than this is left untouched.
InputThe image this effect is applied to. It is set for you when the effect is attached to an element; set it directly only when using the effect as a brush.
AmountPropertyIdentifies the Amount dependency property.
CenterXYPropertyIdentifies the CenterXY dependency property.
InnerRadiusPropertyIdentifies the InnerRadius dependency property.
InputPropertyIdentifies the Input dependency property.

Constructors

VignetteEffect

public VignetteEffect()

Initializes a new instance of the VignetteEffect class.

Properties

Amount

public double Amount

How dark the corners are driven, from 0 (no vignette) to 1 (black).

CenterXY

public Point CenterXY

The point the vignette is centred on, in texture coordinates, where (0,0) is the top left of the element and (1,1) the bottom right.

InnerRadius

public double InnerRadius

Where the darkening begins, as a fraction of the distance from CenterXY to a corner. Everything nearer the centre than this is left untouched.

Input

public Brush Input

The image this effect is applied to. It is set for you when the effect is attached to an element; set it directly only when using the effect as a brush.

Fields

AmountProperty

public static readonly DependencyProperty AmountProperty

Identifies the Amount dependency property.

CenterXYProperty

public static readonly DependencyProperty CenterXYProperty

Identifies the CenterXY dependency property.

InnerRadiusProperty

public static readonly DependencyProperty InnerRadiusProperty

Identifies the InnerRadius dependency property.

InputProperty

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.