HypernovaDesktop Components · docs
Binarymission
WPF › Shaders Library › DuotoneEffect

DuotoneEffect

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

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

PropertyRange and default

ShadowColor

Colour of the darkest parts. Default deep navy, #FF181C4A.

HighlightColor

Colour of the brightest parts. Default warm gold, #FFFFD67A.

Strength

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
DuotoneEffectCreates the effect with its default settings: ShadowColor deep navy, HighlightColor warm gold, Strength 1.
Properties
HighlightColorGets or sets the colour the brightest parts of the picture become.
InputGets or sets the picture the effect works on.
ShadowColorGets or sets the colour the darkest parts of the picture become.
StrengthGets or sets how far the two-tone result replaces the original colours.
Fields
HighlightColorPropertyIdentifies the HighlightColor dependency property.
InputPropertyIdentifies the Input dependency property.
ShadowColorPropertyIdentifies the ShadowColor dependency property.
StrengthPropertyIdentifies the Strength dependency property.

Constructors

DuotoneEffect

public DuotoneEffect()

Creates the effect with its default settings: ShadowColor deep navy, HighlightColor warm gold, Strength 1.

Properties

HighlightColor

public Color 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

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.

ShadowColor

public Color 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

public double 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

public static readonly DependencyProperty HighlightColorProperty

Identifies the HighlightColor dependency property.

InputProperty static

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.

ShadowColorProperty static

public static readonly DependencyProperty ShadowColorProperty

Identifies the ShadowColor dependency property.

StrengthProperty static

public static readonly DependencyProperty StrengthProperty

Identifies the Strength dependency property.