PixellatingEffect
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
| Property | Range and default |
|---|---|
Blocks across the element. Default 80; must be above 0. | |
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 | |
|---|---|
PixellatingEffect | Creates the effect with its default settings: HorizontalPixelCounts 80,
VerticalPixelCounts 80. |
| Properties | |
HorizontalPixelCounts | Gets or sets how many blocks the picture is divided into across its width. |
ImplicitInputSampler | Gets or sets the picture the effect works on. |
VerticalPixelCounts | Gets or sets how many rows of blocks the picture is divided into down its height. |
| Fields | |
HorizontalPixelCountsProperty | Identifies the HorizontalPixelCounts dependency property. |
ImplicitInputSamplerProperty | Identifies the ImplicitInputSampler dependency property. |
VerticalPixelCountsProperty | Identifies the VerticalPixelCounts dependency property. |
Constructors
PixellatingEffect
Creates the effect with its default settings: HorizontalPixelCounts 80,
VerticalPixelCounts 80.
Properties
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
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
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
Identifies the HorizontalPixelCounts dependency property.
ImplicitInputSamplerProperty static
Identifies the ImplicitInputSampler dependency property.
VerticalPixelCountsProperty static
Identifies the VerticalPixelCounts dependency property.