HypernovaDesktop Components · docs
Binarymission
WPFShaders Library › BulgeEffect

BulgeEffect

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

A pixel shader effect that pushes its input outwards inside a circular lens, or pulls it inwards when Amount is negative - a magnifying glass one way, a pinch the other.

public class BulgeEffect : ShaderEffect

Inherits from / implements: ShaderEffect

Remarks

Only what falls inside Radius moves, and the displacement eases to nothing at the rim, so the lens blends into the untouched picture instead of showing as a hard circle. Animate Amount across zero to go from pinch to bulge in one pass.

Members at a glance

BulgeEffectInitializes a new instance of the BulgeEffect class.
AmountHow strongly the lens distorts. Positive values bulge outwards, negative values pinch inwards, and zero leaves the input untouched.
CenterXYThe centre of the lens, in texture coordinates, where (0,0) is the top left of the element and (1,1) the bottom right.
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.
RadiusHow far the lens reaches, in texture coordinates, measured from CenterXY.
AmountPropertyIdentifies the Amount dependency property.
CenterXYPropertyIdentifies the CenterXY dependency property.
InputPropertyIdentifies the Input dependency property.
RadiusPropertyIdentifies the Radius dependency property.

Constructors

BulgeEffect

public BulgeEffect()

Initializes a new instance of the BulgeEffect class.

Properties

Amount

public double Amount

How strongly the lens distorts. Positive values bulge outwards, negative values pinch inwards, and zero leaves the input untouched.

CenterXY

public Point CenterXY

The centre of the lens, in texture coordinates, where (0,0) is the top left of the element and (1,1) the bottom right.

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.

Radius

public double Radius

How far the lens reaches, in texture coordinates, measured from CenterXY.

Fields

AmountProperty

public static readonly DependencyProperty AmountProperty

Identifies the Amount dependency property.

CenterXYProperty

public static readonly DependencyProperty CenterXYProperty

Identifies the CenterXY dependency property.

InputProperty

public static readonly DependencyProperty InputProperty

Identifies the Input dependency property.

RadiusProperty

public static readonly DependencyProperty RadiusProperty

Identifies the Radius dependency property.