forked from kumpera/PixelMagic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShaders.cs
52 lines (42 loc) · 1.28 KB
/
Shaders.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Windows.Media.Imaging;
using System.Windows.Media.Effects;
using System.Windows.Controls;
using System.Windows.Media;
using System.IO;
using System.Windows;
using System.Globalization;
using System.Windows.Shapes;
namespace ShaderTestGen
{
public class Shader : ShaderEffect
{
public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty ("Input", typeof(Shader), 0);
PixelShader shader;
public Shader (string uri)
{
shader = new PixelShader ();
shader.UriSource = new Uri (Driver.MakePath (uri));
PixelShader = shader;
UpdateShaderValue (InputProperty);
}
public Brush Input
{
get { return (Brush)GetValue(InputProperty); }
set { SetValue(InputProperty, value); }
}
}
public class SingleScalarShader : Shader
{
public static readonly DependencyProperty ScalarProperty = DependencyProperty.Register ("Scalar", typeof(double), typeof (SingleScalarShader), new UIPropertyMetadata (0.25, PixelShaderConstantCallback (0)));
public SingleScalarShader (string uri) : base (uri)
{
UpdateShaderValue (ScalarProperty);
}
public double Scalar
{
get { return (double)GetValue (ScalarProperty); }
set { SetValue (ScalarProperty, value); }
}
}
}