namespace Tango.SharedUI.Effects { using System; using System.ComponentModel; using System.Text; using System.Windows; using System.Windows.Media; using System.Windows.Media.Effects; public class DisplaySettingEffect : ShaderEffect { public static readonly DependencyProperty BrightnessLevelProperty = DependencyProperty.Register("BrightnessLevel", typeof(double), typeof(DisplaySettingEffect), new UIPropertyMetadata(1.0, ShaderEffect.PixelShaderConstantCallback(1))); public static readonly DependencyProperty ContrastLevelProperty = DependencyProperty.Register("ContrastLevel", typeof(double), typeof(DisplaySettingEffect), new UIPropertyMetadata(1.0, ShaderEffect.PixelShaderConstantCallback(0))); public static readonly DependencyProperty Input1Property = ShaderEffect.RegisterPixelShaderSamplerProperty("Input1", typeof(DisplaySettingEffect), 0); public static readonly DependencyProperty SaturationLevelProperty = DependencyProperty.Register("SaturationLevel", typeof(double), typeof(DisplaySettingEffect), new UIPropertyMetadata(1.0, ShaderEffect.PixelShaderConstantCallback(2))); /// /// Initializes a new instance of the class. /// public DisplaySettingEffect() : base() { PixelShader pixelShader = new PixelShader(); pixelShader.UriSource = new Uri("pack://application:,,,/Tango.SharedUI;component/Effects/DisplaySettingEffect.ps", UriKind.RelativeOrAbsolute); this.PixelShader = pixelShader; this.UpdateShaderValue(Input1Property); this.UpdateShaderValue(ContrastLevelProperty); this.UpdateShaderValue(Input1Property); this.UpdateShaderValue(BrightnessLevelProperty); this.UpdateShaderValue(Input1Property); this.UpdateShaderValue(SaturationLevelProperty); } /// /// Gets or sets the brightness level. /// public double BrightnessLevel { get { return (double)base.GetValue(BrightnessLevelProperty); } set { base.SetValue(BrightnessLevelProperty, value); } } /// /// Gets or sets the contrast level. /// public double ContrastLevel { get { return (double)base.GetValue(ContrastLevelProperty); } set { base.SetValue(ContrastLevelProperty, value); } } /// /// Gets or sets the saturation level. /// public double SaturationLevel { get { return (double)base.GetValue(SaturationLevelProperty); } set { base.SetValue(SaturationLevelProperty, value); } } /// /// Gets or sets the input. /// [Browsable(false)] public Brush Input1 { get { return (Brush)base.GetValue(Input1Property); } set { base.SetValue(Input1Property, value); } } } }