add Gooey Effect Demo
This commit is contained in:
1 parent
a943927a24
commit
cd3072f026
22 files changed
+571
-40
No files matched your search
@@ -61,9 +61,18 @@
|
|||||||
</Resource>
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\BrightnessEffect.ps">
|
||||||
|
<Link>Resources\Effects\BrightnessEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
||||||
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorMatrixEffect.ps">
|
||||||
|
<Link>Resources\Effects\ColorMatrixEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ContrastEffect.ps">
|
||||||
|
<Link>Resources\Effects\ContrastEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
||||||
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -113,9 +113,18 @@
|
|||||||
</Resource>
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\BrightnessEffect.ps">
|
||||||
|
<Link>Resources\Effects\BrightnessEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
||||||
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorMatrixEffect.ps">
|
||||||
|
<Link>Resources\Effects\ColorMatrixEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ContrastEffect.ps">
|
||||||
|
<Link>Resources\Effects\ContrastEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
||||||
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -184,9 +184,18 @@
|
|||||||
</Resource>
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\BrightnessEffect.ps">
|
||||||
|
<Link>Resources\Effects\BrightnessEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
||||||
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorMatrixEffect.ps">
|
||||||
|
<Link>Resources\Effects\ColorMatrixEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ContrastEffect.ps">
|
||||||
|
<Link>Resources\Effects\ContrastEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
||||||
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace HandyControlDemo.Data
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _selectedIndex = -1;
|
private int _selectedIndex;
|
||||||
|
|
||||||
public int SelectedIndex
|
public int SelectedIndex
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -271,6 +271,9 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\WebsitesView.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\WebsitesView.xaml.cs">
|
||||||
<DependentUpon>WebsitesView.xaml</DependentUpon>
|
<DependentUpon>WebsitesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Practical\Login.xaml.cs">
|
||||||
|
<DependentUpon>Login.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\BorderDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\BorderDemoCtl.xaml.cs">
|
||||||
<DependentUpon>BorderDemoCtl.xaml</DependentUpon>
|
<DependentUpon>BorderDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -789,6 +792,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Practical\Login.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\BorderDemoCtl.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Styles\BorderDemoCtl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<UserControl x:Class="HandyControlDemo.UserControl.Login"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
Background="{DynamicResource RegionBrush}">
|
||||||
|
<Grid Width="320" Height="567" Background="#f2f3f7">
|
||||||
|
<StackPanel VerticalAlignment="Bottom">
|
||||||
|
<Button Content="サインアップ" Height="44" Width="166" hc:BorderElement.CornerRadius="22" BorderThickness="0" Background="#41508d" Foreground="#edf0fb"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace HandyControlDemo.UserControl
|
||||||
|
{
|
||||||
|
public partial class Login
|
||||||
|
{
|
||||||
|
public Login()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,24 +3,97 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
Background="{DynamicResource RegionBrush}">
|
Background="{DynamicResource RegionBrush}">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<Storyboard x:Key="StoryboardLoaded" RepeatBehavior="Forever">
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(RotateTransform.Angle)" Storyboard.TargetName="TransformRotate1">
|
||||||
|
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="90">
|
||||||
|
</EasingDoubleKeyFrame>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(RotateTransform.Angle)" Storyboard.TargetName="TransformRotate2">
|
||||||
|
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="90">
|
||||||
|
</EasingDoubleKeyFrame>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(RotateTransform.Angle)" Storyboard.TargetName="TransformRotate3">
|
||||||
|
<EasingDoubleKeyFrame KeyTime="0:0:3" Value="-90">
|
||||||
|
</EasingDoubleKeyFrame>
|
||||||
|
</DoubleAnimationUsingKeyFrames>
|
||||||
|
</Storyboard>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<UserControl.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
|
||||||
|
<BeginStoryboard Storyboard="{StaticResource StoryboardLoaded}"/>
|
||||||
|
</EventTrigger>
|
||||||
|
</UserControl.Triggers>
|
||||||
<hc:TransitioningContentControl>
|
<hc:TransitioningContentControl>
|
||||||
<UniformGrid Margin="16">
|
<StackPanel Margin="20,0,20,32">
|
||||||
<Image Margin="16" Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg"/>
|
<UniformGrid Margin="16" Columns="3">
|
||||||
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
<Image Margin="16" Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg"/>
|
||||||
<Image.Effect>
|
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||||
<hc:ColorComplementEffect/>
|
<Image.Effect>
|
||||||
</Image.Effect>
|
<hc:ColorComplementEffect/>
|
||||||
</Image>
|
</Image.Effect>
|
||||||
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
</Image>
|
||||||
<Image.Effect>
|
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||||
<hc:GrayScaleEffect/>
|
<Image.Effect>
|
||||||
</Image.Effect>
|
<hc:GrayScaleEffect/>
|
||||||
</Image>
|
</Image.Effect>
|
||||||
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
</Image>
|
||||||
<Image.Effect>
|
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||||
<hc:GrayScaleEffect Scale=".7"/>
|
<Image.Effect>
|
||||||
</Image.Effect>
|
<hc:GrayScaleEffect Scale=".7"/>
|
||||||
</Image>
|
</Image.Effect>
|
||||||
</UniformGrid>
|
</Image>
|
||||||
|
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||||
|
<Image.Effect>
|
||||||
|
<hc:ColorMatrixEffect M11="-1" M22="-1" M33="-1" M41="1" M42="1" M43="1" M44="1" M51="1"/>
|
||||||
|
</Image.Effect>
|
||||||
|
</Image>
|
||||||
|
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||||
|
<Image.Effect>
|
||||||
|
<hc:ColorMatrixEffect M11="1.5" M21="1.5" M31="1.5" M12="1.5" M22="1.5" M32="1.5" M13="1.5" M23="1.5" M33="1.5" M51="-1" M52="-1" M53="-1"/>
|
||||||
|
</Image.Effect>
|
||||||
|
</Image>
|
||||||
|
</UniformGrid>
|
||||||
|
<Border>
|
||||||
|
<Border.Effect>
|
||||||
|
<hc:ContrastEffect Contrast="20"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<Border>
|
||||||
|
<Border.Effect>
|
||||||
|
<hc:BrightnessEffect Brightness="1"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<Border>
|
||||||
|
<Border.Effect>
|
||||||
|
<BlurEffect Radius="30"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
<Border Width="100" Height="100" Background="Red" RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform Angle="0" x:Name="TransformRotate1"/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
</Border>
|
||||||
|
<Border Margin="30,0,0,0" Width="100" Height="100" Background="Red" RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform Angle="0" x:Name="TransformRotate2"/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
<Border Width="100" Height="100" Background="Red" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5">
|
||||||
|
<Border.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform Angle="0" x:Name="TransformRotate3"/>
|
||||||
|
</TransformGroup>
|
||||||
|
</Border.RenderTransform>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
</hc:TransitioningContentControl>
|
</hc:TransitioningContentControl>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -68,7 +68,11 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\LinearGeometryKeyFrame.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\LinearGeometryKeyFrame.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\ResolvedKeyFrameEntry.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\ResolvedKeyFrameEntry.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\SplineGeometryKeyFrame.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\SplineGeometryKeyFrame.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\BrightnessEffect.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ColorComplementEffect.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ColorComplementEffect.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ColorMatrixEffect.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ContrastEffect.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\EffectBase.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\GrayScaleEffect.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\GrayScaleEffect.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Effects;
|
using System.Windows.Media.Effects;
|
||||||
|
|
||||||
namespace HandyControl.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;
|
private static readonly PixelShader Shader;
|
||||||
|
|
||||||
static ColorComplementEffect()
|
static ColorComplementEffect()
|
||||||
@@ -25,11 +21,5 @@ namespace HandyControl.Media.Effects
|
|||||||
|
|
||||||
UpdateShaderValue(InputProperty);
|
UpdateShaderValue(InputProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Brush Input
|
|
||||||
{
|
|
||||||
get => (Brush)GetValue(InputProperty);
|
|
||||||
set => SetValue(InputProperty, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Effects;
|
using System.Windows.Media.Effects;
|
||||||
using HandyControl.Data;
|
using HandyControl.Data;
|
||||||
|
|
||||||
namespace HandyControl.Media.Effects
|
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;
|
private static readonly PixelShader Shader;
|
||||||
|
|
||||||
static GrayScaleEffect()
|
static GrayScaleEffect()
|
||||||
@@ -28,12 +25,6 @@ namespace HandyControl.Media.Effects
|
|||||||
UpdateShaderValue(ScaleProperty);
|
UpdateShaderValue(ScaleProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Brush Input
|
|
||||||
{
|
|
||||||
get => (Brush)GetValue(InputProperty);
|
|
||||||
set => SetValue(InputProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ScaleProperty = DependencyProperty.Register(
|
||||||
"Scale", typeof(double), typeof(GrayScaleEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(0)));
|
"Scale", typeof(double), typeof(GrayScaleEffect), new PropertyMetadata(ValueBoxes.Double1Box, PixelShaderConstantCallback(0)));
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -1,3 +1,5 @@
|
|||||||
|
sampler2D implicitInput : register(s0);
|
||||||
|
|
||||||
float4 main(float2 uv : TEXCOORD) : COLOR
|
float4 main(float2 uv : TEXCOORD) : COLOR
|
||||||
{
|
{
|
||||||
float4 color = tex2D(implicitInput, uv);
|
float4 color = tex2D(implicitInput, uv);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -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;
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in new issue
Block a user