VignetteEffect
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
| Property | Range and default |
|---|---|
How dark the corners become, from 0 (no change) to 1 (black). Default 0.75. | |
Where darkening starts, from 0 (at the centre) to 1 (at the corners). Default 0.35. | |
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 | |
|---|---|
VignetteEffect | Creates the effect with its default settings: Amount 0.75, InnerRadius
0.35, CenterXY (0.5,0.5). |
| Properties | |
Amount | Gets or sets how dark the corners become. |
CenterXY | Gets or sets the middle of the vignette – the point left brightest. |
InnerRadius | Gets or sets where the darkening begins. |
Input | Gets or sets the picture the effect works on. |
| Fields | |
AmountProperty | Identifies the Amount dependency property. |
CenterXYProperty | Identifies the CenterXY dependency property. |
InnerRadiusProperty | Identifies the InnerRadius dependency property. |
InputProperty | Identifies the Input dependency property. |
Constructors
VignetteEffect
Creates the effect with its default settings: Amount 0.75, InnerRadius
0.35, CenterXY (0.5,0.5).
Properties
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
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
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
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
Identifies the Amount dependency property.
CenterXYProperty static
Identifies the CenterXY dependency property.
InnerRadiusProperty static
Identifies the InnerRadius dependency property.
InputProperty static
Identifies the Input dependency property.