HypernovaDesktop Components · docs
Binarymission
WPFShaders Library › DuotoneEffect

DuotoneEffect

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

A pixel shader effect that maps the brightness of its input onto a two-colour ramp - the darkest pixels become ShadowColor, the brightest HighlightColor, and everything else a blend of the two.

public class DuotoneEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

The brightness is measured on the straight colour rather than the premultiplied one WPF hands the shader, so semi-transparent pixels map where they look as though they should. Strength mixes the result back towards the original, so the effect can be dialled in rather than only switched on.

Members at a glance

DuotoneEffectInitializes a new instance of the DuotoneEffect class.
HighlightColorThe colour the brightest pixels are mapped to.
InputThe image this effect is applied to. It is set for you when the effect is attached to an element; set it directly only when using the effect as a brush.
ShadowColorThe colour the darkest pixels are mapped to.
StrengthHow far the ramp replaces the original colour, from 0 (unchanged) to 1 (fully duotone).
HighlightColorPropertyIdentifies the HighlightColor dependency property.
InputPropertyIdentifies the Input dependency property.
ShadowColorPropertyIdentifies the ShadowColor dependency property.
StrengthPropertyIdentifies the Strength dependency property.

Constructors

DuotoneEffect

public DuotoneEffect()

Initializes a new instance of the DuotoneEffect class.

Properties

HighlightColor

public Color HighlightColor

The colour the brightest pixels are mapped to.

Input

public Brush Input

The image this effect is applied to. It is set for you when the effect is attached to an element; set it directly only when using the effect as a brush.

ShadowColor

public Color ShadowColor

The colour the darkest pixels are mapped to.

Strength

public double Strength

How far the ramp replaces the original colour, from 0 (unchanged) to 1 (fully duotone).

Fields

HighlightColorProperty

public static readonly DependencyProperty HighlightColorProperty

Identifies the HighlightColor dependency property.

InputProperty

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.

ShadowColorProperty

public static readonly DependencyProperty ShadowColorProperty

Identifies the ShadowColor dependency property.

StrengthProperty

public static readonly DependencyProperty StrengthProperty

Identifies the Strength dependency property.