add GrayScaleEffect
This commit is contained in:
1 parent
f1dca283f8
commit
6a79133cc1
21 files changed
+144
-3
No files matched your search
@@ -91,6 +91,10 @@ Step 4:enjoy coding
|
||||
|
||||
## Latest examples
|
||||
|
||||
### Effects
|
||||
|
||||

|
||||
|
||||
### RelativePanel
|
||||
|
||||

|
||||
@@ -107,12 +111,12 @@ Step 4:enjoy coding
|
||||
|
||||

|
||||
|
||||
## History publication
|
||||
|
||||
### GeometryAnimation
|
||||
|
||||

|
||||
|
||||
## History publication
|
||||
|
||||
### SplitButton
|
||||
|
||||

|
||||
|
||||
@@ -451,6 +451,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\TransformRelative_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Effects_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\Effects_16x.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
||||
|
||||
@@ -56,8 +56,13 @@
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
||||
<Link>Resources\dropper.cur</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
||||
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
||||
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -430,6 +430,9 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Effects_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\Effects_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\TransformRelative_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
||||
</Resource>
|
||||
|
||||
@@ -108,9 +108,14 @@
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
||||
<Link>Resources\dropper.cur</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
||||
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
||||
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -496,6 +496,9 @@
|
||||
<Generator>TextTemplatingFileGenerator</Generator>
|
||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||
</Content>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Effects_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\Effects_16x.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\TransformRelative_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
||||
</Resource>
|
||||
|
||||
@@ -179,9 +179,14 @@
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
||||
<Link>Resources\dropper.cur</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\ColorComplementEffect.ps">
|
||||
<Link>Resources\Effects\ColorComplementEffect.ps</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\Effects\GrayScaleEffect.ps">
|
||||
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -101,7 +101,8 @@
|
||||
"title": "Tools",
|
||||
"demoItemList": [
|
||||
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_16x", "" ],
|
||||
[ "Morphing Animation", "GeometryAnimationDemoCtl", "Animation_16x", "1" ]
|
||||
[ "Morphing Animation", "GeometryAnimationDemoCtl", "Animation_16x", "" ],
|
||||
[ "Effects", "EffectsDemoCtl", "Effects_16x", "1" ]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -347,6 +347,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\TreeViewDemoCtl.xaml.cs">
|
||||
<DependentUpon>TreeViewDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Tools\EffectsDemoCtl.xaml.cs">
|
||||
<DependentUpon>EffectsDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Tools\GeometryAnimationDemoCtl.xaml.cs">
|
||||
<DependentUpon>GeometryAnimationDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -863,6 +866,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Tools\EffectsDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Tools\GeometryAnimationDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -519,6 +519,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 效果 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Effects {
|
||||
get {
|
||||
return ResourceManager.GetString("Effects", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 邮箱 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -690,4 +690,7 @@
|
||||
<data name="Drawer" xml:space="preserve">
|
||||
<value>Drawer</value>
|
||||
</data>
|
||||
<data name="Effects" xml:space="preserve">
|
||||
<value>Effects</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -690,4 +690,7 @@
|
||||
<data name="Drawer" xml:space="preserve">
|
||||
<value>Drawer</value>
|
||||
</data>
|
||||
<data name="Effects" xml:space="preserve">
|
||||
<value>Effects</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -690,4 +690,7 @@
|
||||
<data name="Drawer" xml:space="preserve">
|
||||
<value>Drawer</value>
|
||||
</data>
|
||||
<data name="Effects" xml:space="preserve">
|
||||
<value>Effects</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -690,4 +690,7 @@
|
||||
<data name="Drawer" xml:space="preserve">
|
||||
<value>抽屉</value>
|
||||
</data>
|
||||
<data name="Effects" xml:space="preserve">
|
||||
<value>效果</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 369 B |
@@ -0,0 +1,26 @@
|
||||
<UserControl x:Class="HandyControlDemo.UserControl.EffectsDemoCtl"
|
||||
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}">
|
||||
<hc:TransitioningContentControl>
|
||||
<UniformGrid Margin="16">
|
||||
<Image Margin="16" Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg"/>
|
||||
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||
<Image.Effect>
|
||||
<hc:ColorComplementEffect/>
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||
<Image.Effect>
|
||||
<hc:GrayScaleEffect/>
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
<Image Width="120" Height="120" Source="/HandyControlDemo;component/Resources/Img/Album/10.jpg">
|
||||
<Image.Effect>
|
||||
<hc:GrayScaleEffect Scale=".7"/>
|
||||
</Image.Effect>
|
||||
</Image>
|
||||
</UniformGrid>
|
||||
</hc:TransitioningContentControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class EffectsDemoCtl
|
||||
{
|
||||
public EffectsDemoCtl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\ResolvedKeyFrameEntry.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\SplineGeometryKeyFrame.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ColorComplementEffect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\GrayScaleEffect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\BorderCircularClipConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\CornerRadiusSplitConverter.cs" />
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace HandyControl.Media.Effects
|
||||
public ColorComplementEffect()
|
||||
{
|
||||
PixelShader = Shader;
|
||||
|
||||
UpdateShaderValue(InputProperty);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
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 static readonly DependencyProperty InputProperty = RegisterPixelShaderSamplerProperty("Input", typeof(GrayScaleEffect), 0);
|
||||
|
||||
private static readonly PixelShader Shader;
|
||||
|
||||
static GrayScaleEffect()
|
||||
{
|
||||
Shader = new PixelShader
|
||||
{
|
||||
UriSource = new Uri("pack://application:,,,/HandyControl;component/Resources/Effects/GrayScaleEffect.ps")
|
||||
};
|
||||
}
|
||||
|
||||
public GrayScaleEffect()
|
||||
{
|
||||
PixelShader = Shader;
|
||||
|
||||
UpdateShaderValue(InputProperty);
|
||||
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)));
|
||||
|
||||
public double Scale
|
||||
{
|
||||
get => (double) GetValue(ScaleProperty);
|
||||
set => SetValue(ScaleProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user