DuotoneEffect
Recolours the picture with two colours: its darkest parts become ShadowColor, its
brightest HighlightColor, and everything between a blend of the two – the poster look
of a two-ink print.
public class DuotoneEffect : ShaderEffect
Inherits from / implements: ShaderEffect
Remarks
Brightness is measured on each pixel's true colour, so semi-transparent edges map as they
look. Strength mixes the result back towards the original, so the effect can be
dialled in rather than only switched on. The alpha of the two colours is not used.
Settings
| Property | Range and default |
|---|---|
Colour of the darkest parts. Default deep
navy, | |
Colour of the brightest parts. Default
warm gold, | |
From 0 (the original picture) to 1 (fully two-tone, the default). |
Examples
<Image Source="Photos/harbour.jpg"
xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
<Image.Effect>
<fx:DuotoneEffect ShadowColor="#FF2B1B3D" HighlightColor="#FFF2C14E" Strength="0.85" />
</Image.Effect>
</Image>See also
Members at a glance
| Constructors | |
|---|---|
DuotoneEffect | Creates the effect with its default settings: ShadowColor deep navy,
HighlightColor warm gold, Strength 1. |
| Properties | |
HighlightColor | Gets or sets the colour the brightest parts of the picture become. |
Input | Gets or sets the picture the effect works on. |
ShadowColor | Gets or sets the colour the darkest parts of the picture become. |
Strength | Gets or sets how far the two-tone result replaces the original colours. |
| Fields | |
HighlightColorProperty | Identifies the HighlightColor dependency property. |
InputProperty | Identifies the Input dependency property. |
ShadowColorProperty | Identifies the ShadowColor dependency property. |
StrengthProperty | Identifies the Strength dependency property. |
Constructors
DuotoneEffect
Creates the effect with its default settings: ShadowColor deep navy,
HighlightColor warm gold, Strength 1.
Properties
HighlightColor
Gets or sets the colour the brightest parts of the picture become.
- Value
- The default is warm gold,
#FFFFD67A. Its alpha is not used.
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.
ShadowColor
Gets or sets the colour the darkest parts of the picture become.
- Value
- The default is deep navy,
#FF181C4A. Its alpha is not used.
Strength
Gets or sets how far the two-tone result replaces the original colours.
- Value
- From 0, the original picture, to 1, fully two-tone; the default is 1. Values outside 0 to 1 act as the nearer end.
Fields
HighlightColorProperty static
Identifies the HighlightColor dependency property.
InputProperty static
Identifies the Input dependency property.
ShadowColorProperty static
Identifies the ShadowColor dependency property.
StrengthProperty static
Identifies the Strength dependency property.