|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Linq; |
| 4 | +using System.Text; |
| 5 | +using System.Windows; |
| 6 | +using System.Windows.Media.Effects; |
| 7 | + |
| 8 | +namespace EmptyKeys.UserInterface.Designer.Effects |
| 9 | +{ |
| 10 | + /// <summary> |
| 11 | + /// Implements Directional Blur effect |
| 12 | + /// </summary> |
| 13 | + public class DirectionalBlurEffect : ShaderEffect |
| 14 | + { |
| 15 | + private static Type typeOfThis = typeof(DirectionalBlurEffect); |
| 16 | + |
| 17 | + /// <summary> |
| 18 | + /// The angle property |
| 19 | + /// </summary> |
| 20 | + public static readonly DependencyProperty AngleProperty = |
| 21 | + DependencyProperty.Register("Angle", typeof(float), typeOfThis, |
| 22 | + new FrameworkPropertyMetadata(0f, FrameworkPropertyMetadataOptions.AffectsRender)); |
| 23 | + |
| 24 | + /// <summary> |
| 25 | + /// Gets or sets the angle. |
| 26 | + /// </summary> |
| 27 | + /// <value> |
| 28 | + /// The angle. |
| 29 | + /// </value> |
| 30 | + public float Angle |
| 31 | + { |
| 32 | + get { return (float)GetValue(AngleProperty); } |
| 33 | + set { SetValue(AngleProperty, value); } |
| 34 | + } |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// The blur amount property |
| 38 | + /// </summary> |
| 39 | + public static readonly DependencyProperty BlurAmountProperty = |
| 40 | + DependencyProperty.Register("BlurAmount", typeof(float), typeOfThis, |
| 41 | + new FrameworkPropertyMetadata(0f, FrameworkPropertyMetadataOptions.AffectsRender)); |
| 42 | + |
| 43 | + /// <summary> |
| 44 | + /// Gets or sets the blur amount. |
| 45 | + /// </summary> |
| 46 | + /// <value> |
| 47 | + /// The blur amount. |
| 48 | + /// </value> |
| 49 | + public float BlurAmount |
| 50 | + { |
| 51 | + get { return (float)GetValue(BlurAmountProperty); } |
| 52 | + set { SetValue(BlurAmountProperty, value); } |
| 53 | + } |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Initializes a new instance of the <see cref="DirectionalBlurEffect"/> class. |
| 57 | + /// </summary> |
| 58 | + public DirectionalBlurEffect() : base() |
| 59 | + { |
| 60 | + var pixelShader = new PixelShader(); |
| 61 | + var fileUri = new Uri("pack://application:,,,/EmptyKeys.UserInterface.Designer;component/Effects/FakeShader.ps", UriKind.RelativeOrAbsolute); |
| 62 | + pixelShader.UriSource = fileUri; |
| 63 | + PixelShader = pixelShader; |
| 64 | + } |
| 65 | + } |
| 66 | +} |
0 commit comments