From cd3072f02692b2e0463deaed8bb873b2a3e10a00 Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Thu, 20 Feb 2020 22:46:34 +0800
Subject: [PATCH] add Gooey Effect Demo
---
.../HandyControl_Core_30.csproj | 9 +
.../HandyControl_Net_40.csproj | 9 +
.../HandyControl_Net_GE45.csproj | 9 +
.../Data/Model/DemoInfoModel.cs | 2 +-
.../HandyControlDemo_Shared.projitems | 7 +
.../UserControl/Practical/Login.xaml | 11 +
.../UserControl/Practical/Login.xaml.cs | 10 +
.../UserControl/Tools/EffectsDemoCtl.xaml | 109 ++++++--
.../HandyControl_Shared.projitems | 4 +
.../Media/Effects/BrightnessEffect.cs | 37 +++
.../Media/Effects/ColorComplementEffect.cs | 12 +-
.../Media/Effects/ColorMatrixEffect.cs | 247 ++++++++++++++++++
.../Media/Effects/ContrastEffect.cs | 37 +++
.../Media/Effects/EffectBase.cs | 17 ++
.../Media/Effects/GrayScaleEffect.cs | 11 +-
.../Resources/Effects/BrightnessEffect.fx | 10 +
.../Resources/Effects/BrightnessEffect.ps | Bin 0 -> 268 bytes
.../Effects/ColorComplementEffect.fx | 2 +
.../Resources/Effects/ColorMatrixEffect.fx | 56 ++++
.../Resources/Effects/ColorMatrixEffect.ps | Bin 0 -> 984 bytes
.../Resources/Effects/ContrastEffect.fx | 12 +
.../Resources/Effects/ContrastEffect.ps | Bin 0 -> 340 bytes
22 files changed, 571 insertions(+), 40 deletions(-)
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml
create mode 100644 src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml.cs
create mode 100644 src/Shared/HandyControl_Shared/Media/Effects/BrightnessEffect.cs
create mode 100644 src/Shared/HandyControl_Shared/Media/Effects/ColorMatrixEffect.cs
create mode 100644 src/Shared/HandyControl_Shared/Media/Effects/ContrastEffect.cs
create mode 100644 src/Shared/HandyControl_Shared/Media/Effects/EffectBase.cs
create mode 100644 src/Shared/HandyControl_Shared/Resources/Effects/BrightnessEffect.fx
create mode 100644 src/Shared/HandyControl_Shared/Resources/Effects/BrightnessEffect.ps
create mode 100644 src/Shared/HandyControl_Shared/Resources/Effects/ColorMatrixEffect.fx
create mode 100644 src/Shared/HandyControl_Shared/Resources/Effects/ColorMatrixEffect.ps
create mode 100644 src/Shared/HandyControl_Shared/Resources/Effects/ContrastEffect.fx
create mode 100644 src/Shared/HandyControl_Shared/Resources/Effects/ContrastEffect.ps
diff --git a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj b/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
index 4f61f64f..d5a3a94b 100644
--- a/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
+++ b/src/Core_30/HandyControl_Core_30/HandyControl_Core_30.csproj
@@ -61,9 +61,18 @@
+
+ Resources\Effects\BrightnessEffect.ps
+
Resources\Effects\ColorComplementEffect.ps
+
+ Resources\Effects\ColorMatrixEffect.ps
+
+
+ Resources\Effects\ContrastEffect.ps
+
Resources\Effects\GrayScaleEffect.ps
diff --git a/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj b/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj
index 092bb8a0..c593ae8c 100644
--- a/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj
+++ b/src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj
@@ -113,9 +113,18 @@
+
+ Resources\Effects\BrightnessEffect.ps
+
Resources\Effects\ColorComplementEffect.ps
+
+ Resources\Effects\ColorMatrixEffect.ps
+
+
+ Resources\Effects\ContrastEffect.ps
+
Resources\Effects\GrayScaleEffect.ps
diff --git a/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj b/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj
index 15efdefe..9e873597 100644
--- a/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj
+++ b/src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj
@@ -184,9 +184,18 @@
+
+ Resources\Effects\BrightnessEffect.ps
+
Resources\Effects\ColorComplementEffect.ps
+
+ Resources\Effects\ColorMatrixEffect.ps
+
+
+ Resources\Effects\ContrastEffect.ps
+
Resources\Effects\GrayScaleEffect.ps
diff --git a/src/Shared/HandyControlDemo_Shared/Data/Model/DemoInfoModel.cs b/src/Shared/HandyControlDemo_Shared/Data/Model/DemoInfoModel.cs
index be5cc846..a9d82b6b 100644
--- a/src/Shared/HandyControlDemo_Shared/Data/Model/DemoInfoModel.cs
+++ b/src/Shared/HandyControlDemo_Shared/Data/Model/DemoInfoModel.cs
@@ -19,7 +19,7 @@ namespace HandyControlDemo.Data
#endif
}
- private int _selectedIndex = -1;
+ private int _selectedIndex;
public int SelectedIndex
{
diff --git a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
index 54536de4..ef1f20e3 100644
--- a/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
+++ b/src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems
@@ -271,6 +271,9 @@
WebsitesView.xaml
+
+ Login.xaml
+
BorderDemoCtl.xaml
@@ -789,6 +792,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml
new file mode 100644
index 00000000..23ba4136
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml.cs b/src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml.cs
new file mode 100644
index 00000000..98e61d87
--- /dev/null
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Practical/Login.xaml.cs
@@ -0,0 +1,10 @@
+namespace HandyControlDemo.UserControl
+{
+ public partial class Login
+ {
+ public Login()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml
index 312cec54..9bdf34d7 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Tools/EffectsDemoCtl.xaml
@@ -3,24 +3,97 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
index 6ebde1f2..01431223 100644
--- a/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
+++ b/src/Shared/HandyControl_Shared/HandyControl_Shared.projitems
@@ -68,7 +68,11 @@
+
+
+
+
diff --git a/src/Shared/HandyControl_Shared/Media/Effects/BrightnessEffect.cs b/src/Shared/HandyControl_Shared/Media/Effects/BrightnessEffect.cs
new file mode 100644
index 00000000..ca36952f
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Media/Effects/BrightnessEffect.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Windows;
+using System.Windows.Media.Effects;
+using HandyControl.Data;
+
+namespace HandyControl.Media.Effects
+{
+ public class BrightnessEffect : EffectBase
+ {
+ private static readonly PixelShader Shader;
+
+ static BrightnessEffect()
+ {
+ Shader = new PixelShader
+ {
+ UriSource = new Uri("pack://application:,,,/HandyControl;component/Resources/Effects/BrightnessEffect.ps")
+ };
+ }
+
+ public BrightnessEffect()
+ {
+ PixelShader = Shader;
+
+ UpdateShaderValue(InputProperty);
+ UpdateShaderValue(BrightnessProperty);
+ }
+
+ public static readonly DependencyProperty BrightnessProperty = DependencyProperty.Register(
+ "Brightness", typeof(double), typeof(BrightnessEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(0)));
+
+ public double Brightness
+ {
+ get => (double)GetValue(BrightnessProperty);
+ set => SetValue(BrightnessProperty, value);
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Media/Effects/ColorComplementEffect.cs b/src/Shared/HandyControl_Shared/Media/Effects/ColorComplementEffect.cs
index f9871671..faef4eda 100644
--- a/src/Shared/HandyControl_Shared/Media/Effects/ColorComplementEffect.cs
+++ b/src/Shared/HandyControl_Shared/Media/Effects/ColorComplementEffect.cs
@@ -1,14 +1,10 @@
using System;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
namespace HandyControl.Media.Effects
{
- public class ColorComplementEffect : ShaderEffect
+ public class ColorComplementEffect : EffectBase
{
- public static readonly DependencyProperty InputProperty = RegisterPixelShaderSamplerProperty("Input", typeof(ColorComplementEffect), 0);
-
private static readonly PixelShader Shader;
static ColorComplementEffect()
@@ -25,11 +21,5 @@ namespace HandyControl.Media.Effects
UpdateShaderValue(InputProperty);
}
-
- public Brush Input
- {
- get => (Brush)GetValue(InputProperty);
- set => SetValue(InputProperty, value);
- }
}
}
diff --git a/src/Shared/HandyControl_Shared/Media/Effects/ColorMatrixEffect.cs b/src/Shared/HandyControl_Shared/Media/Effects/ColorMatrixEffect.cs
new file mode 100644
index 00000000..785f2431
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Media/Effects/ColorMatrixEffect.cs
@@ -0,0 +1,247 @@
+using System;
+using System.Windows;
+using System.Windows.Media.Effects;
+using HandyControl.Data;
+
+namespace HandyControl.Media.Effects
+{
+ public class ColorMatrixEffect : EffectBase
+ {
+ private static readonly PixelShader Shader;
+
+ static ColorMatrixEffect()
+ {
+ Shader = new PixelShader
+ {
+ UriSource = new Uri("pack://application:,,,/HandyControl;component/Resources/Effects/ColorMatrixEffect.ps")
+ };
+ }
+
+ public ColorMatrixEffect()
+ {
+ PixelShader = Shader;
+
+ UpdateShaderValue(InputProperty);
+
+ UpdateShaderValue(M11Property);
+ UpdateShaderValue(M21Property);
+ UpdateShaderValue(M31Property);
+ UpdateShaderValue(M41Property);
+ UpdateShaderValue(M51Property);
+
+ UpdateShaderValue(M12Property);
+ UpdateShaderValue(M22Property);
+ UpdateShaderValue(M32Property);
+ UpdateShaderValue(M42Property);
+ UpdateShaderValue(M52Property);
+
+ UpdateShaderValue(M13Property);
+ UpdateShaderValue(M23Property);
+ UpdateShaderValue(M33Property);
+ UpdateShaderValue(M43Property);
+ UpdateShaderValue(M53Property);
+
+ UpdateShaderValue(M14Property);
+ UpdateShaderValue(M24Property);
+ UpdateShaderValue(M34Property);
+ UpdateShaderValue(M44Property);
+ UpdateShaderValue(M54Property);
+ }
+
+ #region Line1
+
+ public static readonly DependencyProperty M11Property = DependencyProperty.Register(
+ "M11", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(0)));
+
+ public double M11
+ {
+ get => (double)GetValue(M11Property);
+ set => SetValue(M11Property, value);
+ }
+
+ public static readonly DependencyProperty M21Property = DependencyProperty.Register(
+ "M21", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(1)));
+
+ public double M21
+ {
+ get => (double)GetValue(M21Property);
+ set => SetValue(M21Property, value);
+ }
+
+ public static readonly DependencyProperty M31Property = DependencyProperty.Register(
+ "M31", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(2)));
+
+ public double M31
+ {
+ get => (double)GetValue(M31Property);
+ set => SetValue(M31Property, value);
+ }
+
+ public static readonly DependencyProperty M41Property = DependencyProperty.Register(
+ "M41", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(3)));
+
+ public double M41
+ {
+ get => (double)GetValue(M41Property);
+ set => SetValue(M41Property, value);
+ }
+
+ public static readonly DependencyProperty M51Property = DependencyProperty.Register(
+ "M51", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(4)));
+
+ public double M51
+ {
+ get => (double)GetValue(M51Property);
+ set => SetValue(M51Property, value);
+ }
+
+ #endregion
+
+ #region Line2
+
+ public static readonly DependencyProperty M12Property = DependencyProperty.Register(
+ "M12", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(5)));
+
+ public double M12
+ {
+ get => (double)GetValue(M12Property);
+ set => SetValue(M12Property, value);
+ }
+
+ public static readonly DependencyProperty M22Property = DependencyProperty.Register(
+ "M22", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(6)));
+
+ public double M22
+ {
+ get => (double)GetValue(M22Property);
+ set => SetValue(M22Property, value);
+ }
+
+ public static readonly DependencyProperty M32Property = DependencyProperty.Register(
+ "M32", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(7)));
+
+ public double M32
+ {
+ get => (double)GetValue(M32Property);
+ set => SetValue(M32Property, value);
+ }
+
+ public static readonly DependencyProperty M42Property = DependencyProperty.Register(
+ "M42", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(8)));
+
+ public double M42
+ {
+ get => (double)GetValue(M42Property);
+ set => SetValue(M42Property, value);
+ }
+
+ public static readonly DependencyProperty M52Property = DependencyProperty.Register(
+ "M52", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(9)));
+
+ public double M52
+ {
+ get => (double)GetValue(M52Property);
+ set => SetValue(M52Property, value);
+ }
+
+ #endregion
+
+ #region Line3
+
+ public static readonly DependencyProperty M13Property = DependencyProperty.Register(
+ "M13", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(10)));
+
+ public double M13
+ {
+ get => (double)GetValue(M13Property);
+ set => SetValue(M13Property, value);
+ }
+
+ public static readonly DependencyProperty M23Property = DependencyProperty.Register(
+ "M23", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(11)));
+
+ public double M23
+ {
+ get => (double)GetValue(M23Property);
+ set => SetValue(M23Property, value);
+ }
+
+ public static readonly DependencyProperty M33Property = DependencyProperty.Register(
+ "M33", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(12)));
+
+ public double M33
+ {
+ get => (double)GetValue(M33Property);
+ set => SetValue(M33Property, value);
+ }
+
+ public static readonly DependencyProperty M43Property = DependencyProperty.Register(
+ "M43", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(13)));
+
+ public double M43
+ {
+ get => (double)GetValue(M43Property);
+ set => SetValue(M43Property, value);
+ }
+
+ public static readonly DependencyProperty M53Property = DependencyProperty.Register(
+ "M53", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(14)));
+
+ public double M53
+ {
+ get => (double)GetValue(M53Property);
+ set => SetValue(M53Property, value);
+ }
+
+ #endregion
+
+ #region Line4
+
+ public static readonly DependencyProperty M14Property = DependencyProperty.Register(
+ "M14", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(15)));
+
+ public double M14
+ {
+ get => (double)GetValue(M14Property);
+ set => SetValue(M14Property, value);
+ }
+
+ public static readonly DependencyProperty M24Property = DependencyProperty.Register(
+ "M24", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(16)));
+
+ public double M24
+ {
+ get => (double)GetValue(M24Property);
+ set => SetValue(M24Property, value);
+ }
+
+ public static readonly DependencyProperty M34Property = DependencyProperty.Register(
+ "M34", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(17)));
+
+ public double M34
+ {
+ get => (double)GetValue(M34Property);
+ set => SetValue(M34Property, value);
+ }
+
+ public static readonly DependencyProperty M44Property = DependencyProperty.Register(
+ "M44", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(18)));
+
+ public double M44
+ {
+ get => (double)GetValue(M44Property);
+ set => SetValue(M44Property, value);
+ }
+
+ public static readonly DependencyProperty M54Property = DependencyProperty.Register(
+ "M54", typeof(double), typeof(ColorMatrixEffect), new PropertyMetadata(ValueBoxes.Double0Box, PixelShaderConstantCallback(19)));
+
+ public double M54
+ {
+ get => (double)GetValue(M54Property);
+ set => SetValue(M54Property, value);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Media/Effects/ContrastEffect.cs b/src/Shared/HandyControl_Shared/Media/Effects/ContrastEffect.cs
new file mode 100644
index 00000000..8fef34eb
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Media/Effects/ContrastEffect.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Windows;
+using System.Windows.Media.Effects;
+using HandyControl.Data;
+
+namespace HandyControl.Media.Effects
+{
+ public class ContrastEffect : EffectBase
+ {
+ private static readonly PixelShader Shader;
+
+ static ContrastEffect()
+ {
+ Shader = new PixelShader
+ {
+ UriSource = new Uri("pack://application:,,,/HandyControl;component/Resources/Effects/ContrastEffect.ps")
+ };
+ }
+
+ public ContrastEffect()
+ {
+ PixelShader = Shader;
+
+ UpdateShaderValue(InputProperty);
+ UpdateShaderValue(ContrastProperty);
+ }
+
+ public static readonly DependencyProperty ContrastProperty = DependencyProperty.Register(
+ "Contrast", typeof(double), typeof(ContrastEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(0)));
+
+ public double Contrast
+ {
+ get => (double)GetValue(ContrastProperty);
+ set => SetValue(ContrastProperty, value);
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Media/Effects/EffectBase.cs b/src/Shared/HandyControl_Shared/Media/Effects/EffectBase.cs
new file mode 100644
index 00000000..15c9dc3c
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Media/Effects/EffectBase.cs
@@ -0,0 +1,17 @@
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Effects;
+
+namespace HandyControl.Media.Effects
+{
+ public abstract class EffectBase : ShaderEffect
+ {
+ public static readonly DependencyProperty InputProperty = RegisterPixelShaderSamplerProperty("Input", typeof(EffectBase), 0);
+
+ public Brush Input
+ {
+ get => (Brush)GetValue(InputProperty);
+ set => SetValue(InputProperty, value);
+ }
+ }
+}
diff --git a/src/Shared/HandyControl_Shared/Media/Effects/GrayScaleEffect.cs b/src/Shared/HandyControl_Shared/Media/Effects/GrayScaleEffect.cs
index 2a972ea9..4b26f23e 100644
--- a/src/Shared/HandyControl_Shared/Media/Effects/GrayScaleEffect.cs
+++ b/src/Shared/HandyControl_Shared/Media/Effects/GrayScaleEffect.cs
@@ -1,15 +1,12 @@
using System;
using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
using HandyControl.Data;
namespace HandyControl.Media.Effects
{
- public class GrayScaleEffect : ShaderEffect
+ public class GrayScaleEffect : EffectBase
{
- public static readonly DependencyProperty InputProperty = RegisterPixelShaderSamplerProperty("Input", typeof(GrayScaleEffect), 0);
-
private static readonly PixelShader Shader;
static GrayScaleEffect()
@@ -28,12 +25,6 @@ namespace HandyControl.Media.Effects
UpdateShaderValue(ScaleProperty);
}
- public Brush Input
- {
- get => (Brush)GetValue(InputProperty);
- set => SetValue(InputProperty, value);
- }
-
public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register(
"Scale", typeof(double), typeof(GrayScaleEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(0)));
diff --git a/src/Shared/HandyControl_Shared/Resources/Effects/BrightnessEffect.fx b/src/Shared/HandyControl_Shared/Resources/Effects/BrightnessEffect.fx
new file mode 100644
index 00000000..a356ecf5
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Resources/Effects/BrightnessEffect.fx
@@ -0,0 +1,10 @@
+sampler2D implicitInput : register(s0);
+float brightness : register(C0);
+
+float4 main(float2 uv : TEXCOORD) : COLOR
+{
+ float4 color = tex2D(implicitInput, uv);
+ color.rgba *= brightness;
+
+ return color;
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Resources/Effects/BrightnessEffect.ps b/src/Shared/HandyControl_Shared/Resources/Effects/BrightnessEffect.ps
new file mode 100644
index 0000000000000000000000000000000000000000..b68a735a84d97b4413d5633e8b368843b86c9d3b
GIT binary patch
literal 268
zcmZQz`v3pme|-k$5Jx8&1_p+9AZ7rHF##zMpMjBqp#ey_05M365l99AX%I*NVrC!)
zi4_285J)P@OwTCEOD!&DSPhb81Ve~iW^O@FW^!hUXI?>R3B&5uEDSs-@&(25M)3v=
zzM08I`NjEZB?=lrnhG91!9EJX8Hp*WMGDUOxdoXyK!&BBk-46wsga(sfsqk|Jj7`Y
uK>Id8*%KHz_!l^VoyQLpf3ksraCZIZye8d0$3=9BNm@`oT
literal 0
HcmV?d00001
diff --git a/src/Shared/HandyControl_Shared/Resources/Effects/ColorComplementEffect.fx b/src/Shared/HandyControl_Shared/Resources/Effects/ColorComplementEffect.fx
index 1e550b99..ccc73006 100644
--- a/src/Shared/HandyControl_Shared/Resources/Effects/ColorComplementEffect.fx
+++ b/src/Shared/HandyControl_Shared/Resources/Effects/ColorComplementEffect.fx
@@ -1,3 +1,5 @@
+sampler2D implicitInput : register(s0);
+
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 color = tex2D(implicitInput, uv);
diff --git a/src/Shared/HandyControl_Shared/Resources/Effects/ColorMatrixEffect.fx b/src/Shared/HandyControl_Shared/Resources/Effects/ColorMatrixEffect.fx
new file mode 100644
index 00000000..3f5142e4
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Resources/Effects/ColorMatrixEffect.fx
@@ -0,0 +1,56 @@
+sampler2D implicitInput : register(s0);
+float a : register(c0);
+float b : register(c1);
+float c : register(c2);
+float d : register(c3);
+float e : register(c4);
+
+float f : register(c5);
+float g : register(c6);
+float h : register(c7);
+float i : register(c8);
+float j : register(c9);
+
+float k : register(c10);
+float l : register(c11);
+float m : register(c12);
+float n : register(c13);
+float o : register(c14);
+
+float p : register(c15);
+float q : register(c16);
+float r : register(c17);
+float s : register(c18);
+float t : register(c19);
+
+/*
+
+ -- -- -- --
+ | a b c d e | | R |
+ | f g h i j | | G |
+ A = | k l m n o | C = | B | R = AC
+ | p q r s t | | A |
+ -- -- | 1 |
+ -- --
+
+*/
+
+float4 main(float2 uv : TEXCOORD) : COLOR
+{
+ float4 color = tex2D(implicitInput, uv);
+
+ float4x4 matrixA1 =
+ {
+ a, b, c, d,
+ f, g, h, i,
+ k, l, m, n,
+ p, q, r, s
+ };
+
+ float4 matrixA2 =
+ {
+ e, j, o, t
+ };
+
+ return mul(matrixA1, color) + matrixA2;
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Resources/Effects/ColorMatrixEffect.ps b/src/Shared/HandyControl_Shared/Resources/Effects/ColorMatrixEffect.ps
new file mode 100644
index 0000000000000000000000000000000000000000..68fd834367f86702306be13ad7d32f870d7f22c8
GIT binary patch
literal 984
zcmZwF!A=uV6b9gbE7jaTYWGeE0P9-nkbp&wu9cvGL+j`znANjyKw6KEgX9
zV43!T&oC76e$E`O3$=(=GW)3JXl1icYE!hT*=Mzw)-d~`HceYH`>Ix=Et`E)o1tAZ
z`>y6`H_axrDb6#@`3G~jVlKjAmbPMbCABhb)y%8S(OPC@wF)gUtEkP>?wM89sIYTkN&yScf&
zv)$Y|+S@-EG&lOaEbTI^x03s<^}9*y&RUYN|MlO;MmVptBEN&LjoZ34HTvWXeliZ*
z$64?lMRr0fax7eKk-czF$Fux>sE;rSJ;HeL4vC9eofK-c
zT<9wt)Bg_RWy?}8($|NV3wQnlJhYL=bUEyuE8*-L{t^y5kXXMR3>FIg;V
L`CavUyQ&Kr6a
literal 0
HcmV?d00001
diff --git a/src/Shared/HandyControl_Shared/Resources/Effects/ContrastEffect.fx b/src/Shared/HandyControl_Shared/Resources/Effects/ContrastEffect.fx
new file mode 100644
index 00000000..9f0686a8
--- /dev/null
+++ b/src/Shared/HandyControl_Shared/Resources/Effects/ContrastEffect.fx
@@ -0,0 +1,12 @@
+sampler2D implicitInput : register(s0);
+float contrast : register(C0);
+
+float4 main(float2 uv : TEXCOORD) : COLOR
+{
+ float4 color = tex2D(implicitInput, uv);
+ float value = (1 - contrast) / 2;
+
+ color.rgba = color.rgba * contrast + value;
+
+ return color;
+}
\ No newline at end of file
diff --git a/src/Shared/HandyControl_Shared/Resources/Effects/ContrastEffect.ps b/src/Shared/HandyControl_Shared/Resources/Effects/ContrastEffect.ps
new file mode 100644
index 0000000000000000000000000000000000000000..0f2349d3d1c9fa0b3f92bef78a08809e3e7848b2
GIT binary patch
literal 340
zcmY*Vu};G<5PeQtDFae|pb{BjNh>3SIw4vHkctE?%%ut-EVYf5ggs2Ge1i8Z{iuFN
z%{vz%arX21-uceYM&$k84={PW8utNw5g-@QNel%vbk~G%it9bS*fY@~gtPQwd9kU>
zWmThXTgj?04mq>7E0df0c4I%}Ko>{<^0r#SnKUFN>;ptJ9O&X?ioAPt*DP^5wNm
zC&k*D6*r?yUu2_mot+J}#skn(NF0@3@+LvB`-%~;6KT`-d_xIPp%7ahT3pmzDMfWSNb*H13xl+JU0LU
literal 0
HcmV?d00001