1 //------------------------------------------------------------------------------
\r
3 // このコードはツールによって生成されました。
\r
4 // ランタイム バージョン:4.0.30319.1
\r
6 // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
\r
7 // コードが再生成されるときに損失したりします。
\r
9 //------------------------------------------------------------------------------
\r
12 using System.Windows;
\r
13 using System.Windows.Media;
\r
14 using System.Windows.Media.Effects;
\r
15 using System.Windows.Media.Media3D;
\r
22 public static partial class Figures
\r
26 public class ShaderGabor : ShaderField
\r
28 protected Shader.GaborProgram ps = null;
\r
29 public ShaderGabor()
\r
31 initialize__ = initialize___;
\r
32 setParameters = setParameters__;
\r
34 internal void initialize()
\r
38 Main.canvas.beginInvoke(initialize___);
\r
42 internal void initialize___()
\r
48 ps = new Shader.GaborProgram();
\r
56 //public double contrast { get; set; }
\r
57 //public double frequency { get; set; }
\r
58 //public double phase { get; set; }
\r
59 //public double orientation { get; set; }
\r
60 public double contrast = 1.0, wavelength = 20.0, phase = 0.0, orientation = 0.0, alpha = 1.0;
\r
61 public ShaderGabor setSigma(double s)
\r
67 public void setParameters__()
\r
69 ps.Contrast = contrast;
\r
70 ps.WaveLength = wavelength;
\r
72 ps.Orientation = orientation;
\r
86 internal static partial class Connector
\r
88 internal delegate void PixelShaderConnector(ShaderEffect q, Uri s);
\r
92 public abstract class ShaderProgram : ShaderEffect
\r
96 public class GaborProgram : ShaderProgram
\r
98 public static readonly Uri ps = new Uri(@"/PsychlopsSilverlight4;component/Shader/Gabor.ps", UriKind.Relative);
\r
100 public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(GaborProgram), 0);
\r
101 public static readonly DependencyProperty ContrastProperty = DependencyProperty.Register("Contrast", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(1)));
\r
102 public static readonly DependencyProperty FrequencyProperty = DependencyProperty.Register("Frequency", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(100D)), PixelShaderConstantCallback(2)));
\r
103 public static readonly DependencyProperty PhaseProperty = DependencyProperty.Register("Phase", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(3)));
\r
104 public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(4)));
\r
105 public static readonly DependencyProperty SigmaProperty = DependencyProperty.Register("Sigma", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(4D)), PixelShaderConstantCallback(5)));
\r
106 public static readonly DependencyProperty AlphaProperty = DependencyProperty.Register("Alpha", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(6)));
\r
107 public GaborProgram()
\r
109 PixelShader pixelShader = new PixelShader();
\r
110 pixelShader.UriSource = ps;
\r
111 this.PixelShader = pixelShader;
\r
113 this.UpdateShaderValue(InputProperty);
\r
114 this.UpdateShaderValue(ContrastProperty);
\r
115 this.UpdateShaderValue(FrequencyProperty);
\r
116 this.UpdateShaderValue(PhaseProperty);
\r
117 this.UpdateShaderValue(OrientationProperty);
\r
118 this.UpdateShaderValue(SigmaProperty);
\r
119 this.UpdateShaderValue(AlphaProperty);
\r
123 WaveLength = 100.0;
\r
129 public void Update()
\r
131 this.UpdateShaderValue(InputProperty);
\r
132 this.UpdateShaderValue(ContrastProperty);
\r
133 this.UpdateShaderValue(FrequencyProperty);
\r
134 this.UpdateShaderValue(PhaseProperty);
\r
135 this.UpdateShaderValue(OrientationProperty);
\r
136 this.UpdateShaderValue(SigmaProperty);
\r
137 this.UpdateShaderValue(AlphaProperty);
\r
141 private double size__, wavelength__;
\r
142 public double Size { get { return size__; } set { size__ = value; setFrequency(); } }
\r
143 private void setFrequency()
\r
145 double freq = size__ * 2.0 * Math.PI / (wavelength__);
\r
146 this.SetValue(FrequencyProperty, freq);
\r
149 /// <summary>Amplitude of Grating</summary>
\r
150 public double Contrast
\r
154 return ((double)(this.GetValue(ContrastProperty))) * 2.0;
\r
158 this.SetValue(ContrastProperty, value / 2.0);
\r
161 /// <summary>Phase of Grating</summary>
\r
162 public double WaveLength
\r
166 return wavelength__;
\r
170 wavelength__ = value;
\r
174 /// <summary>Phase of Grating</summary>
\r
175 public double Phase
\r
179 return ((double)(this.GetValue(PhaseProperty)));
\r
183 this.SetValue(PhaseProperty, value);
\r
186 /// <summary>Orientation of Grating</summary>
\r
187 public double Orientation
\r
191 return ((double)(this.GetValue(OrientationProperty)));
\r
195 this.SetValue(OrientationProperty, value);
\r
198 /// <summary>Half bandwidth of envelope</summary>
\r
199 public double Sigma
\r
203 return ((double)(this.GetValue(SigmaProperty)));
\r
207 this.SetValue(SigmaProperty, value);
\r
210 /// <summary>Transparency of Figure</summary>
\r
211 public double Alpha
\r
215 return ((double)(this.GetValue(AlphaProperty)));
\r
219 this.SetValue(AlphaProperty, value);
\r