//------------------------------------------------------------------------------
//
// このコードはツールによって生成されました。
// ランタイム バージョン:4.0.30319.1
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
//
//------------------------------------------------------------------------------
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Effects;
using System.Windows.Media.Media3D;
namespace Psychlops
{
public static partial class Figures
{
public class ShaderGabor : ShaderField
{
protected Shader.GaborProgram ps = null;
public ShaderGabor()
{
initialize__ = initialize___;
setParameters = setParameters__;
}
internal void initialize()
{
if (!initialized)
{
Main.canvas.beginInvoke(initialize___);
initialized = true;
}
}
internal void initialize___()
{
if (!initialized)
{
if (ps == null)
{
ps = new Shader.GaborProgram();
initializeShader();
}
shader = ps;
initialized = true;
}
}
//public double contrast { get; set; }
//public double frequency { get; set; }
//public double phase { get; set; }
//public double orientation { get; set; }
public double contrast = 1.0, wavelength = 20.0, phase = 0.0, orientation = 0.0, alpha = 1.0;
public ShaderGabor setSigma(double s)
{
set(s*8, s*8);
return this;
}
public void setParameters__()
{
ps.Contrast = contrast;
ps.WaveLength = wavelength;
ps.Phase = phase;
ps.Orientation = orientation;
ps.Sigma = 4.0;
ps.Size = width;
ps.Alpha = alpha;
ps.Update();
}
}
public class ShaderGaborAlpha : ShaderField
{
protected Shader.GaborAlphaProgram ps = null;
public ShaderGaborAlpha()
{
initialize__ = initialize___;
setParameters = setParameters__;
}
internal void initialize()
{
if (!initialized)
{
Main.canvas.beginInvoke(initialize___);
initialized = true;
}
}
internal void initialize___()
{
if (!initialized)
{
if (ps == null)
{
ps = new Shader.GaborAlphaProgram();
initializeShader();
}
shader = ps;
initialized = true;
}
}
//public double contrast { get; set; }
//public double frequency { get; set; }
//public double phase { get; set; }
//public double orientation { get; set; }
public double contrast = 1.0, wavelength = 20.0, phase = 0.0, orientation = 0.0, alpha = 1.0;
public ShaderGaborAlpha setSigma(double s)
{
set(s * 8, s * 8);
return this;
}
public void setParameters__()
{
ps.Contrast = contrast;
ps.WaveLength = wavelength;
ps.Phase = phase;
ps.Orientation = orientation;
ps.Sigma = 4.0;
ps.Size = width;
ps.Alpha = alpha;
ps.Update();
}
}
}
namespace Shader
{
internal static partial class Connector
{
internal delegate void PixelShaderConnector(ShaderEffect q, Uri s);
}
public abstract class ShaderProgram : ShaderEffect
{
}
#region GaborProgram
public class GaborProgram : ShaderProgram
{
public static readonly Uri ps = new Uri(@"/PsychlopsSilverlight4;component/Shader/Gabor.ps", UriKind.Relative);
public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(GaborProgram), 0);
public static readonly DependencyProperty ContrastProperty = DependencyProperty.Register("Contrast", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(1)));
public static readonly DependencyProperty FrequencyProperty = DependencyProperty.Register("Frequency", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(100D)), PixelShaderConstantCallback(2)));
public static readonly DependencyProperty PhaseProperty = DependencyProperty.Register("Phase", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(3)));
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(4)));
public static readonly DependencyProperty SigmaProperty = DependencyProperty.Register("Sigma", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(4D)), PixelShaderConstantCallback(5)));
public static readonly DependencyProperty AlphaProperty = DependencyProperty.Register("Alpha", typeof(double), typeof(GaborProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(6)));
public GaborProgram()
{
PixelShader pixelShader = new PixelShader();
pixelShader.UriSource = ps;
this.PixelShader = pixelShader;
this.UpdateShaderValue(InputProperty);
this.UpdateShaderValue(ContrastProperty);
this.UpdateShaderValue(FrequencyProperty);
this.UpdateShaderValue(PhaseProperty);
this.UpdateShaderValue(OrientationProperty);
this.UpdateShaderValue(SigmaProperty);
this.UpdateShaderValue(AlphaProperty);
Size = 200;
Contrast = 1.0;
WaveLength = 100.0;
Orientation = 0.0;
Sigma = 4.0;
Alpha = 1.0;
}
public void Update()
{
this.UpdateShaderValue(InputProperty);
this.UpdateShaderValue(ContrastProperty);
this.UpdateShaderValue(FrequencyProperty);
this.UpdateShaderValue(PhaseProperty);
this.UpdateShaderValue(OrientationProperty);
this.UpdateShaderValue(SigmaProperty);
this.UpdateShaderValue(AlphaProperty);
}
private double size__, wavelength__;
public double Size { get { return size__; } set { size__ = value; setFrequency(); } }
private void setFrequency()
{
double freq = size__ * 2.0 * Math.PI / (wavelength__);
this.SetValue(FrequencyProperty, freq);
}
/// Amplitude of Grating
public double Contrast
{
get
{
return ((double)(this.GetValue(ContrastProperty))) * 2.0;
}
set
{
this.SetValue(ContrastProperty, value / 2.0);
}
}
/// Phase of Grating
public double WaveLength
{
get
{
return wavelength__;
}
set
{
wavelength__ = value;
setFrequency();
}
}
/// Phase of Grating
public double Phase
{
get
{
return ((double)(this.GetValue(PhaseProperty)));
}
set
{
this.SetValue(PhaseProperty, value);
}
}
/// Orientation of Grating
public double Orientation
{
get
{
return ((double)(this.GetValue(OrientationProperty)));
}
set
{
this.SetValue(OrientationProperty, value);
}
}
/// Half bandwidth of envelope
public double Sigma
{
get
{
return ((double)(this.GetValue(SigmaProperty)));
}
set
{
this.SetValue(SigmaProperty, value);
}
}
/// Transparency of Figure
public double Alpha
{
get
{
return ((double)(this.GetValue(AlphaProperty)));
}
set
{
this.SetValue(AlphaProperty, value);
}
}
}
#endregion
#region GaborAlphaProgram
public class GaborAlphaProgram : ShaderProgram
{
public static readonly Uri ps = new Uri(@"/PsychlopsSilverlight4;component/Shader/GaborAlpha.ps", UriKind.Relative);
public static readonly DependencyProperty InputProperty = ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(GaborAlphaProgram), 0);
public static readonly DependencyProperty ContrastProperty = DependencyProperty.Register("Contrast", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(1)));
public static readonly DependencyProperty FrequencyProperty = DependencyProperty.Register("Frequency", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(100D)), PixelShaderConstantCallback(2)));
public static readonly DependencyProperty PhaseProperty = DependencyProperty.Register("Phase", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(3)));
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(0D)), PixelShaderConstantCallback(4)));
public static readonly DependencyProperty SigmaProperty = DependencyProperty.Register("Sigma", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(4D)), PixelShaderConstantCallback(5)));
public static readonly DependencyProperty AlphaProperty = DependencyProperty.Register("Alpha", typeof(double), typeof(GaborAlphaProgram), new PropertyMetadata(((double)(1D)), PixelShaderConstantCallback(6)));
public GaborAlphaProgram()
{
PixelShader pixelShader = new PixelShader();
pixelShader.UriSource = ps;
this.PixelShader = pixelShader;
this.UpdateShaderValue(InputProperty);
this.UpdateShaderValue(ContrastProperty);
this.UpdateShaderValue(FrequencyProperty);
this.UpdateShaderValue(PhaseProperty);
this.UpdateShaderValue(OrientationProperty);
this.UpdateShaderValue(SigmaProperty);
this.UpdateShaderValue(AlphaProperty);
Size = 200;
Contrast = 1.0;
WaveLength = 100.0;
Orientation = 0.0;
Sigma = 4.0;
Alpha = 1.0;
}
public void Update()
{
this.UpdateShaderValue(InputProperty);
this.UpdateShaderValue(ContrastProperty);
this.UpdateShaderValue(FrequencyProperty);
this.UpdateShaderValue(PhaseProperty);
this.UpdateShaderValue(OrientationProperty);
this.UpdateShaderValue(SigmaProperty);
this.UpdateShaderValue(AlphaProperty);
}
private double size__, wavelength__;
public double Size { get { return size__; } set { size__ = value; setFrequency(); } }
private void setFrequency()
{
double freq = size__ * 2.0 * Math.PI / (wavelength__);
this.SetValue(FrequencyProperty, freq);
}
/// Amplitude of Grating
public double Contrast
{
get
{
return ((double)(this.GetValue(ContrastProperty))) * 2.0;
}
set
{
this.SetValue(ContrastProperty, value / 2.0);
}
}
/// Phase of Grating
public double WaveLength
{
get
{
return wavelength__;
}
set
{
wavelength__ = value;
setFrequency();
}
}
/// Phase of Grating
public double Phase
{
get
{
return ((double)(this.GetValue(PhaseProperty)));
}
set
{
this.SetValue(PhaseProperty, value);
}
}
/// Orientation of Grating
public double Orientation
{
get
{
return ((double)(this.GetValue(OrientationProperty)));
}
set
{
this.SetValue(OrientationProperty, value);
}
}
/// Half bandwidth of envelope
public double Sigma
{
get
{
return ((double)(this.GetValue(SigmaProperty)));
}
set
{
this.SetValue(SigmaProperty, value);
}
}
/// Transparency of Figure
public double Alpha
{
get
{
return ((double)(this.GetValue(AlphaProperty)));
}
set
{
this.SetValue(AlphaProperty, value);
}
}
}
#endregion
}
}