HexPixellateEffect
Turns the picture into a mosaic of flat-coloured hexagons, each the colour of the picture at its centre.
public class HexPixellateEffect : ShaderEffect
Inherits from / implements: ShaderEffect
Remarks
The hexagonal counterpart of PixellatingEffect. Animating HexSize
down from something large resolves the picture out of the mosaic – a striking reveal for a
photograph or a screenshot.
Settings
| Property | Range and default |
|---|---|
Width of one hexagon, as a fraction of the element: 0.04, the default, gives about twenty-five across. Values below 0.002 count as 0.002. |
Examples
A photograph that resolves out of the mosaic as it loads.
<Image Source="Photos/harbour.jpg"
xmlns:fx="clr-namespace:Binarymission.WPF.Shaders.Library.CustomEffects;assembly=Binarymission.WPF.Shaders.Library">
<Image.Effect>
<fx:HexPixellateEffect x:Name="Mosaic" HexSize="0.1" />
</Image.Effect>
<Image.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Mosaic" Storyboard.TargetProperty="HexSize"
To="0.002" Duration="0:0:1.5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>See also
Members at a glance
| Constructors | |
|---|---|
HexPixellateEffect | Creates the effect with its default settings: HexSize 0.04. |
| Properties | |
HexSize | Gets or sets the size of the hexagons. |
Input | Gets or sets the picture the effect works on. |
| Fields | |
HexSizeProperty | Identifies the HexSize dependency property. |
InputProperty | Identifies the Input dependency property. |
Constructors
HexPixellateEffect
Creates the effect with its default settings: HexSize 0.04.
Properties
HexSize
Gets or sets the size of the hexagons.
- Value
- The width of one hexagon as a fraction of the element's width: the default, 0.04, gives about twenty-five across. Values below 0.002 count as 0.002, the finest mosaic.
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
HexSizeProperty static
Identifies the HexSize dependency property.
InputProperty static
Identifies the Input dependency property.