HypernovaDesktop Components · docs
Binarymission
WPF › Shaders Library › PixellatingEffect

PixellatingEffect

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

Breaks the picture into flat-coloured blocks, each the colour of the picture at its centre, with every other row offset by half a block like courses of brickwork.

public class PixellatingEffect : System.Windows.Media.Effects.ShaderEffect

Inherits from / implements: System.Windows.Media.Effects.ShaderEffect

Remarks

Use it to obscure something – a face, a number – or animate the counts upward to resolve a picture out of the blocks. For hexagons instead, see HexPixellateEffect.

Settings

PropertyRange and default

HorizontalPixelCounts

Blocks across the element. Default 80; must be above 0.

VerticalPixelCounts

Rows of blocks down the element. Default 80; must be above 0.

Examples

<Image Source="Photos/team.jpg"
       xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
    <Image.Effect>
        <fx:PixellatingEffect HorizontalPixelCounts="40" VerticalPixelCounts="30" />
    </Image.Effect>
</Image>

See also

Members at a glance

Constructors
PixellatingEffectCreates the effect with its default settings: HorizontalPixelCounts 80, VerticalPixelCounts 80.
Properties
HorizontalPixelCountsGets or sets how many blocks the picture is divided into across its width.
ImplicitInputSamplerGets or sets the picture the effect works on.
VerticalPixelCountsGets or sets how many rows of blocks the picture is divided into down its height.
Fields
HorizontalPixelCountsPropertyIdentifies the HorizontalPixelCounts dependency property.
ImplicitInputSamplerPropertyIdentifies the ImplicitInputSampler dependency property.
VerticalPixelCountsPropertyIdentifies the VerticalPixelCounts dependency property.

Constructors

PixellatingEffect

public PixellatingEffect()

Creates the effect with its default settings: HorizontalPixelCounts 80, VerticalPixelCounts 80.

Properties

HorizontalPixelCounts

public virtual float HorizontalPixelCounts

Gets or sets how many blocks the picture is divided into across its width.

Value
The default is 80. Fewer blocks give a coarser picture. It must be greater than 0.

ImplicitInputSampler

public virtual System.Windows.Media.Brush ImplicitInputSampler

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.

VerticalPixelCounts

public virtual float VerticalPixelCounts

Gets or sets how many rows of blocks the picture is divided into down its height.

Value
The default is 80. Fewer rows give a coarser picture. It must be greater than 0.

Fields

HorizontalPixelCountsProperty static

public static readonly DependencyProperty HorizontalPixelCountsProperty

Identifies the HorizontalPixelCounts dependency property.

ImplicitInputSamplerProperty static

public static readonly DependencyProperty ImplicitInputSamplerProperty

Identifies the ImplicitInputSampler dependency property.

VerticalPixelCountsProperty static

public static readonly DependencyProperty VerticalPixelCountsProperty

Identifies the VerticalPixelCounts dependency property.