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
|
## Latest examples
|
||||||
|
|
||||||
|
### Effects
|
||||||
|
|
||||||
|

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

|

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

|

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

|

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

|

|
||||||
|
|||||||
@@ -451,6 +451,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\TransformRelative_16x.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\TransformRelative_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\Effects_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\Effects_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
||||||
|
|||||||
@@ -56,8 +56,13 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
||||||
<Link>Resources\dropper.cur</Link>
|
<Link>Resources\dropper.cur</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
<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\GrayScaleEffect.ps">
|
||||||
|
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -430,6 +430,9 @@
|
|||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||||
</Content>
|
</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">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\TransformRelative_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -108,9 +108,14 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
||||||
<Link>Resources\dropper.cur</Link>
|
<Link>Resources\dropper.cur</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
<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\GrayScaleEffect.ps">
|
||||||
|
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -496,6 +496,9 @@
|
|||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||||
</Content>
|
</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">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\TransformRelative_16x.png">
|
||||||
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
<Link>Resources\Img\LeftMainContent\TransformRelative_16x.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
|||||||
@@ -179,9 +179,14 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
<Resource Include="..\..\Shared\HandyControl_Shared\Resources\dropper.cur">
|
||||||
<Link>Resources\dropper.cur</Link>
|
<Link>Resources\dropper.cur</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
<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\GrayScaleEffect.ps">
|
||||||
|
<Link>Resources\Effects\GrayScaleEffect.ps</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -101,7 +101,8 @@
|
|||||||
"title": "Tools",
|
"title": "Tools",
|
||||||
"demoItemList": [
|
"demoItemList": [
|
||||||
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_16x", "" ],
|
[ "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">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Styles\TreeViewDemoCtl.xaml.cs">
|
||||||
<DependentUpon>TreeViewDemoCtl.xaml</DependentUpon>
|
<DependentUpon>TreeViewDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Tools\EffectsDemoCtl.xaml.cs">
|
||||||
|
<DependentUpon>EffectsDemoCtl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Tools\GeometryAnimationDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Tools\GeometryAnimationDemoCtl.xaml.cs">
|
||||||
<DependentUpon>GeometryAnimationDemoCtl.xaml</DependentUpon>
|
<DependentUpon>GeometryAnimationDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -863,6 +866,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Tools\EffectsDemoCtl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Tools\GeometryAnimationDemoCtl.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Tools\GeometryAnimationDemoCtl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<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>
|
||||||
/// 查找类似 邮箱 的本地化字符串。
|
/// 查找类似 邮箱 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -690,4 +690,7 @@
|
|||||||
<data name="Drawer" xml:space="preserve">
|
<data name="Drawer" xml:space="preserve">
|
||||||
<value>Drawer</value>
|
<value>Drawer</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Effects" xml:space="preserve">
|
||||||
|
<value>Effects</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -690,4 +690,7 @@
|
|||||||
<data name="Drawer" xml:space="preserve">
|
<data name="Drawer" xml:space="preserve">
|
||||||
<value>Drawer</value>
|
<value>Drawer</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Effects" xml:space="preserve">
|
||||||
|
<value>Effects</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -690,4 +690,7 @@
|
|||||||
<data name="Drawer" xml:space="preserve">
|
<data name="Drawer" xml:space="preserve">
|
||||||
<value>Drawer</value>
|
<value>Drawer</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Effects" xml:space="preserve">
|
||||||
|
<value>Effects</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -690,4 +690,7 @@
|
|||||||
<data name="Drawer" xml:space="preserve">
|
<data name="Drawer" xml:space="preserve">
|
||||||
<value>抽屉</value>
|
<value>抽屉</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Effects" xml:space="preserve">
|
||||||
|
<value>效果</value>
|
||||||
|
</data>
|
||||||
</root>
|
</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\ResolvedKeyFrameEntry.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\SplineGeometryKeyFrame.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\SplineGeometryKeyFrame.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Effects\ColorComplementEffect.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\BorderCircularClipConverter.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\ColLayoutConverter.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\CornerRadiusSplitConverter.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Tools\Converter\CornerRadiusSplitConverter.cs" />
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace HandyControl.Media.Effects
|
|||||||
public ColorComplementEffect()
|
public ColorComplementEffect()
|
||||||
{
|
{
|
||||||
PixelShader = Shader;
|
PixelShader = Shader;
|
||||||
|
|
||||||
UpdateShaderValue(InputProperty);
|
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