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
83 public class ShaderGaborAlpha : ShaderField
\r
85 protected Shader.GaborAlphaProgram ps = null;
\r
86 public ShaderGaborAlpha()
\r
88 initialize__ = initialize___;
\r
89 setParameters = setParameters__;
\r
91 internal void initialize()
\r
95 Main.canvas.beginInvoke(initialize___);
\r
99 internal void initialize___()
\r
105 ps = new Shader.GaborAlphaProgram();
\r
106 initializeShader();
\r
109 initialized = true;
\r
113 //public double contrast { get; set; }
\r
114 //public double frequency { get; set; }
\r
115 //public double phase { get; set; }
\r
116 //public double orientation { get; set; }
\r
117 public double contrast = 1.0, wavelength = 20.0, phase = 0.0, orientation = 0.0, alpha = 1.0;
\r
118 public ShaderGaborAlpha setSigma(double s)
\r
124 public void setParameters__()
\r
126 ps.Contrast = contrast;
\r
127 ps.WaveLength = wavelength;
\r
129 ps.Orientation = orientation;
\r
143 internal static partial class Connector
\r
145 internal delegate void PixelShaderConnector(ShaderEffect q, Uri s);
\r
149 public abstract class ShaderProgram : ShaderEffect
\r
153 #region GaborProgram
\r
154 public class GaborProgram : ShaderProgram
\r
156 public static readonly Uri ps = new Uri(@"/PsychlopsSilverlight4;component/Shader/Gabor.ps", UriKind.Relative);
\r
158 public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(GaborProgram), 0);
\r
159 public static readonly DependencyProperty ContrastProperty = DependencyProperty.Register("Contrast", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(1)));
\r
160 public static readonly DependencyProperty FrequencyProperty = DependencyProperty.Register("Frequency", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(100D)), PixelShaderConstantCallback(2)));
\r
161 public static readonly DependencyProperty PhaseProperty = DependencyProperty.Register("Phase", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(3)));
\r
162 public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(4)));
\r
163 public static readonly DependencyProperty SigmaProperty = DependencyProperty.Register("Sigma", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(4D)), PixelShaderConstantCallback(5)));
\r
164 public static readonly DependencyProperty AlphaProperty = DependencyProperty.Register("Alpha", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(6)));
\r
165 public GaborProgram()
\r
167 PixelShader pixelShader = new PixelShader();
\r
168 pixelShader.UriSource = ps;
\r
169 this.PixelShader = pixelShader;
\r
171 this.UpdateShaderValue(InputProperty);
\r
172 this.UpdateShaderValue(ContrastProperty);
\r
173 this.UpdateShaderValue(FrequencyProperty);
\r
174 this.UpdateShaderValue(PhaseProperty);
\r
175 this.UpdateShaderValue(OrientationProperty);
\r
176 this.UpdateShaderValue(SigmaProperty);
\r
177 this.UpdateShaderValue(AlphaProperty);
\r
181 WaveLength = 100.0;
\r
187 public void Update()
\r
189 this.UpdateShaderValue(InputProperty);
\r
190 this.UpdateShaderValue(ContrastProperty);
\r
191 this.UpdateShaderValue(FrequencyProperty);
\r
192 this.UpdateShaderValue(PhaseProperty);
\r
193 this.UpdateShaderValue(OrientationProperty);
\r
194 this.UpdateShaderValue(SigmaProperty);
\r
195 this.UpdateShaderValue(AlphaProperty);
\r
199 private double size__, wavelength__;
\r
200 public double Size { get { return size__; } set { size__ = value; setFrequency(); } }
\r
201 private void setFrequency()
\r
203 double freq = size__ * 2.0 * Math.PI / (wavelength__);
\r
204 this.SetValue(FrequencyProperty, freq);
\r
207 /// <summary>Amplitude of Grating</summary>
\r
208 public double Contrast
\r
212 return ((double)(this.GetValue(ContrastProperty))) * 2.0;
\r
216 this.SetValue(ContrastProperty, value / 2.0);
\r
219 /// <summary>Phase of Grating</summary>
\r
220 public double WaveLength
\r
224 return wavelength__;
\r
228 wavelength__ = value;
\r
232 /// <summary>Phase of Grating</summary>
\r
233 public double Phase
\r
237 return ((double)(this.GetValue(PhaseProperty)));
\r
241 this.SetValue(PhaseProperty, value);
\r
244 /// <summary>Orientation of Grating</summary>
\r
245 public double Orientation
\r
249 return ((double)(this.GetValue(OrientationProperty)));
\r
253 this.SetValue(OrientationProperty, value);
\r
256 /// <summary>Half bandwidth of envelope</summary>
\r
257 public double Sigma
\r
261 return ((double)(this.GetValue(SigmaProperty)));
\r
265 this.SetValue(SigmaProperty, value);
\r
268 /// <summary>Transparency of Figure</summary>
\r
269 public double Alpha
\r
273 return ((double)(this.GetValue(AlphaProperty)));
\r
277 this.SetValue(AlphaProperty, value);
\r
283 #region GaborAlphaProgram
\r
284 public class GaborAlphaProgram : ShaderProgram
\r
286 public static readonly Uri ps = new Uri(@"/PsychlopsSilverlight4;component/Shader/GaborAlpha.ps", UriKind.Relative);
\r
288 public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(GaborAlphaProgram), 0);
\r
289 public static readonly DependencyProperty ContrastProperty = DependencyProperty.Register("Contrast", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(1)));
\r
290 public static readonly DependencyProperty FrequencyProperty = DependencyProperty.Register("Frequency", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(100D)), PixelShaderConstantCallback(2)));
\r
291 public static readonly DependencyProperty PhaseProperty = DependencyProperty.Register("Phase", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(3)));
\r
292 public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(4)));
\r
293 public static readonly DependencyProperty SigmaProperty = DependencyProperty.Register("Sigma", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(4D)), PixelShaderConstantCallback(5)));
\r
294 public static readonly DependencyProperty AlphaProperty = DependencyProperty.Register("Alpha", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(6)));
\r
295 public GaborAlphaProgram()
\r
297 PixelShader pixelShader = new PixelShader();
\r
298 pixelShader.UriSource = ps;
\r
299 this.PixelShader = pixelShader;
\r
301 this.UpdateShaderValue(InputProperty);
\r
302 this.UpdateShaderValue(ContrastProperty);
\r
303 this.UpdateShaderValue(FrequencyProperty);
\r
304 this.UpdateShaderValue(PhaseProperty);
\r
305 this.UpdateShaderValue(OrientationProperty);
\r
306 this.UpdateShaderValue(SigmaProperty);
\r
307 this.UpdateShaderValue(AlphaProperty);
\r
311 WaveLength = 100.0;
\r
317 public void Update()
\r
319 this.UpdateShaderValue(InputProperty);
\r
320 this.UpdateShaderValue(ContrastProperty);
\r
321 this.UpdateShaderValue(FrequencyProperty);
\r
322 this.UpdateShaderValue(PhaseProperty);
\r
323 this.UpdateShaderValue(OrientationProperty);
\r
324 this.UpdateShaderValue(SigmaProperty);
\r
325 this.UpdateShaderValue(AlphaProperty);
\r
329 private double size__, wavelength__;
\r
330 public double Size { get { return size__; } set { size__ = value; setFrequency(); } }
\r
331 private void setFrequency()
\r
333 double freq = size__ * 2.0 * Math.PI / (wavelength__);
\r
334 this.SetValue(FrequencyProperty, freq);
\r
337 /// <summary>Amplitude of Grating</summary>
\r
338 public double Contrast
\r
342 return ((double)(this.GetValue(ContrastProperty))) * 2.0;
\r
346 this.SetValue(ContrastProperty, value / 2.0);
\r
349 /// <summary>Phase of Grating</summary>
\r
350 public double WaveLength
\r
354 return wavelength__;
\r
358 wavelength__ = value;
\r
362 /// <summary>Phase of Grating</summary>
\r
363 public double Phase
\r
367 return ((double)(this.GetValue(PhaseProperty)));
\r
371 this.SetValue(PhaseProperty, value);
\r
374 /// <summary>Orientation of Grating</summary>
\r
375 public double Orientation
\r
379 return ((double)(this.GetValue(OrientationProperty)));
\r
383 this.SetValue(OrientationProperty, value);
\r
386 /// <summary>Half bandwidth of envelope</summary>
\r
387 public double Sigma
\r
391 return ((double)(this.GetValue(SigmaProperty)));
\r
395 this.SetValue(SigmaProperty, value);
\r
398 /// <summary>Transparency of Figure</summary>
\r
399 public double Alpha
\r
403 return ((double)(this.GetValue(AlphaProperty)));
\r
407 this.SetValue(AlphaProperty, value);
\r