mirror of
https://github.com/AlexMacocian/WpfExtended.git
synced 2026-07-15 14:59:30 +00:00
166f9b499e
Created test project.
50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
// (c) Copyright Microsoft Corporation.
|
|
// This source is subject to the Microsoft Permissive License.
|
|
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
|
|
// All other rights reserved.
|
|
|
|
using System.Windows.Media.Effects;
|
|
|
|
namespace System.Windows.Media.Extensions.Effects
|
|
{
|
|
#if SILVERLIGHT
|
|
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
|
|
#endif
|
|
public class BrightExtractEffect : ShaderEffect
|
|
{
|
|
public static readonly DependencyProperty InputProperty =
|
|
ShaderEffect.RegisterPixelShaderSamplerProperty("Input", typeof(BrightExtractEffect), 0);
|
|
public static readonly DependencyProperty ThresholdProperty =
|
|
DependencyProperty.Register("Threshold", typeof(double), typeof(BrightExtractEffect), new UIPropertyMetadata(0.25, PixelShaderConstantCallback(0)));
|
|
|
|
private readonly static PixelShader pixelShader = new PixelShader();
|
|
|
|
static BrightExtractEffect()
|
|
{
|
|
pixelShader = PixelShaderUtility.LoadPixelShader("BrightExtract/BrightExtract.ps");
|
|
}
|
|
|
|
public BrightExtractEffect()
|
|
{
|
|
this.PixelShader = pixelShader;
|
|
|
|
// Update each DependencyProperty that's registered with a shader register. This
|
|
// is needed to ensure the shader gets sent the proper default value.
|
|
UpdateShaderValue(InputProperty);
|
|
UpdateShaderValue(ThresholdProperty);
|
|
}
|
|
|
|
[System.ComponentModel.BrowsableAttribute(false)]
|
|
public Brush Input
|
|
{
|
|
get { return (Brush)GetValue(InputProperty); }
|
|
set { SetValue(InputProperty, value); }
|
|
}
|
|
public double Threshold
|
|
{
|
|
get { return (double)GetValue(ThresholdProperty); }
|
|
set { SetValue(ThresholdProperty, value); }
|
|
}
|
|
}
|
|
}
|