aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Effects/DisplaySettingEffect.cs
blob: 386ee05fbdf1a9ede3721ed2d6dc61c83089c1ef (plain)
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
53
54
55
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.E
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)));

        /// <summary>
        /// Initializes a new instance of the <see cref="DisplaySettingEffect"/> class.
        /// </summary>
        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);
        }

        /// <summary>
        /// Gets or sets the brightness level.
        /// </summary>
        public double BrightnessLevel
        {
            get
            {
                return (double)base.GetValue(BrightnessLevelProperty);
            }
            set
            {
                base.SetValue(BrightnessLevelProperty, value);
            }
        }

        /// <summary>
        /// Gets or sets the contrast level.
        /// </summary>
        public double ContrastLevel
        {
            get
            {
                return (double)base.GetValue(ContrastLevelProperty);
            }
            set
            {
                base.SetValue(ContrastLevelProperty, value);
            }
        }

        /// <summary>
        /// Gets or sets the saturation level.
        /// </summary>
        public double SaturationLevel
        {
            get
            {
                return (double)base.GetValue(SaturationLevelProperty);
            }
            set
            {
                base.SetValue(SaturationLevelProperty, value);
            }
        }

        /// <summary>
        /// Gets or sets the input.
        /// </summary>
        [Browsable(false)]
        public Brush Input1
        {
            get
            {
                return (Brush)base.GetValue(Input1Property);
            }
            set
            {
                base.SetValue(Input1Property, value);
            }
        }
    }
}