HypernovaDesktop Components · docs
Binarymission
WPF › Shaders Library › VignetteEffect

VignetteEffect

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

Darkens the picture towards its corners, the way a lens falls off at the edge of its coverage, drawing the eye to the middle.

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; the darkening then eases in towards the corners rather than starting at a visible ring. Animate Amount to bring the vignette in and out.

Settings

PropertyRange and default

Amount

How dark the corners become, from 0 (no change) to 1 (black). Default 0.75.

InnerRadius

Where darkening starts, from 0 (at the centre) to 1 (at the corners). Default 0.35.

CenterXY

Middle of the vignette, in relative coordinates: (0,0) is the top-left corner of the element and (1,1) its bottom-right. Default (0.5,0.5).

Examples

<Image Source="Photos/portrait.jpg"
       xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
    <Image.Effect>
        <fx:VignetteEffect Amount="0.6" InnerRadius="0.45" />
    </Image.Effect>
</Image>

See also

Members at a glance

Constructors
VignetteEffectCreates the effect with its default settings: Amount 0.75, InnerRadius 0.35, CenterXY (0.5,0.5).
Properties
AmountGets or sets how dark the corners become.
CenterXYGets or sets the middle of the vignette – the point left brightest.
InnerRadiusGets or sets where the darkening begins.
InputGets or sets the picture the effect works on.
Fields
AmountPropertyIdentifies the Amount dependency property.
CenterXYPropertyIdentifies the CenterXY dependency property.
InnerRadiusPropertyIdentifies the InnerRadius dependency property.
InputPropertyIdentifies the Input dependency property.

Constructors

VignetteEffect

public VignetteEffect()

Creates the effect with its default settings: Amount 0.75, InnerRadius 0.35, CenterXY (0.5,0.5).

Properties

Amount

public double Amount

Gets or sets how dark the corners become.

Value
From 0, no vignette, to 1, black corners; the default is 0.75. Values outside 0 to 1 act as the nearer end.

CenterXY

public Point CenterXY

Gets or sets the middle of the vignette – the point left brightest.

Value
A point in relative coordinates: (0,0) is the top-left corner of the element and (1,1) its bottom-right. The default is (0.5,0.5), the middle.

InnerRadius

public double InnerRadius

Gets or sets where the darkening begins.

Value
A fraction of the distance from the centre to a corner, from 0 to 1; the default is 0.35. Everything nearer the centre is left untouched. Values outside 0 to 1 act as the nearer end.

Input

public Brush Input

Gets or sets the picture the effect works on.

Value
A brush. The default is the element the effect is applied to, as WPF renders it – the effect's implicit input.
Remarks

Leave it unset in the usual case, where the effect is set as an element's Effect. Set it to a ImageBrush or VisualBrush to have the effect work on that picture instead.

Fields

AmountProperty static

public static readonly DependencyProperty AmountProperty

Identifies the Amount dependency property.

CenterXYProperty static

public static readonly DependencyProperty CenterXYProperty

Identifies the CenterXY dependency property.

InnerRadiusProperty static

public static readonly DependencyProperty InnerRadiusProperty

Identifies the InnerRadius dependency property.

InputProperty static

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.