ChromaticSplitEffect
Pulls the red and blue channels of the picture apart towards its edges, leaving green in place – the colour fringing a cheap lens leaves at the corners of a photograph.
public class ChromaticSplitEffect : ShaderEffect
Inherits from / implements: ShaderEffect
Remarks
The separation grows with the distance from CenterXY, so the middle of the
picture stays sharp and the corners fringe. Animating Displacement over a small range
reads as a focus pull; over a large one, as a glitch.
Settings
| Property | Range and default |
|---|---|
How far the channels part, growing towards the edges. Default 0.02; 0 leaves the picture unchanged, and 0.005 to 0.08 is the useful range. | |
Where the picture stays sharp, 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/harbour.jpg"
xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
<Image.Effect>
<fx:ChromaticSplitEffect Displacement="0.03" />
</Image.Effect>
</Image>See also
Members at a glance
| Constructors | |
|---|---|
ChromaticSplitEffect | Creates the effect with its default settings: Displacement 0.02,
CenterXY (0.5,0.5). |
| Properties | |
CenterXY | Gets or sets the point the separation spreads out from, where the picture stays sharp. |
Displacement | Gets or sets how far the red and blue channels are pushed apart. |
Input | Gets or sets the picture the effect works on. |
| Fields | |
CenterXYProperty | Identifies the CenterXY dependency property. |
DisplacementProperty | Identifies the Displacement dependency property. |
InputProperty | Identifies the Input dependency property. |
Constructors
ChromaticSplitEffect
Creates the effect with its default settings: Displacement 0.02,
CenterXY (0.5,0.5).
Properties
CenterXY
Gets or sets the point the separation spreads out from, where the picture stays sharp.
- 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.
Displacement
Gets or sets how far the red and blue channels are pushed apart.
- Value
- A fraction of each pixel's distance from
CenterXY; the default is 0.02. 0 leaves the picture unchanged, 0.005 to 0.08 is the useful range, and a negative value swaps the directions red and blue move in.
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
CenterXYProperty static
Identifies the CenterXY dependency property.
DisplacementProperty static
Identifies the Displacement dependency property.
InputProperty static
Identifies the Input dependency property.