HypernovaDesktop Components · docs
Binarymission
WPF › Shaders Library › HueRotateEffect

HueRotateEffect

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

Turns every colour in the picture round the colour wheel – reds towards greens, greens towards blues - while leaving how light or dark it is unchanged.

public class HueRotateEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

The rotation is the constant-brightness one SVG's hueRotate uses, so a light pixel stays light. Animating Angle through a full turn sweeps the picture through the spectrum and back to the original.

Settings

PropertyRange and default

Angle

The turn, in radians: two pi (about 6.283) is a full turn back to the original. Default 2.0943951, a third of a turn.

Examples

A logo that cycles slowly through the spectrum.

<Image Source="Images/logo.png"
       xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
    <Image.Effect>
        <fx:HueRotateEffect x:Name="Hue" Angle="0" />
    </Image.Effect>
    <Image.Triggers>
        <EventTrigger RoutedEvent="Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="Hue" Storyboard.TargetProperty="Angle"
                                     From="0" To="6.2831853" Duration="0:0:8" RepeatBehavior="Forever" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Image.Triggers>
</Image>

See also

Members at a glance

Constructors
HueRotateEffectCreates the effect with its default settings: Angle a third of a turn.
Properties
AngleGets or sets how far the colours are turned round the colour wheel.
InputGets or sets the picture the effect works on.
Fields
AnglePropertyIdentifies the Angle dependency property.
InputPropertyIdentifies the Input dependency property.

Constructors

HueRotateEffect

public HueRotateEffect()

Creates the effect with its default settings: Angle a third of a turn.

Properties

Angle

public double Angle

Gets or sets how far the colours are turned round the colour wheel.

Value
In radians: two pi (about 6.283) is a full turn back to the original, and a negative value turns the other way. The default is 2.0943951, a third of a turn, so the effect shows without configuration.

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.

Fields

AngleProperty static

public static readonly DependencyProperty AngleProperty

Identifies the Angle dependency property.

InputProperty static

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.