├── .hgignore ├── BuildProcessTemplates ├── DefaultTemplate.xaml └── UpgradeTemplate.xaml ├── README.md ├── Samples └── ZoomRect │ ├── Bin │ ├── System.Windows.Interactivity.dll │ └── System.Windows.Interactivity.xml │ ├── ZoomRect.sln │ └── ZoomRectApp │ ├── App.xaml │ ├── App.xaml.cs │ ├── Application.ico │ ├── Commands.cs │ ├── Commands.tt │ ├── DependencyProperties.cs │ ├── DependencyProperties.tt │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── MouseDragBehavior.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── RegionOfInterest.cs │ ├── ShaderEffectInfo.cs │ ├── Themes │ └── Generic.xaml │ ├── ZoomRectApp.csproj │ └── app.config ├── Shared ├── BaseInputShaderEffects.cs ├── BaseInputShaderEffects.tt ├── BaseShaderEffect.cs ├── DependencyProperties.cs ├── DependencyProperties.tt ├── DependencyProperties.ttinclude ├── EffectShaders.cs ├── EffectShaders.tt ├── ITransitionShaderEffect.cs ├── Images │ ├── Chrysanthemum.jpg │ └── Tulips.jpg ├── ShaderBinary │ ├── Add.fx.ps │ ├── Alpha.fx.ps │ ├── BandedSwirl.fx.ps │ ├── BandedSwirlTransition.fx.ps │ ├── BandedTransition.fx.ps │ ├── BlindsTransition.fx.ps │ ├── Bloom.fx.ps │ ├── BrightExtract.fx.ps │ ├── CircleRevealTransition.fx.ps │ ├── CircleStretchTransition.fx.ps │ ├── ColorKeyAlpha.fx.ps │ ├── ColorTone.fx.ps │ ├── ContrastAdjust.fx.ps │ ├── Darken.fx.ps │ ├── Difference.fx.ps │ ├── DirectionalBlur.fx.ps │ ├── Embossed.fx.ps │ ├── FadeTransition.fx.ps │ ├── Gloom.fx.ps │ ├── GrowablePoissonDisk.fx.ps │ ├── Identity.fx.ps │ ├── InvertColor.fx.ps │ ├── LeastBrightTransition.fx.ps │ ├── LightStreak.fx.ps │ ├── Lighten.fx.ps │ ├── LineRevealTransition.fx.ps │ ├── Magnify.fx.ps │ ├── Monochrome.fx.ps │ ├── MostBrightTransition.fx.ps │ ├── Multiply.fx.ps │ ├── NegationDifference.fx.ps │ ├── Pinch.fx.ps │ ├── Pixelate.fx.ps │ ├── PixelateInTransition.fx.ps │ ├── PixelateOutTransition.fx.ps │ ├── PixelateTransition.fx.ps │ ├── RadialBlurTransition.fx.ps │ ├── Ripple.fx.ps │ ├── RippleTransition.fx.ps │ ├── SaturateTransition.fx.ps │ ├── Sharpen.fx.ps │ ├── ShrinkTransition.fx.ps │ ├── SlideInTransition.fx.ps │ ├── SmoothMagnify.fx.ps │ ├── SmoothSwirlGridTransition.fx.ps │ ├── Sobel.fx.ps │ ├── Swirl.fx.ps │ ├── SwirlGridTransition.fx.ps │ ├── SwirlTransition.fx.ps │ ├── ToneMapping.fx.ps │ ├── Toon.fx.ps │ ├── WaterTransition.fx.ps │ ├── WaveTransition.fx.ps │ └── ZoomBlur.fx.ps ├── ShaderSource │ ├── Add.fx │ ├── Alpha.fx │ ├── BandedSwirl.fx │ ├── BandedSwirlTransition.fx │ ├── BandedTransition.fx │ ├── BlindsTransition.fx │ ├── Bloom.fx │ ├── BrightExtract.fx │ ├── CircleRevealTransition.fx │ ├── CircleStretchTransition.fx │ ├── ColorKeyAlpha.fx │ ├── ColorTone.fx │ ├── ContrastAdjust.fx │ ├── Darken.fx │ ├── Difference.fx │ ├── DirectionalBlur.fx │ ├── Embossed.fx │ ├── FadeTransition.fx │ ├── Gloom.fx │ ├── GrowablePoissonDisk.fx │ ├── Identity.fx │ ├── InvertColor.fx │ ├── LeastBrightTransition.fx │ ├── LightStreak.fx │ ├── Lighten.fx │ ├── LineRevealTransition.fx │ ├── Magnify.fx │ ├── Monochrome.fx │ ├── MostBrightTransition.fx │ ├── Multiply.fx │ ├── NegationDifference.fx │ ├── Pinch.fx │ ├── Pixelate.fx │ ├── PixelateInTransition.fx │ ├── PixelateOutTransition.fx │ ├── PixelateTransition.fx │ ├── RadialBlurTransition.fx │ ├── Ripple.fx │ ├── RippleTransition.fx │ ├── SaturateTransition.fx │ ├── Sharpen.fx │ ├── ShrinkTransition.fx │ ├── SlideInTransition.fx │ ├── SmoothMagnify.fx │ ├── SmoothSwirlGridTransition.fx │ ├── Sobel.fx │ ├── Swirl.fx │ ├── SwirlGridTransition.fx │ ├── SwirlTransition.fx │ ├── ToneMapping.fx │ ├── Toon.fx │ ├── WaterTransition.fx │ ├── WaveTransition.fx │ └── ZoomBlur.fx ├── TransitionEffectMixer.cs └── WpfShaderEffects.pfx ├── SilverlightShaderEffects ├── Common │ └── Utility.cs ├── Properties │ └── AssemblyInfo.cs └── SilverlightShaderEffects.csproj ├── SilverlightTestApplication ├── App.xaml ├── App.xaml.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── Properties │ ├── AppManifest.xml │ └── AssemblyInfo.cs └── SilverlightTestApplication.csproj ├── WpfAndSilverlightShaderEffects.sln ├── WpfShaderEffects.DirectX ├── CompiledEffect.cs ├── CompiledShader.cs ├── CompilerOptions.cs ├── ConstantInfo.cs ├── D3DXUtil.cs ├── EffectCompiler.cs ├── Interop │ ├── D3DXCONSTANTTABLE_DESC.cs │ ├── D3DXCONSTANT_DESC.cs │ ├── D3DXEFFECT_DESC.cs │ ├── D3DXFUNCTION_DESC.cs │ ├── D3DXMACRO.cs │ ├── D3DXMatrix16.cs │ ├── D3DXPARAMETER_CLASS.cs │ ├── D3DXPARAMETER_DESC.cs │ ├── D3DXPARAMETER_TYPE.cs │ ├── D3DXPASS_DESC.cs │ ├── D3DXREGISTER_SET.cs │ ├── D3DXSHADER.cs │ ├── D3DXTECHNIQUE_DESC.cs │ ├── D3DXVector4.cs │ ├── D3DX_PARAMETER.cs │ ├── ID3DXBuffer.cs │ ├── ID3DXConstantTable.cs │ ├── ID3DXEffectCompiler.cs │ ├── ID3DXEffectCompilerCustom.cs │ ├── IDirect3DPixelShader9.cs │ └── IDirect3DVertexShader9.cs ├── NativeMethods.cs ├── ParameterClass.cs ├── ParameterFlags.cs ├── ParameterInfo.cs ├── ParameterType.cs ├── Properties │ └── AssemblyInfo.cs ├── RegisterSet.cs ├── SafeLibraryHandle.cs ├── UnmanagedLibrary.cs └── WpfShaderEffects.DirectX.csproj ├── WpfShaderEffects.Experimental ├── DependencyProperties.cs ├── DependencyProperties.tt ├── EffectRepeater.cs ├── EffectStacker.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Themes │ └── Generic.xaml └── WpfShaderEffects.Experimental.csproj ├── WpfShaderEffects.sln ├── WpfShaderEffects ├── Common │ └── Utility.cs ├── EffectShaders.cs ├── EffectShaders.tt ├── Properties │ └── AssemblyInfo.cs ├── Themes │ └── Generic.xaml └── WpfShaderEffects.csproj ├── WpfTestApplication ├── App.xaml ├── App.xaml.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── WpfTestApplication.csproj └── app.config ├── license.html ├── license.md └── sample.jpg /.hgignore: -------------------------------------------------------------------------------- 1 | relre:^Output/ 2 | relre:\.user$ 3 | relre:\.suo$ 4 | relre:/bin/ 5 | relre:/obj/ 6 | relre:^_ReSharper\. 7 | relre:^_ReSharper\. 8 | relre:/_ReSharper\. 9 | syntax: regexp 10 | ^SilverlightOutput/ 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WpfShaderEffects is intended to be out-of- the-box-ready-to-use ShaderEffects for WPF. I lean on the great work that has already been done to use shader effects in WPF (notably wpffx and bling). I hope to provide a library that is easy to use and to change 2 | 3 | I owe it to the projects bling.codeplex.com and wpffx.codeplex.com. 4 | 5 | Wpffx provided me with the sources for the pixelshaders. 6 | 7 | Bling provided me with the idea and code that the DirectX isn't needed in order to compile .fx files. Requiring the full DirectX SDK is cumbersome and Bling had some interesting Interop code to DirectX instead (Originally written by someone named NyaRuRu appearantly). 8 | 9 | Basically what I've done is combining the pixelshaders from wpffx, the compiler from bling with some .TT files to autogenerate the WPF classes. 10 | 11 | I hope it proves useful 12 | 13 | PS Silverlight projects included as well 14 | 15 | ![Sample shaders](sample.jpg) 16 | -------------------------------------------------------------------------------- /Samples/ZoomRect/Bin/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Samples/ZoomRect/Bin/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRect.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZoomRectApp", "ZoomRectApp\ZoomRectApp.csproj", "{4D4E5438-9D4F-4B67-8AFC-F0B3874457A2}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfShaderEffects", "..\..\WpfShaderEffects\WpfShaderEffects.csproj", "{B8703764-3BE4-426E-8689-BD7D865D9D4B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release (Signed)|Any CPU = Release (Signed)|Any CPU 12 | Release|Any CPU = Release|Any CPU 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {4D4E5438-9D4F-4B67-8AFC-F0B3874457A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 16 | {4D4E5438-9D4F-4B67-8AFC-F0B3874457A2}.Debug|Any CPU.Build.0 = Debug|Any CPU 17 | {4D4E5438-9D4F-4B67-8AFC-F0B3874457A2}.Release (Signed)|Any CPU.ActiveCfg = Release (Signed)|Any CPU 18 | {4D4E5438-9D4F-4B67-8AFC-F0B3874457A2}.Release (Signed)|Any CPU.Build.0 = Release (Signed)|Any CPU 19 | {4D4E5438-9D4F-4B67-8AFC-F0B3874457A2}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {4D4E5438-9D4F-4B67-8AFC-F0B3874457A2}.Release|Any CPU.Build.0 = Release|Any CPU 21 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release (Signed)|Any CPU.ActiveCfg = Release (Signed)|Any CPU 24 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release (Signed)|Any CPU.Build.0 = Release (Signed)|Any CPU 25 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release|Any CPU.Build.0 = Release|Any CPU 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | namespace ZoomRectApp 16 | { 17 | /// 18 | /// Interaction logic for App.xaml 19 | /// 20 | public partial class App 21 | { 22 | } 23 | } -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/Application.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Samples/ZoomRect/ZoomRectApp/Application.ico -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/DependencyProperties.tt: -------------------------------------------------------------------------------- 1 | <# 2 | var namespaceName = "ZoomRectApp"; 3 | 4 | var model = new [] 5 | { 6 | // ---------------------------------------------------------------------------- 7 | // BEGIN_MODEL 8 | // ---------------------------------------------------------------------------- 9 | new DependencyObjectClass 10 | { 11 | Name = "MainWindow", 12 | Properties = new DependencyObjectProperty[] 13 | { 14 | }, 15 | }, 16 | new DependencyObjectClass 17 | { 18 | Name = "RegionOfInterest", 19 | Properties = new DependencyObjectProperty[] 20 | { 21 | Property("RoiVisibility", "System.Windows.Visibility" , "System.Windows.Visibility.Visible" , DependencyObjectPropertyFlags.None), 22 | Property("RoiZoom" , "decimal" , "1.0M" , DependencyObjectPropertyFlags.None), 23 | Property("RoiZoomFactor", "decimal" , "1.2M" , DependencyObjectPropertyFlags.None), 24 | Property("RoiX0" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 25 | Property("RoiY0" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 26 | Property("RoiX1" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 27 | Property("RoiY1" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 28 | Property("RoiCenterX" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 29 | Property("RoiCenterY" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 30 | Property("RoiLeft" , "double" , "0.0" , DependencyObjectPropertyFlags.Calculated), 31 | Property("RoiTop" , "double" , "0.0" , DependencyObjectPropertyFlags.Calculated), 32 | Property("RoiRight" , "double" , "0.0" , DependencyObjectPropertyFlags.Calculated), 33 | Property("RoiBottom" , "double" , "0.0" , DependencyObjectPropertyFlags.Calculated), 34 | Property("RoiWidth" , "double" , "0.0" , DependencyObjectPropertyFlags.Calculated), 35 | Property("RoiHeight" , "double" , "0.0" , DependencyObjectPropertyFlags.Calculated), 36 | 37 | Property("Shaders" , "System.Collections.ObjectModel.ObservableCollection" , null , DependencyObjectPropertyFlags.None), 38 | Property("CurrentShader" , "ZoomRectApp.ShaderEffectInfo" , null , DependencyObjectPropertyFlags.None), 39 | }, 40 | }, 41 | new DependencyObjectClass 42 | { 43 | Name = "ShaderEffectInfo", 44 | Properties = new DependencyObjectProperty[] 45 | { 46 | Property("Name" , "string" , null , DependencyObjectPropertyFlags.None), 47 | Property("ShaderEffect" , "System.Windows.Media.Effects.ShaderEffect" , null , DependencyObjectPropertyFlags.None), 48 | }, 49 | }, 50 | new DependencyObjectClass 51 | { 52 | Name = "MouseDragBehavior", 53 | Properties = new DependencyObjectProperty[] 54 | { 55 | Property("X" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 56 | Property("Y" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 57 | }, 58 | }, 59 | // ---------------------------------------------------------------------------- 60 | // END_MODEL 61 | // ---------------------------------------------------------------------------- 62 | }; 63 | #> 64 | 65 | <#@ include file="..\..\..\Shared\DependencyProperties.ttinclude" #> 66 | -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | using System.Reflection; 16 | using System.Runtime.InteropServices; 17 | using System.Windows; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("ZoomRectApp")] 23 | [assembly: AssemblyDescription("")] 24 | [assembly: AssemblyConfiguration("A sample program using WpfShaderEffects")] 25 | [assembly: AssemblyCompany("")] 26 | [assembly: AssemblyProduct("ZoomRectApp")] 27 | [assembly: AssemblyCopyright("Copyright © Mårten Rånge 2009")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Setting ComVisible to false makes the types in this assembly not visible 32 | // to COM components. If you need to access a type in this assembly from 33 | // COM, set the ComVisible attribute to true on that type. 34 | [assembly: ComVisible(false)] 35 | 36 | //In order to begin building localizable applications, set 37 | //CultureYouAreCodingWith in your .csproj file 38 | //inside a . For example, if you are using US english 39 | //in your source files, set the to en-US. Then uncomment 40 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 41 | //the line below to match the UICulture setting in the project file. 42 | 43 | //[assembly: NeutralResourcesLanguage("en-US" , UltimateResourceFallbackLocation.MainAssembly)] 44 | 45 | [assembly:ThemeInfo( 46 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 47 | //(used if a resource is not found in the page, 48 | // or application resource dictionaries) 49 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 50 | //(used if a resource is not found in the page, 51 | // app, or any theme specific resource dictionaries) 52 | )] 53 | 54 | // Version information for an assembly consists of the following four values: 55 | // 56 | // Major Version 57 | // Minor Version 58 | // Build Number 59 | // Revision 60 | // 61 | // You can specify all the values or you can default the Build and Revision Numbers 62 | // by using the '*' as shown below: 63 | // [assembly: AssemblyVersion("1.0.*")] 64 | [assembly: AssemblyVersion("1.0.*")] 65 | [assembly: AssemblyFileVersion("1.0.*")] 66 | 67 | -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/ShaderEffectInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | using System.Windows; 16 | 17 | namespace ZoomRectApp 18 | { 19 | public sealed partial class ShaderEffectInfo : DependencyObject 20 | { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Samples/ZoomRect/ZoomRectApp/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Shared/BaseInputShaderEffects.tt: -------------------------------------------------------------------------------- 1 | <#@ template language="C#v" hostspecific="true" debug="false" #> 2 | <#@ output extension=".cs" #> 3 | <#@ assembly name="System.Core" #> 4 | <#@ import namespace="System.Linq" #> 5 | <#@ import namespace="System.IO" #> 6 | <#@ import namespace="System.Text" #> 7 | <#@ import namespace="System.Text.RegularExpressions" #> 8 | <#@ import namespace="System.Reflection" #> 9 | <#@ import namespace="System.Collections.Generic" #> 10 | /* **************************************************************************** 11 | * 12 | * Copyright (c) Mårten Rånge. 13 | * 14 | * This source code is subject to terms and conditions of the Microsoft Public License. A 15 | * copy of the license can be found in the License.html file at the root of this distribution. If 16 | * you cannot locate the Microsoft Public License, please send an email to 17 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 18 | * by the terms of the Microsoft Public License. 19 | * 20 | * You must not remove this notice, or any other, from this software. 21 | * 22 | * 23 | * ***************************************************************************/ 24 | 25 | // ReSharper disable ConditionIsAlwaysTrueOrFalse 26 | // ReSharper disable HeuristicUnreachableCode 27 | // ReSharper disable InconsistentNaming 28 | // ReSharper disable PartialMethodWithSinglePart 29 | // ReSharper disable PartialTypeWithSinglePart 30 | // ReSharper disable RedundantAssignment 31 | // ReSharper disable RedundantCast 32 | // ReSharper disable RedundantIfElseBlock 33 | 34 | using System.Windows; 35 | using System.Windows.Media; 36 | using System.Windows.Media.Effects; 37 | 38 | #if SILVERLIGHT 39 | namespace SilverlightShaderEffects 40 | #else 41 | namespace WpfShaderEffects 42 | #endif 43 | { 44 | <# 45 | var count = 4; 46 | var countToClassName = new [] 47 | { 48 | "BaseSingleInputShaderEffect", 49 | "BaseTwoInputsShaderEffect", 50 | "BaseThreeInputsShaderEffect", 51 | "BaseFourInputsShaderEffect", 52 | }; 53 | 54 | var countToPropertyName = new [] 55 | { 56 | "Input", 57 | "SecondInput", 58 | "ThirdInput", 59 | "FourthInput", 60 | }; 61 | 62 | for(var iter = 0; iter < count; ++iter) 63 | { 64 | var className = countToClassName[iter]; 65 | #> 66 | public abstract partial class <#=className#> : BaseShaderEffect 67 | { 68 | partial void OnConstruction(PixelShader pixelShader); 69 | protected <#=className#>(PixelShader pixelShader) 70 | : base(pixelShader) 71 | { 72 | <# 73 | for(var subIter = 0; subIter < iter + 1; ++subIter) 74 | { 75 | #> 76 | UpdateShaderValue(<#=countToPropertyName[subIter]#>Property); 77 | <# 78 | } 79 | #> 80 | OnConstruction(pixelShader); 81 | } 82 | 83 | <# 84 | for(var subIter = 0; subIter < iter + 1; ++subIter) 85 | { 86 | #> 87 | public static readonly DependencyProperty <#=countToPropertyName[subIter]#>Property = 88 | RegisterPixelShaderSamplerProperty( 89 | "<#=countToPropertyName[subIter]#>", 90 | typeof(<#=className#>), 91 | <#=subIter#>); 92 | 93 | public Brush <#=countToPropertyName[subIter]#> 94 | { 95 | get 96 | { 97 | return (Brush)GetValue(<#=countToPropertyName[subIter]#>Property); 98 | } 99 | set 100 | { 101 | SetValue(<#=countToPropertyName[subIter]#>Property, value); 102 | } 103 | } 104 | 105 | <# 106 | } 107 | #> 108 | } 109 | <# 110 | } 111 | #> 112 | } -------------------------------------------------------------------------------- /Shared/BaseShaderEffect.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System.Windows; 17 | using System.Windows.Media; 18 | using System.Windows.Media.Effects; 19 | 20 | #if SILVERLIGHT 21 | namespace SilverlightShaderEffects 22 | #else 23 | namespace WpfShaderEffects 24 | #endif 25 | { 26 | public abstract partial class BaseShaderEffect : ShaderEffect 27 | { 28 | partial void OnConstruction(PixelShader pixelShader); 29 | 30 | protected BaseShaderEffect(PixelShader pixelShader) 31 | { 32 | PixelShader = pixelShader; 33 | OnConstruction(pixelShader); 34 | } 35 | 36 | protected const double Pi = System.Math.PI; 37 | 38 | protected static Point MakePoint(double x, double y) 39 | { 40 | return new Point(x, y); 41 | } 42 | 43 | protected static Color MakeColor(byte r, byte g, byte b) 44 | { 45 | return MakeColor(0xFF, r, g, b); 46 | } 47 | 48 | protected static Color MakeColor(byte alpha, byte r, byte g, byte b) 49 | { 50 | return Color.FromArgb(alpha, r, g, b); 51 | } 52 | 53 | protected static double Clamp(double value, double min, double max) 54 | { 55 | return System.Math.Min(max, System.Math.Max(min, value)); 56 | } 57 | 58 | protected static Point Clamp(Point value, Point min, Point max) 59 | { 60 | return new Point( 61 | Clamp(value.X, min.X, max.X), 62 | Clamp(value.Y, min.Y, max.Y)); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Shared/DependencyProperties.tt: -------------------------------------------------------------------------------- 1 | <# 2 | var namespaceName = "WpfShaderEffects"; 3 | var model = new DependencyObjectClass[] 4 | { 5 | // ---------------------------------------------------------------------------- 6 | // BEGIN_MODEL 7 | // ---------------------------------------------------------------------------- 8 | new DependencyObjectClass 9 | { 10 | Name = "TransitionEffectMixer", 11 | Properties = new DependencyObjectProperty[] 12 | { 13 | Property("Left" , "object" , "null" , DependencyObjectPropertyFlags.None), 14 | Property("Right" , "object" , "null" , DependencyObjectPropertyFlags.None), 15 | Property("Mix" , "double" , "0.0" , DependencyObjectPropertyFlags.None), 16 | Property("TransitionShaderEffect" , "ITransitionShaderEffect" , "null" , DependencyObjectPropertyFlags.None), 17 | }, 18 | }, 19 | // ---------------------------------------------------------------------------- 20 | // END_MODEL 21 | // ---------------------------------------------------------------------------- 22 | }; 23 | 24 | #> 25 | 26 | <#@ include file=".\DependencyProperties.ttinclude" #> 27 | -------------------------------------------------------------------------------- /Shared/ITransitionShaderEffect.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System.Windows.Media; 17 | 18 | #if SILVERLIGHT 19 | namespace SilverlightShaderEffects 20 | #else 21 | namespace WpfShaderEffects 22 | #endif 23 | { 24 | public interface ITransitionShaderEffect 25 | { 26 | double Progress { get; set; } 27 | Brush Input { get; set; } 28 | Brush SecondInput { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Shared/Images/Chrysanthemum.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/Images/Chrysanthemum.jpg -------------------------------------------------------------------------------- /Shared/Images/Tulips.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/Images/Tulips.jpg -------------------------------------------------------------------------------- /Shared/ShaderBinary/Add.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Add.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Alpha.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Alpha.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/BandedSwirl.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/BandedSwirl.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/BandedSwirlTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/BandedSwirlTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/BandedTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/BandedTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/BlindsTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/BlindsTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Bloom.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Bloom.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/BrightExtract.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/BrightExtract.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/CircleRevealTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/CircleRevealTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/CircleStretchTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/CircleStretchTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/ColorKeyAlpha.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/ColorKeyAlpha.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/ColorTone.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/ColorTone.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/ContrastAdjust.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/ContrastAdjust.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Darken.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Darken.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Difference.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Difference.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/DirectionalBlur.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/DirectionalBlur.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Embossed.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Embossed.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/FadeTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/FadeTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Gloom.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Gloom.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/GrowablePoissonDisk.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/GrowablePoissonDisk.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Identity.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Identity.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/InvertColor.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/InvertColor.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/LeastBrightTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/LeastBrightTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/LightStreak.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/LightStreak.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Lighten.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Lighten.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/LineRevealTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/LineRevealTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Magnify.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Magnify.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Monochrome.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Monochrome.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/MostBrightTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/MostBrightTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Multiply.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Multiply.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/NegationDifference.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/NegationDifference.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Pinch.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Pinch.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Pixelate.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Pixelate.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/PixelateInTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/PixelateInTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/PixelateOutTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/PixelateOutTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/PixelateTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/PixelateTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/RadialBlurTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/RadialBlurTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Ripple.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Ripple.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/RippleTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/RippleTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/SaturateTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/SaturateTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Sharpen.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Sharpen.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/ShrinkTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/ShrinkTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/SlideInTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/SlideInTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/SmoothMagnify.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/SmoothMagnify.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/SmoothSwirlGridTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/SmoothSwirlGridTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Sobel.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Sobel.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Swirl.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Swirl.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/SwirlGridTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/SwirlGridTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/SwirlTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/SwirlTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/ToneMapping.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/ToneMapping.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/Toon.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/Toon.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/WaterTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/WaterTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/WaveTransition.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/WaveTransition.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderBinary/ZoomBlur.fx.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/Shared/ShaderBinary/ZoomBlur.fx.ps -------------------------------------------------------------------------------- /Shared/ShaderSource/Add.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Add 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of alpha applied on effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 1.0 14 | // ParameterCoerce : Clamp(Alpha, 0.0, 1.0) 15 | float Alpha : register(C0); 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Sampler Inputs (Brushes, including ImplicitInput) 19 | //-------------------------------------------------------------------------------------- 20 | 21 | sampler2D implicitInputSampler : register(S0); 22 | sampler2D secondInput : register(S1); 23 | 24 | float4 main(float2 uv : TEXCOORD) : COLOR 25 | { 26 | float4 firstTexel = tex2D(implicitInputSampler, uv); 27 | float4 secondTexel = tex2D(secondInput, uv); 28 | 29 | float4 result; 30 | result.a = firstTexel.a; 31 | result.rgb = (firstTexel.a * firstTexel.rgb + secondTexel.a * secondTexel.rgb) / result.a; 32 | result.rgb = lerp(firstTexel.rgb, result.rgb, Alpha); 33 | 34 | return result; 35 | } 36 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Alpha.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Alpha 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of alpha on input 12 | // ParameterType : double 13 | // ParameterDefaultValue : 1.0 14 | // ParameterCoerce : Clamp(Alpha, 0.0, 1.0) 15 | float Alpha : register(C0); 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Sampler Inputs (Brushes, including ImplicitInput) 19 | //-------------------------------------------------------------------------------------- 20 | 21 | sampler2D implicitInputSampler : register(S0); 22 | 23 | float4 main(float2 uv : TEXCOORD) : COLOR 24 | { 25 | float4 firstTexel = tex2D(implicitInputSampler, uv); 26 | 27 | firstTexel.a *= Alpha; 28 | 29 | return firstTexel; 30 | } 31 | -------------------------------------------------------------------------------- /Shared/ShaderSource/BandedSwirl.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- BandedSwirlEffect 4 | // Swirl shader with bands going in different directions 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Center of swirl effect 12 | // ParameterType : Point 13 | // ParameterDefaultValue : MakePoint(0.5,0.5) 14 | float2 Center : register(C0); 15 | 16 | // ParameterComment : Strength of spiral in swirl effect 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.5 19 | float SpiralStrength : register(C1); 20 | 21 | // ParameterComment : DistanceThreshold 22 | // ParameterType : double 23 | // ParameterDefaultValue : 0.5 24 | float DistanceThreshold : register(C2); 25 | 26 | //-------------------------------------------------------------------------------------- 27 | // Sampler Inputs (Brushes, including ImplicitInput) 28 | //-------------------------------------------------------------------------------------- 29 | 30 | sampler2D implicitInputSampler : register(S0); 31 | 32 | //-------------------------------------------------------------------------------------- 33 | // Pixel Shader 34 | //-------------------------------------------------------------------------------------- 35 | 36 | float4 main(float2 uv : TEXCOORD) : COLOR 37 | { 38 | float2 dir = uv - Center; 39 | float l = length(dir); 40 | 41 | dir = dir/l; 42 | float angle = atan2(dir.y, dir.x); 43 | 44 | float remainder = frac(l / DistanceThreshold); 45 | 46 | float preTransitionWidth = 0.25; 47 | float fac; 48 | 49 | if (remainder < .25) 50 | { 51 | fac = 1.0; 52 | } 53 | else if (remainder < 0.5) 54 | { 55 | // transition zone - go smoothly from previous zone to next. 56 | fac = 1 - 8 * (remainder - preTransitionWidth); 57 | } 58 | else if (remainder < 0.75) 59 | { 60 | fac = -1.0; 61 | } 62 | else 63 | { 64 | // transition zone - go smoothly from previous zone to next. 65 | fac = -(1 - 8 * (remainder - 0.75)); 66 | } 67 | 68 | float newAng = angle + fac * SpiralStrength * l; 69 | 70 | float xAmt = cos(newAng) * l; 71 | float yAmt = sin(newAng) * l; 72 | 73 | float2 newCoord = Center + float2(xAmt, yAmt); 74 | 75 | return tex2D( implicitInputSampler, newCoord ); 76 | } 77 | -------------------------------------------------------------------------------- /Shared/ShaderSource/BandedSwirlTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | float TwistAmount : register(C1); 3 | float Frequency : register(C2); 4 | sampler2D implicitInput : register(S0); 5 | sampler2D oldInput : register(S1); 6 | 7 | float4 SampleWithBorder(float4 border, sampler2D tex, float2 uv) 8 | { 9 | if (any(saturate(uv) - uv)) 10 | { 11 | return border; 12 | } 13 | else 14 | { 15 | return tex2D(tex, uv); 16 | } 17 | } 18 | 19 | float4 BandedSwirl(float2 uv) 20 | { 21 | float2 center = float2(0.5,0.5); 22 | float2 toUV = uv - center; 23 | float distanceFromCenter = length(toUV); 24 | float2 normToUV = toUV / distanceFromCenter; 25 | float angle = atan2(normToUV.y, normToUV.x); 26 | 27 | angle += sin(distanceFromCenter * Frequency) * TwistAmount * Progress; 28 | float2 newUV; 29 | sincos(angle, newUV.y, newUV.x); 30 | newUV = newUV * distanceFromCenter + center; 31 | 32 | float4 c1 = tex2D(oldInput, frac(newUV)); 33 | float4 c2 = tex2D(implicitInput, uv); 34 | 35 | return lerp(c1,c2, Progress); 36 | } 37 | 38 | //-------------------------------------------------------------------------------------- 39 | // Pixel Shader 40 | //-------------------------------------------------------------------------------------- 41 | float4 main(float2 uv : TEXCOORD0) : COLOR0 42 | { 43 | return BandedSwirl(uv); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Shared/ShaderSource/BandedTransition.fx: -------------------------------------------------------------------------------- 1 | 2 | // ParameterComment : Progress of transition 3 | // ParameterType : double 4 | // ParameterDefaultValue : 0.0 5 | // ParameterCoerce : Clamp(Progress, 0.0, 1.0) 6 | float Progress : register(C0); 7 | 8 | // ParameterComment : Height of bands 9 | // ParameterType : double 10 | // ParameterDefaultValue : 0.2 11 | // ParameterCoerce : Clamp(BandHeight, 0.0, 1.0) 12 | float BandHeight : register(C1); 13 | 14 | // ParameterComment : Offset of bands 15 | // ParameterType : double 16 | // ParameterDefaultValue : 0.0 17 | // ParameterCoerce : Clamp(BandOffset, 0.0, 1.0) 18 | float BandOffset : register(C2); 19 | 20 | // ParameterDdxDdy : 21 | float4 ddx_ddy : register(C3); 22 | 23 | sampler2D implicitInput : register(S0); 24 | sampler2D oldInput : register(S1); 25 | 26 | //-------------------------------------------------------------------------------------- 27 | // Pixel Shader 28 | //-------------------------------------------------------------------------------------- 29 | float4 main(float2 uv : TEXCOORD0) : COLOR0 30 | { 31 | float4 oldColor = tex2D(oldInput, uv); 32 | 33 | float choice = ((uv.y + BandOffset) / max(max(BandHeight, ddx_ddy.w), 0.000001)) % 2; 34 | 35 | float invertedProgress = 1.0 - Progress; 36 | 37 | float4 newColor; 38 | 39 | if (choice > 1.0) 40 | { 41 | if (uv.x > invertedProgress) 42 | { 43 | newColor = tex2D(implicitInput, float2(uv.x - invertedProgress, uv.y)); 44 | } 45 | else 46 | { 47 | newColor = oldColor; 48 | } 49 | } 50 | else 51 | { 52 | if (uv.x < Progress) 53 | { 54 | newColor = tex2D(implicitInput, float2(invertedProgress + uv.x, uv.y)); 55 | } 56 | else 57 | { 58 | newColor = oldColor; 59 | } 60 | } 61 | 62 | return lerp(oldColor, newColor, Progress); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /Shared/ShaderSource/BlindsTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | struct VS_OUTPUT 6 | { 7 | float4 Position : POSITION; 8 | float4 Color : COLOR0; 9 | float2 UV : TEXCOORD0; 10 | }; 11 | 12 | float4 Blinds(float2 uv) 13 | { 14 | if(frac(uv.y * 5) < Progress) 15 | { 16 | return tex2D(implicitInput, uv); 17 | } 18 | else 19 | { 20 | return tex2D(oldInput, uv); 21 | } 22 | } 23 | 24 | //-------------------------------------------------------------------------------------- 25 | // Pixel Shader 26 | //-------------------------------------------------------------------------------------- 27 | float4 main(VS_OUTPUT input) : COLOR0 28 | { 29 | return Blinds(input.UV); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Bloom.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- BloomEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Intensity of bloom effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.8 14 | float BloomIntensity : register(C0); 15 | 16 | // ParameterComment : Intensity of base image 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.6 19 | float BaseIntensity : register(C1); 20 | 21 | // ParameterComment : Bloom effect saturation 22 | // ParameterType : double 23 | // ParameterDefaultValue : 1.0 24 | float BloomSaturation : register(C2); 25 | 26 | // ParameterComment : Base image saturation 27 | // ParameterType : double 28 | // ParameterDefaultValue : 1.0 29 | float BaseSaturation : register(C3); 30 | 31 | //-------------------------------------------------------------------------------------- 32 | // Sampler Inputs (Brushes, including ImplicitInput) 33 | //-------------------------------------------------------------------------------------- 34 | 35 | sampler2D implicitInputSampler : register(S0); 36 | 37 | 38 | //-------------------------------------------------------------------------------------- 39 | // Pixel Shader 40 | //-------------------------------------------------------------------------------------- 41 | float4 AdjustSaturation(float4 color, float saturation) 42 | { 43 | float grey = dot(color, float3(0.3, 0.59, 0.11)); 44 | return lerp(grey, color, saturation); 45 | } 46 | 47 | float4 main(float2 uv : TEXCOORD) : COLOR 48 | { 49 | float BloomThreshold = 0.25f; 50 | 51 | float4 base = tex2D(implicitInputSampler, uv); 52 | float4 bloom = saturate((base - BloomThreshold) / (1 - BloomThreshold)); 53 | 54 | // Adjust color saturation and intensity. 55 | bloom = AdjustSaturation(bloom, BloomSaturation) * BloomIntensity; 56 | base = AdjustSaturation(base, BaseSaturation) * BaseIntensity; 57 | 58 | // Darken down the base image in areas where there is a lot of bloom, 59 | // to prevent things looking excessively burned-out. 60 | base *= (1 - saturate(bloom)); 61 | 62 | // Combine the two images. 63 | return base + bloom; 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /Shared/ShaderSource/BrightExtract.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- BrightExtractEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Brightness threshold 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.5 14 | // ParameterCoerce : Clamp(Threshold, 0.0, 1.0) 15 | float Threshold : register(C0); 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Sampler Inputs (Brushes, including ImplicitInput) 19 | //-------------------------------------------------------------------------------------- 20 | 21 | sampler2D implicitInputSampler : register(S0); 22 | 23 | 24 | //-------------------------------------------------------------------------------------- 25 | // Pixel Shader 26 | //-------------------------------------------------------------------------------------- 27 | 28 | float4 main(float2 uv : TEXCOORD) : COLOR 29 | { 30 | // Look up the original image color. 31 | float4 c = tex2D(implicitInputSampler, uv); 32 | 33 | // Adjust it to keep only values brighter than the specified threshold. 34 | return saturate((c - Threshold) / (1 - Threshold)); 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /Shared/ShaderSource/CircleRevealTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | float FuzzyAmount : register(C1); 3 | sampler2D implicitInput : register(S0); 4 | sampler2D oldInput : register(S1); 5 | 6 | struct VS_OUTPUT 7 | { 8 | float4 Position : POSITION; 9 | float4 Color : COLOR0; 10 | float2 UV : TEXCOORD0; 11 | }; 12 | 13 | float4 Circle(float2 uv) 14 | { 15 | float radius = -FuzzyAmount + Progress * (0.70710678 + 2.0 * FuzzyAmount); 16 | float fromCenter = length(uv - float2(0.5,0.5)); 17 | float distFromCircle = fromCenter - radius; 18 | 19 | float4 c1 = tex2D(oldInput, uv); 20 | float4 c2 = tex2D(implicitInput, uv); 21 | 22 | float p = saturate((distFromCircle + FuzzyAmount) / (2.0 * FuzzyAmount)); 23 | return lerp(c2, c1, p); 24 | } 25 | 26 | //-------------------------------------------------------------------------------------- 27 | // Pixel Shader 28 | //-------------------------------------------------------------------------------------- 29 | float4 main(VS_OUTPUT input) : COLOR0 30 | { 31 | return Circle(input.UV); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Shared/ShaderSource/CircleStretchTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | struct VS_OUTPUT 6 | { 7 | float4 Position : POSITION; 8 | float4 Color : COLOR0; 9 | float2 UV : TEXCOORD0; 10 | }; 11 | 12 | float DistanceFromCenterToSquareEdge(float2 dir) 13 | { 14 | dir = abs(dir); 15 | float dist = dir.x > dir.y ? dir.x : dir.y; 16 | return dist; 17 | } 18 | 19 | float4 CircleStretch(float2 uv) 20 | { 21 | float2 center = float2(0.5,0.5); 22 | float radius = Progress * 0.70710678; 23 | float2 toUV = uv - center; 24 | float len = length(toUV); 25 | float2 normToUV = toUV / len; 26 | 27 | if(len < radius) 28 | { 29 | float distFromCenterToEdge = DistanceFromCenterToSquareEdge(normToUV) / 2.0; 30 | float2 edgePoint = center + distFromCenterToEdge * normToUV; 31 | 32 | float minRadius = min(radius, distFromCenterToEdge); 33 | float percentFromCenterToRadius = len / minRadius; 34 | 35 | float2 newUV = lerp(center, edgePoint, percentFromCenterToRadius); 36 | return tex2D(implicitInput, newUV); 37 | } 38 | else 39 | { 40 | float distFromCenterToEdge = DistanceFromCenterToSquareEdge(normToUV); 41 | float2 edgePoint = center + distFromCenterToEdge * normToUV; 42 | float distFromRadiusToEdge = distFromCenterToEdge - radius; 43 | 44 | float2 radiusPoint = center + radius * normToUV; 45 | float2 radiusToUV = uv - radiusPoint; 46 | 47 | float percentFromRadiusToEdge = length(radiusToUV) / distFromRadiusToEdge; 48 | 49 | float2 newUV = lerp(center, edgePoint, percentFromRadiusToEdge); 50 | return tex2D(oldInput, newUV); 51 | } 52 | } 53 | 54 | 55 | //-------------------------------------------------------------------------------------- 56 | // Pixel Shader 57 | //-------------------------------------------------------------------------------------- 58 | float4 main(VS_OUTPUT input) : COLOR0 59 | { 60 | return CircleStretch(input.UV); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Shared/ShaderSource/ColorKeyAlpha.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- ColorKeyAlphaEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //-------------------------------------------------------------------------------------- 8 | // Sampler Inputs (Brushes, including ImplicitInput) 9 | //-------------------------------------------------------------------------------------- 10 | 11 | sampler2D implicitInputSampler : register(S0); 12 | 13 | //-------------------------------------------------------------------------------------- 14 | // Pixel Shader 15 | //-------------------------------------------------------------------------------------- 16 | 17 | float4 main(float2 uv : TEXCOORD) : COLOR 18 | { 19 | float4 color = tex2D( implicitInputSampler, uv ); 20 | 21 | if( color.r + color.g + color.b < 0.3 ) { 22 | color.rgba = 0; 23 | } 24 | 25 | return color; 26 | } 27 | -------------------------------------------------------------------------------- /Shared/ShaderSource/ColorTone.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- ColorToneEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Desaturation value 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.5 14 | // ParameterCoerce : Clamp(Desaturation, 0.0, 1.0) 15 | float Desaturation : register(C0); 16 | 17 | // ParameterComment : Toned value 18 | // ParameterType : double 19 | // ParameterDefaultValue : 0.5 20 | // ParameterCoerce : Clamp(Toned, 0.0, 1.0) 21 | float Toned : register(C1); 22 | 23 | // ParameterComment : LightColor value 24 | // ParameterType : Color 25 | // ParameterDefaultValue : MakeColor(0xFF, 0x7F, 0x00) 26 | float4 LightColor : register(C2); 27 | 28 | // ParameterComment : DarkColor value 29 | // ParameterType : Color 30 | // ParameterDefaultValue : MakeColor(0x00, 0x3F, 0x7F) 31 | float4 DarkColor : register(C3); 32 | 33 | //-------------------------------------------------------------------------------------- 34 | // Sampler Inputs (Brushes, including ImplicitInput) 35 | //-------------------------------------------------------------------------------------- 36 | 37 | sampler2D implicitInputSampler : register(S0); 38 | 39 | 40 | //-------------------------------------------------------------------------------------- 41 | // Pixel Shader 42 | //-------------------------------------------------------------------------------------- 43 | 44 | float4 main(float2 uv : TEXCOORD) : COLOR 45 | { 46 | float4 scnColor = LightColor * tex2D(implicitInputSampler, uv); 47 | float gray = dot(float3(0.3, 0.59, 0.11), scnColor.rgb); 48 | 49 | float3 muted = lerp(scnColor.rgb, gray.xxx, Desaturation); 50 | float3 middle = lerp(DarkColor, LightColor, gray); 51 | 52 | scnColor.rgb = lerp(muted, middle, Toned); 53 | return scnColor; 54 | } 55 | 56 | 57 | -------------------------------------------------------------------------------- /Shared/ShaderSource/ContrastAdjust.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- ContrastAdjustEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Brightness color 12 | // ParameterType : Color 13 | // ParameterDefaultValue : MakeColor(0x2F, 0x2F, 0x2F) 14 | float4 Brightness : register(C0); 15 | 16 | // ParameterComment : Contrast value 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.2 19 | // ParameterCoerce : Clamp(Contrast, 0.0, 1.0) 20 | float Contrast : register(C1); 21 | 22 | //-------------------------------------------------------------------------------------- 23 | // Sampler Inputs (Brushes, including ImplicitInput) 24 | //-------------------------------------------------------------------------------------- 25 | 26 | sampler2D implicitInputSampler : register(S0); 27 | 28 | 29 | //-------------------------------------------------------------------------------------- 30 | // Pixel Shader 31 | //-------------------------------------------------------------------------------------- 32 | 33 | float4 main(float2 uv : TEXCOORD) : COLOR 34 | { 35 | float4 pixelColor = tex2D(implicitInputSampler, uv); 36 | 37 | //contrast 38 | pixelColor.rgb = (pixelColor.rgb - 0.5f) * Contrast + 0.5f; 39 | 40 | //brightness 41 | pixelColor.rgb = pixelColor.rgb + Brightness; 42 | 43 | // return final pixel color 44 | return pixelColor; 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Darken.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Darken 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of alpha applied on effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 1.0 14 | // ParameterCoerce : Clamp(Alpha, 0.0, 1.0) 15 | float Alpha : register(C0); 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Sampler Inputs (Brushes, including ImplicitInput) 19 | //-------------------------------------------------------------------------------------- 20 | 21 | sampler2D implicitInputSampler : register(S0); 22 | sampler2D secondInput : register(S1); 23 | 24 | float4 main(float2 uv : TEXCOORD) : COLOR 25 | { 26 | float4 firstTexel = tex2D(implicitInputSampler, uv); 27 | float4 secondTexel = tex2D(secondInput, uv); 28 | 29 | float4 result; 30 | result.rgb = min(firstTexel.a * firstTexel.rgb, secondTexel.a * secondTexel.rgb) / firstTexel.a; 31 | result.rgb = lerp(firstTexel.rgb, result.rgb, Alpha); 32 | result.a = firstTexel.a; 33 | 34 | return result; 35 | } 36 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Difference.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Difference 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of alpha applied on effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 1.0 14 | // ParameterCoerce : Clamp(Alpha, 0.0, 1.0) 15 | float Alpha : register(C0); 16 | 17 | // ParameterComment : Multiplier to apply at end of calculation (can be used invert the result) 18 | // ParameterType : double 19 | // ParameterDefaultValue : 1.0 20 | // ParameterCoerce : Clamp(Multiplier, -1.0, 1.0) 21 | float Multiplier : register(C1); 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // Sampler Inputs (Brushes, including ImplicitInput) 25 | //-------------------------------------------------------------------------------------- 26 | 27 | sampler2D implicitInputSampler : register(S0); 28 | sampler2D secondInput : register(S1); 29 | 30 | float4 main(float2 uv : TEXCOORD) : COLOR 31 | { 32 | float4 firstTexel = tex2D(implicitInputSampler, uv); 33 | float4 secondTexel = tex2D(secondInput, uv); 34 | 35 | float4 result; 36 | result.a = firstTexel.a; 37 | result.rgb = Multiplier * (firstTexel.a * firstTexel.rgb - secondTexel.a * secondTexel.rgb) / result.a; 38 | result.rgb = lerp(firstTexel.rgb, result.rgb, Alpha); 39 | 40 | return result; 41 | } 42 | -------------------------------------------------------------------------------- /Shared/ShaderSource/DirectionalBlur.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- DirectionalBlurEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Blur direction (in radians) 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.1 14 | // ParameterCoerce : Angle % (2.0 * Pi) 15 | float Angle : register(C0); 16 | 17 | // ParameterComment : Amount of blur 18 | // ParameterType : double 19 | // ParameterDefaultValue : 0.2 20 | // ParameterCoerce : Clamp(BlurAmount, 0.0, double.MaxValue) 21 | float BlurAmount : register(C1); 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // Sampler Inputs (Brushes, including ImplicitInput) 25 | //-------------------------------------------------------------------------------------- 26 | 27 | sampler2D implicitInputSampler : register(S0); 28 | 29 | //-------------------------------------------------------------------------------------- 30 | // Pixel Shader 31 | //-------------------------------------------------------------------------------------- 32 | 33 | float4 main(float2 uv : TEXCOORD) : COLOR 34 | { 35 | float4 c = 0; 36 | float xOffset = cos(Angle); 37 | float yOffset = sin(Angle); 38 | 39 | for(int i=0; i<16; i++) 40 | { 41 | uv.x = uv.x - BlurAmount * xOffset; 42 | uv.y = uv.y - BlurAmount * yOffset; 43 | c += tex2D(implicitInputSampler, uv); 44 | } 45 | c /= 16; 46 | 47 | return c; 48 | } -------------------------------------------------------------------------------- /Shared/ShaderSource/Embossed.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- EmbossedEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of emboss 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.2 14 | // ParameterCoerce : Clamp(Amount, -1.0, 1.0) 15 | float Amount : register(C0); 16 | 17 | // ParameterComment : Width of emboss 18 | // ParameterType : double 19 | // ParameterDefaultValue : 0.01 20 | // ParameterCoerce : Clamp(Width, 0.0, 1.0) 21 | float Width : register(C1); 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // Sampler Inputs (Brushes, including ImplicitInput) 25 | //-------------------------------------------------------------------------------------- 26 | 27 | sampler2D implicitInputSampler : register(S0); 28 | 29 | 30 | //-------------------------------------------------------------------------------------- 31 | // Pixel Shader 32 | //-------------------------------------------------------------------------------------- 33 | 34 | float4 main(float2 uv : TEXCOORD) : COLOR 35 | { 36 | float4 outC = {0.5, 0.5, 0.5, 1.0}; 37 | 38 | outC -= tex2D(implicitInputSampler, uv - Width) * Amount; 39 | outC += tex2D(implicitInputSampler, uv + Width) * Amount; 40 | outC.rgb = (outC.r + outC.g + outC.b) / 3.0f; 41 | 42 | return outC; 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /Shared/ShaderSource/FadeTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | struct VS_OUTPUT 6 | { 7 | float4 Position : POSITION; 8 | float4 Color : COLOR0; 9 | float2 UV : TEXCOORD0; 10 | }; 11 | 12 | float4 Fade(float2 uv) 13 | { 14 | float4 c1 = tex2D(oldInput, uv); 15 | float4 c2 = tex2D(implicitInput, uv); 16 | 17 | return lerp(c1,c2, Progress); 18 | } 19 | 20 | //-------------------------------------------------------------------------------------- 21 | // Pixel Shader 22 | //-------------------------------------------------------------------------------------- 23 | float4 main(VS_OUTPUT input) : COLOR0 24 | { 25 | return Fade(input.UV); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Gloom.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- GloomEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Intensity of gloom effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.8 14 | float GloomIntensity : register(C0); 15 | 16 | // ParameterComment : Intensity of base image 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.6 19 | float BaseIntensity : register(C1); 20 | 21 | // ParameterComment : Gloom effect saturation 22 | // ParameterType : double 23 | // ParameterDefaultValue : 1.0 24 | float GloomSaturation : register(C2); 25 | 26 | // ParameterComment : Base image saturation 27 | // ParameterType : double 28 | // ParameterDefaultValue : 1.0 29 | float BaseSaturation : register(C3); 30 | 31 | //-------------------------------------------------------------------------------------- 32 | // Sampler Inputs (Brushes, including ImplicitInput) 33 | //-------------------------------------------------------------------------------------- 34 | 35 | sampler2D implicitInputSampler : register(S0); 36 | 37 | 38 | //-------------------------------------------------------------------------------------- 39 | // Pixel Shader 40 | //-------------------------------------------------------------------------------------- 41 | 42 | float4 AdjustSaturation(float4 color, float saturation) 43 | { 44 | float grey = dot(color, float3(0.3, 0.59, 0.11)); 45 | return lerp(grey, color, saturation); 46 | } 47 | 48 | float4 main(float2 uv : TEXCOORD) : COLOR 49 | { 50 | float GloomThreshold = 0.25f; 51 | 52 | float4 base = 1.0 - tex2D(implicitInputSampler, uv); 53 | float4 gloom = saturate((base - GloomThreshold) / (1 - GloomThreshold)); 54 | 55 | 56 | // Adjust color saturation and intensity. 57 | gloom = AdjustSaturation(gloom, GloomSaturation) * GloomIntensity; 58 | base = AdjustSaturation(base, BaseSaturation) * BaseIntensity; 59 | 60 | // Darken down the base image in areas where there is a lot of bloom, 61 | // to prevent things looking excessively burned-out. 62 | base *= (1 - saturate(gloom)); 63 | 64 | // Combine the two images. 65 | return 1.0 - (base + gloom); 66 | } 67 | 68 | 69 | -------------------------------------------------------------------------------- /Shared/ShaderSource/GrowablePoissonDisk.fx: -------------------------------------------------------------------------------- 1 | // TODO: Replace ScreenSize with ddxDdy 2 | //-------------------------------------------------------------------------------------- 3 | // 4 | // WPF ShaderEffect HLSL -- GrowablePoissonDiskEffect 5 | // 6 | //-------------------------------------------------------------------------------------- 7 | 8 | //----------------------------------------------------------------------------------------- 9 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 10 | //----------------------------------------------------------------------------------------- 11 | 12 | // ParameterComment : Radius of disc 13 | // ParameterType : double 14 | // ParameterDefaultValue : 0.2 15 | // ParameterCoerce : Clamp(DiscRadius, 0.0, 1.0) 16 | float DiscRadius : register(C0); 17 | 18 | // ParameterComment : Size of screen 19 | // ParameterType : Point 20 | // ParameterDefaultValue : MakePoint(100.0, 100.0) 21 | // ParameterCoerce : Clamp(ScreenSize, MakePoint(1.0, 1.0), MakePoint(double.MaxValue, double.MaxValue)) 22 | float2 ScreenSize : register(C1); 23 | 24 | static const float2 poisson[12] = 25 | { 26 | float2(-0.326212f, -0.40581f), 27 | float2(-0.840144f, -0.07358f), 28 | float2(-0.695914f, 0.457137f), 29 | float2(-0.203345f, 0.620716f), 30 | float2(0.96234f, -0.194983f), 31 | float2(0.473434f, -0.480026f), 32 | float2(0.519456f, 0.767022f), 33 | float2(0.185461f, -0.893124f), 34 | float2(0.507431f, 0.064425f), 35 | float2(0.89642f, 0.412458f), 36 | float2(-0.32194f, -0.932615f), 37 | float2(-0.791559f, -0.59771f) 38 | }; 39 | 40 | //-------------------------------------------------------------------------------------- 41 | // Sampler Inputs (Brushes, including ImplicitInput) 42 | //-------------------------------------------------------------------------------------- 43 | 44 | sampler2D implicitInputSampler : register(S0); 45 | 46 | 47 | //-------------------------------------------------------------------------------------- 48 | // Pixel Shader 49 | //-------------------------------------------------------------------------------------- 50 | 51 | float4 main(float2 uv : TEXCOORD) : COLOR 52 | { 53 | float4 cOut; 54 | 55 | // Center tap 56 | cOut = tex2D(implicitInputSampler, uv); 57 | for(int tap = 0; tap < 12; tap++) 58 | { 59 | float2 coord= uv.xy + ((poisson[tap] / ScreenSize) * DiscRadius); 60 | // Sample pixel 61 | cOut += tex2D(implicitInputSampler, coord); 62 | } 63 | 64 | return(cOut / 13.0f); 65 | } 66 | 67 | 68 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Identity.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Identity 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | //-------------------------------------------------------------------------------------- 12 | // Sampler Inputs (Brushes, including ImplicitInput) 13 | //-------------------------------------------------------------------------------------- 14 | 15 | sampler2D implicitInputSampler : register(S0); 16 | 17 | 18 | //-------------------------------------------------------------------------------------- 19 | // Pixel Shader 20 | //-------------------------------------------------------------------------------------- 21 | 22 | float4 main(float2 uv : TEXCOORD) : COLOR 23 | { 24 | return tex2D(implicitInputSampler, uv); 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /Shared/ShaderSource/InvertColor.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- InvertColorEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //-------------------------------------------------------------------------------------- 8 | // Sampler Inputs (Brushes, including ImplicitInput) 9 | //-------------------------------------------------------------------------------------- 10 | 11 | sampler2D implicitInputSampler : register(S0); 12 | 13 | //-------------------------------------------------------------------------------------- 14 | // Pixel Shader 15 | //-------------------------------------------------------------------------------------- 16 | 17 | float4 main(float2 uv : TEXCOORD) : COLOR 18 | { 19 | float4 color = tex2D( implicitInputSampler, uv ); 20 | float4 inverted_color = 1 - color; 21 | inverted_color.a = color.a; 22 | inverted_color.rgb *= inverted_color.a; 23 | return inverted_color; 24 | } 25 | -------------------------------------------------------------------------------- /Shared/ShaderSource/LeastBrightTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | 6 | float4 LeastBright(float2 uv) 7 | { 8 | int c = 4; 9 | int c2 = 3; 10 | float oc = (c -1) / 2; 11 | float oc2 = (c2 -1) / 2; 12 | float offset = 0.01 * Progress; 13 | 14 | float leastBright = 1; 15 | float4 leastBrightColor; 16 | for(int y=0; y 1) 48 | { 49 | texuv = origUv; 50 | } 51 | else 52 | { 53 | texuv = Center + Amount * ray; 54 | } 55 | 56 | return tex2D(implicitInputSampler, texuv); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Monochrome.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- MonoChromeEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Monochrome color 12 | // ParameterType : Color 13 | // ParameterDefaultValue : MakeColor(0x7F, 0x7F, 0x7F) 14 | float4 FilterColor : register(C0); 15 | 16 | //-------------------------------------------------------------------------------------- 17 | // Sampler Inputs (Brushes, including ImplicitInput) 18 | //-------------------------------------------------------------------------------------- 19 | 20 | sampler2D implicitInputSampler : register(S0); 21 | 22 | //-------------------------------------------------------------------------------------- 23 | // Pixel Shader 24 | //-------------------------------------------------------------------------------------- 25 | 26 | float4 main(float2 uv : TEXCOORD) : COLOR 27 | { 28 | float2 texuv = uv; 29 | float4 srcColor = tex2D(implicitInputSampler, texuv); 30 | float4 luminance = srcColor.r*0.30 + srcColor.g*0.59 + srcColor.b*0.11; 31 | luminance.a = 1.0; 32 | 33 | return luminance * FilterColor; 34 | } 35 | 36 | 37 | -------------------------------------------------------------------------------- /Shared/ShaderSource/MostBrightTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | 6 | float4 MostBright(float2 uv) 7 | { 8 | int c = 4; 9 | int c2 = 3; 10 | float oc = (c -1) / 2; 11 | float oc2 = (c2 -1) / 2; 12 | float offset = 0.01 * Progress; 13 | 14 | float mostBright = 1; 15 | float4 mostBrightColor; 16 | for(int y=0; y mostBright) 24 | { 25 | mostBright = brightness; 26 | mostBrightColor = color; 27 | } 28 | } 29 | } 30 | 31 | float4 impl = tex2D(implicitInput, uv); 32 | 33 | return lerp(mostBrightColor,impl, Progress); 34 | } 35 | 36 | //-------------------------------------------------------------------------------------- 37 | // Pixel Shader 38 | //-------------------------------------------------------------------------------------- 39 | float4 main(float2 uv : TEXCOORD0) : COLOR0 40 | { 41 | return MostBright(uv); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Multiply.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Multiply 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of alpha applied on effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 1.0 14 | // ParameterCoerce : Clamp(Alpha, 0.0, 1.0) 15 | float Alpha : register(C0); 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Sampler Inputs (Brushes, including ImplicitInput) 19 | //-------------------------------------------------------------------------------------- 20 | 21 | sampler2D implicitInputSampler : register(S0); 22 | sampler2D secondInput : register(S1); 23 | 24 | float4 main(float2 uv : TEXCOORD) : COLOR 25 | { 26 | float4 firstTexel = tex2D(implicitInputSampler, uv); 27 | float4 secondTexel = tex2D(secondInput, uv); 28 | 29 | float4 result; 30 | result.a = firstTexel.a; 31 | result.rgb = ((firstTexel.a * firstTexel.rgb) * (secondTexel.a * secondTexel.rgb)) / result.a; 32 | result.rgb = lerp(firstTexel.rgb, result.rgb, Alpha); 33 | 34 | return result; 35 | } 36 | -------------------------------------------------------------------------------- /Shared/ShaderSource/NegationDifference.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Difference 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of alpha applied on effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 1.0 14 | // ParameterCoerce : Clamp(Alpha, 0.0, 1.0) 15 | float Alpha : register(C0); 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Sampler Inputs (Brushes, including ImplicitInput) 19 | //-------------------------------------------------------------------------------------- 20 | 21 | sampler2D implicitInputSampler : register(S0); 22 | sampler2D secondInput : register(S1); 23 | 24 | float4 main(float2 uv : TEXCOORD) : COLOR 25 | { 26 | float4 firstTexel = tex2D(implicitInputSampler, uv); 27 | float4 secondTexel = tex2D(secondInput, uv); 28 | 29 | float4 result; 30 | result.a = firstTexel.a; 31 | result.rgb = 1 - (firstTexel.a * firstTexel.rgb + secondTexel.a * secondTexel.rgb) / result.a; 32 | result.rgb = max(0, result.rgb); 33 | result.rgb = 1 - result.rgb; 34 | result.rgb = lerp(firstTexel.rgb, result.rgb, Alpha); 35 | 36 | return result; 37 | } 38 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Pinch.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- PinchEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Center of pinching 12 | // ParameterType : Point 13 | // ParameterDefaultValue : MakePoint(0.5,0.5) 14 | float2 Center : register(C0); 15 | 16 | // ParameterComment : Radius of pinching 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.2 19 | // ParameterCoerce : Clamp(Radius, 0.0, double.MaxValue) 20 | float Radius : register(C1); 21 | 22 | // ParameterComment : Amount of pinching 23 | // ParameterType : double 24 | // ParameterDefaultValue : 0.2 25 | // ParameterCoerce : Clamp(Amount, 0.0, double.MaxValue) 26 | float Amount : register(C2); 27 | 28 | //-------------------------------------------------------------------------------------- 29 | // Sampler Inputs (Brushes, including ImplicitInput) 30 | //-------------------------------------------------------------------------------------- 31 | 32 | sampler2D implicitInputSampler : register(S0); 33 | 34 | 35 | //-------------------------------------------------------------------------------------- 36 | // Pixel Shader 37 | //-------------------------------------------------------------------------------------- 38 | 39 | float4 main(float2 uv : TEXCOORD) : COLOR 40 | { 41 | float2 displace = Center - uv; 42 | float range = saturate(1 - (length(displace) / (abs(-sin(Radius * 8) * Radius) + 0.00000001F))); 43 | return tex2D(implicitInputSampler, uv + displace * range * Amount); 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Pixelate.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- PixelateEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : PixelCount value 12 | // ParameterType : Point 13 | // ParameterDefaultValue : MakePoint(20.0, 20.0) 14 | // ParameterCoerce : Clamp(PixelCount, MakePoint(20.0, 20.0), MakePoint(10000.0, 10000.0)) 15 | float2 PixelCount : register(C0); 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Sampler Inputs (Brushes, including ImplicitInput) 19 | //-------------------------------------------------------------------------------------- 20 | 21 | sampler2D implicitInputSampler : register(S0); 22 | 23 | 24 | //-------------------------------------------------------------------------------------- 25 | // Pixel Shader 26 | //-------------------------------------------------------------------------------------- 27 | 28 | float4 main(float2 uv : TEXCOORD) : COLOR 29 | { 30 | float2 brickSize = 1.0 / PixelCount; 31 | 32 | // Offset every other row of bricks 33 | float2 offsetuv = uv; 34 | bool oddRow = floor(offsetuv.y / brickSize.y) % 2.0 >= 1.0; 35 | if (oddRow) 36 | { 37 | offsetuv.x += brickSize.x / 2.0; 38 | } 39 | 40 | float2 brickNum = floor(offsetuv / brickSize); 41 | float2 centerOfBrick = brickNum * brickSize + brickSize / 2; 42 | float4 color = tex2D(implicitInputSampler, centerOfBrick); 43 | 44 | return color; 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /Shared/ShaderSource/PixelateInTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | 6 | 7 | float4 PixelateIn(float2 uv) 8 | { 9 | float pixels = 10 + 1000 * Progress * Progress; 10 | float2 newUV = round(uv * pixels) / pixels; 11 | float4 c2 = tex2D(implicitInput, newUV); 12 | 13 | return c2; 14 | } 15 | 16 | 17 | //-------------------------------------------------------------------------------------- 18 | // Pixel Shader 19 | //-------------------------------------------------------------------------------------- 20 | float4 main(float2 uv : TEXCOORD0) : COLOR0 21 | { 22 | return PixelateIn(uv); 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Shared/ShaderSource/PixelateOutTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | 6 | float4 PixelateOut(float2 uv) 7 | { 8 | float pixels = max(4, 100 * (1.0 - Progress)); 9 | float2 newUV = round(uv * pixels) / pixels; 10 | float4 c1 = tex2D(oldInput, newUV); 11 | float4 c2 = tex2D(implicitInput, uv); 12 | 13 | if (Progress > 0.8) 14 | { 15 | float new_Progress = (Progress - 0.8) * 5; 16 | return lerp(c1,c2, new_Progress); 17 | } 18 | else 19 | { 20 | return c1; 21 | } 22 | } 23 | 24 | //-------------------------------------------------------------------------------------- 25 | // Pixel Shader 26 | //-------------------------------------------------------------------------------------- 27 | float4 main(float2 uv : TEXCOORD0) : COLOR0 28 | { 29 | return PixelateOut(uv); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /Shared/ShaderSource/PixelateTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | float4 Pixelate(float2 uv) 6 | { 7 | float pixels; 8 | float segment_Progress; 9 | if (Progress < 0.5) 10 | { 11 | segment_Progress = 1 - Progress * 2; 12 | } 13 | else 14 | { 15 | segment_Progress = (Progress - 0.5) * 2; 16 | 17 | } 18 | 19 | pixels = 5 + 1000 * segment_Progress * segment_Progress; 20 | float2 newUV = round(uv * pixels) / pixels; 21 | 22 | float4 c1 = tex2D(oldInput, newUV); 23 | float4 c2 = tex2D(implicitInput, newUV); 24 | 25 | float lerp_Progress = saturate((Progress - 0.4) / 0.2); 26 | return lerp(c1,c2, lerp_Progress); 27 | } 28 | 29 | //-------------------------------------------------------------------------------------- 30 | // Pixel Shader 31 | //-------------------------------------------------------------------------------------- 32 | float4 main(float2 uv : TEXCOORD0) : COLOR0 33 | { 34 | return Pixelate(uv); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Shared/ShaderSource/RadialBlurTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | struct VS_OUTPUT 6 | { 7 | float4 Position : POSITION; 8 | float4 Color : COLOR0; 9 | float2 UV : TEXCOORD0; 10 | }; 11 | 12 | float4 RadialBlur(float2 uv) 13 | { 14 | float2 center = float2(0.5,0.5); 15 | float2 toUV = uv - center; 16 | float2 normToUV = toUV; 17 | 18 | 19 | float4 c1 = float4(0,0,0,0); 20 | int count = 24; 21 | float s = Progress * 0.02; 22 | 23 | for(int i=0; i 0.8) 14 | { 15 | float new_Progress = (Progress - 0.8) * 5.0; 16 | return lerp(c1,c2, new_Progress); 17 | } 18 | else 19 | { 20 | return c1; 21 | } 22 | } 23 | 24 | 25 | //-------------------------------------------------------------------------------------- 26 | // Pixel Shader 27 | //-------------------------------------------------------------------------------------- 28 | float4 main(float2 uv : TEXCOORD0) : COLOR0 29 | { 30 | return Saturate(uv); 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Sharpen.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- SharpenEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Amount of sharpness 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.4 14 | // ParameterCoerce : Clamp(Amount, -1.0, 1.0) 15 | float Amount : register(C0); 16 | 17 | // ParameterComment : Width of sharpness in pixels 18 | // ParameterType : double 19 | // ParameterDefaultValue : 2.0 20 | // ParameterCoerce : Clamp(Width, 0.0, double.MaxValue) 21 | float Width : register(C1); 22 | 23 | // ParameterDdxDdy : 24 | float4 ddx_ddy : register(C2); 25 | 26 | //-------------------------------------------------------------------------------------- 27 | // Sampler Inputs (Brushes, including ImplicitInput) 28 | //-------------------------------------------------------------------------------------- 29 | 30 | sampler2D implicitInputSampler : register(S0); 31 | 32 | 33 | //-------------------------------------------------------------------------------------- 34 | // Pixel Shader 35 | //-------------------------------------------------------------------------------------- 36 | 37 | float4 main(float2 uv : TEXCOORD) : COLOR 38 | { 39 | float2x2 rotater = 40 | { 41 | ddx_ddy.x, ddx_ddy.y, 42 | ddx_ddy.z, ddx_ddy.w, 43 | }; 44 | 45 | float2 top_left = { -1.0, -1.0 }; 46 | float2 bottom_right = { 1.0, 1.0 }; 47 | 48 | float4 color = tex2D(implicitInputSampler, uv); 49 | color.rgb += tex2D(implicitInputSampler, uv + Width * mul(top_left, rotater)) * Amount; 50 | color.rgb -= tex2D(implicitInputSampler, uv + Width * mul(bottom_right, rotater)) * Amount; 51 | return color; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /Shared/ShaderSource/ShrinkTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | 6 | float4 SampleWithBorder(float4 border, sampler2D tex, float2 uv) 7 | { 8 | if (any(saturate(uv) - uv)) 9 | { 10 | return border; 11 | } 12 | else 13 | { 14 | return tex2D(tex, uv); 15 | } 16 | } 17 | 18 | float4 Shrink(float2 uv) 19 | { 20 | float speed = 200; 21 | float2 center = float2(0.5,0.5); 22 | float2 toUV = uv - center; 23 | float distanceFromCenter = length(toUV); 24 | float2 normToUV = toUV / distanceFromCenter; 25 | 26 | float2 newUV = center + normToUV * (distanceFromCenter * (Progress * speed + 1)); 27 | 28 | float4 c1 = SampleWithBorder(float4(0,0,0,0), oldInput, newUV); 29 | 30 | if(c1.a <= 0) 31 | { 32 | return tex2D(implicitInput, uv); 33 | } 34 | 35 | return c1; 36 | 37 | } 38 | 39 | //-------------------------------------------------------------------------------------- 40 | // Pixel Shader 41 | //-------------------------------------------------------------------------------------- 42 | float4 main(float2 uv : TEXCOORD0) : COLOR0 43 | { 44 | return Shrink(uv); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Shared/ShaderSource/SlideInTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | float2 SlideAmount : register(C1); 3 | sampler2D implicitInput : register(S0); 4 | sampler2D oldInput : register(S1); 5 | 6 | struct VS_OUTPUT 7 | { 8 | float4 Position : POSITION; 9 | float4 Color : COLOR0; 10 | float2 UV : TEXCOORD0; 11 | }; 12 | 13 | float4 SlideLeft(float2 uv) 14 | { 15 | uv += SlideAmount * Progress; 16 | if(any(saturate(uv)-uv)) 17 | { 18 | uv = frac(uv); 19 | return tex2D(implicitInput, uv); 20 | } 21 | else 22 | { 23 | return tex2D(oldInput, uv); 24 | } 25 | } 26 | 27 | //-------------------------------------------------------------------------------------- 28 | // Pixel Shader 29 | //-------------------------------------------------------------------------------------- 30 | float4 main(VS_OUTPUT input) : COLOR0 31 | { 32 | return SlideLeft(input.UV); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /Shared/ShaderSource/SmoothMagnify.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- SmoothMagnifyEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Center of Magnify 12 | // ParameterType : Point 13 | // ParameterDefaultValue : MakePoint(0.5,0.5) 14 | float2 Center : register(C0); 15 | 16 | // ParameterComment : InnerRadius of Magnify 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.1 19 | // ParameterCoerce : Clamp(InnerRadius, 0.00001, double.MaxValue) 20 | float InnerRadius: register(C2); 21 | 22 | // ParameterComment : Magnification value 23 | // ParameterType : double 24 | // ParameterDefaultValue : 2.0 25 | float Magnification : register(c3); 26 | 27 | // ParameterComment : OuterRadius of Magnify 28 | // ParameterType : double 29 | // ParameterDefaultValue : 0.2 30 | // ParameterCoerce : Clamp(OuterRadius, 0.00001, double.MaxValue) 31 | float OuterRadius : register(c4); 32 | 33 | //-------------------------------------------------------------------------------------- 34 | // Sampler Inputs (Brushes, including ImplicitInput) 35 | //-------------------------------------------------------------------------------------- 36 | 37 | sampler2D implicitInputSampler : register(S0); 38 | 39 | //-------------------------------------------------------------------------------------- 40 | // Pixel Shader 41 | //-------------------------------------------------------------------------------------- 42 | 43 | float4 main(float2 uv : TEXCOORD) : COLOR 44 | { 45 | 46 | 47 | float2 Center_to_pixel = uv - Center; // vector from Center to pixel 48 | 49 | float distance = length(Center_to_pixel); 50 | 51 | float4 color; 52 | 53 | float2 sample_point; 54 | 55 | if(distance < OuterRadius) { 56 | 57 | if( distance < InnerRadius ) { 58 | sample_point = Center + (Center_to_pixel / Magnification); 59 | } 60 | else { 61 | float radius_diff = OuterRadius - InnerRadius; 62 | float ratio = (distance - InnerRadius ) / radius_diff; // 0 == inner radius, 1 == OuterRadius 63 | ratio = ratio * 3.14159; // -pi/2 .. pi/2 64 | float adjusted_ratio = cos( ratio ); // -1 .. 1 65 | adjusted_ratio = adjusted_ratio + 1; // 0 .. 2 66 | adjusted_ratio = adjusted_ratio / 2; // 0 .. 1 67 | 68 | sample_point = ( (Center + (Center_to_pixel / Magnification) ) * ( adjusted_ratio)) + ( uv * ( 1 - adjusted_ratio) ); 69 | } 70 | } 71 | else { 72 | sample_point = uv; 73 | } 74 | 75 | return tex2D( implicitInputSampler, sample_point ); 76 | 77 | } 78 | -------------------------------------------------------------------------------- /Shared/ShaderSource/SmoothSwirlGridTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | float2 TwistAmount : register(C1); 3 | sampler2D implicitInput : register(S0); 4 | sampler2D oldInput : register(S1); 5 | 6 | 7 | float4 SampleWithBorder(float4 border, sampler2D tex, float2 uv) 8 | { 9 | if (any(saturate(uv) - uv)) 10 | { 11 | return border; 12 | } 13 | else 14 | { 15 | return tex2D(tex, uv); 16 | } 17 | } 18 | 19 | float4 SmoothSwirlGrid(float2 uv) 20 | { 21 | float cellcount = 10; 22 | float cellsize = 1.0 / cellcount; 23 | 24 | float2 cell = floor(uv * cellcount); 25 | float2 oddeven = fmod(cell, 2.0); 26 | float cellTwistAmount = TwistAmount; 27 | if (oddeven.x < 1.0) 28 | { 29 | cellTwistAmount *= -1; 30 | } 31 | if (oddeven.y < 1.0) 32 | { 33 | cellTwistAmount *= -1; 34 | } 35 | 36 | float2 newUV = frac(uv * cellcount); 37 | 38 | float2 center = float2(0.5,0.5); 39 | float2 toUV = newUV - center; 40 | float distanceFromCenter = length(toUV); 41 | float2 normToUV = toUV / distanceFromCenter; 42 | float angle = atan2(normToUV.y, normToUV.x); 43 | 44 | angle += max(0, 0.5-distanceFromCenter) * cellTwistAmount * Progress; 45 | float2 newUV2; 46 | sincos(angle, newUV2.y, newUV2.x); 47 | newUV2 *= distanceFromCenter; 48 | newUV2 += center; 49 | 50 | newUV2 *= cellsize; 51 | newUV2 += cell * cellsize; 52 | 53 | float4 c1 = tex2D(oldInput, newUV2); 54 | float4 c2 = tex2D(implicitInput, uv); 55 | 56 | return lerp(c1,c2, Progress); 57 | } 58 | 59 | //-------------------------------------------------------------------------------------- 60 | // Pixel Shader 61 | //-------------------------------------------------------------------------------------- 62 | float4 main(float2 uv : TEXCOORD0) : COLOR0 63 | { 64 | return SmoothSwirlGrid(uv); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Sobel.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- Sobel 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterDdxDdy : 12 | float4 ddx_ddy : register(C2); 13 | 14 | //-------------------------------------------------------------------------------------- 15 | // Sampler Inputs (Brushes, including ImplicitInput) 16 | //-------------------------------------------------------------------------------------- 17 | 18 | sampler2D implicitInputSampler : register(S0); 19 | 20 | 21 | //-------------------------------------------------------------------------------------- 22 | // Pixel Shader 23 | //-------------------------------------------------------------------------------------- 24 | 25 | const float2 c[9] = 26 | { 27 | float2(-1.00,-1.00), 28 | float2( 0.00,-1.00), 29 | float2( 1.00,-1.00), 30 | float2(-1.00, 0.00), 31 | float2( 0.00, 0.00), 32 | float2( 1.00, 0.00), 33 | float2(-1.00, 1.00), 34 | float2( 0.00 ,1.00), 35 | float2( 1.00, 1.00), 36 | }; 37 | 38 | float4 main(float2 uv : TEXCOORD) : COLOR 39 | { 40 | const float3 rgb2lum = float3(0.30, 0.59, 0.11); 41 | 42 | float2x2 rotater = 43 | { 44 | ddx_ddy.x, ddx_ddy.y, 45 | ddx_ddy.z, ddx_ddy.w, 46 | }; 47 | 48 | float3 col[9]; 49 | 50 | int i; 51 | for (i=0; i < 9; i++) 52 | { 53 | col[i] = tex2D(implicitInputSampler, uv + mul(c[i], rotater)); 54 | } 55 | 56 | float lum[9]; 57 | for (i = 0; i < 9; i++) 58 | { 59 | lum[i] = dot(col[i].xyz, rgb2lum); 60 | } 61 | 62 | float gy = 63 | lum[0] + 2*lum[1] + lum[2] 64 | -lum[6] - 2*lum[7] - lum[8]; 65 | 66 | float gx = 67 | lum[0] + 2*lum[3] + lum[6] 68 | -lum[2] - 2*lum[5] - lum[8]; 69 | 70 | float newlum = sqrt(gx * gx + gy * gy); 71 | 72 | float4 result; 73 | result.rgb = newlum.xxx; 74 | result.a = 1.0; 75 | 76 | return result; 77 | } 78 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Swirl.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- SwirlEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Center of Swirl 12 | // ParameterType : Point 13 | // ParameterDefaultValue : MakePoint(0.5,0.5) 14 | float2 Center : register(C0); 15 | 16 | // ParameterComment : Strength of spiral in swirl effect 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.5 19 | float SpiralStrength : register(C1); 20 | 21 | // ParameterComment : AngleFrequency of spiral in swirl effect 22 | // ParameterType : Point 23 | // ParameterDefaultValue : MakePoint(2.0,2.0) 24 | // ParameterCoerce : Clamp(AngleFrequency, MakePoint(0.0,0.0), MakePoint(double.MaxValue,double.MaxValue)) 25 | float2 AngleFrequency : register(C2); 26 | 27 | //-------------------------------------------------------------------------------------- 28 | // Sampler Inputs (Brushes, including ImplicitInput) 29 | //-------------------------------------------------------------------------------------- 30 | 31 | sampler2D implicitInputSampler : register(S0); 32 | 33 | //-------------------------------------------------------------------------------------- 34 | // Pixel Shader 35 | //-------------------------------------------------------------------------------------- 36 | 37 | float4 main(float2 uv : TEXCOORD) : COLOR 38 | { 39 | float2 dir = uv - Center; 40 | float l = length(dir); 41 | float angle = atan2(dir.y, dir.x); 42 | 43 | float newAng = angle + SpiralStrength * l; 44 | float xAmt = cos(AngleFrequency.x * newAng) * l; 45 | float yAmt = sin(AngleFrequency.y * newAng) * l; 46 | 47 | float2 newCoord = Center + float2(xAmt, yAmt); 48 | 49 | return tex2D( implicitInputSampler, newCoord ); 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /Shared/ShaderSource/SwirlGridTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | float2 TwistAmount : register(C1); 3 | sampler2D implicitInput : register(S0); 4 | sampler2D oldInput : register(S1); 5 | 6 | float4 SampleWithBorder(float4 border, sampler2D tex, float2 uv) 7 | { 8 | if (any(saturate(uv) - uv)) 9 | { 10 | return border; 11 | } 12 | else 13 | { 14 | return tex2D(tex, uv); 15 | } 16 | } 17 | 18 | float4 SwirlGrid(float2 uv) 19 | { 20 | float cellcount = 10; 21 | float cellsize = 1.0 / cellcount; 22 | 23 | float2 cell = floor(uv * cellcount); 24 | float2 oddeven = fmod(cell, 2.0); 25 | float cellTwistAmount = TwistAmount; 26 | if (oddeven.x < 1.0) 27 | { 28 | cellTwistAmount *= -1; 29 | } 30 | if (oddeven.y < 1.0) 31 | { 32 | cellTwistAmount *= -1; 33 | } 34 | 35 | float2 newUV = frac(uv * cellcount); 36 | 37 | float2 center = float2(0.5,0.5); 38 | float2 toUV = newUV - center; 39 | float distanceFromCenter = length(toUV); 40 | float2 normToUV = toUV / distanceFromCenter; 41 | float angle = atan2(normToUV.y, normToUV.x); 42 | 43 | angle += distanceFromCenter * distanceFromCenter * cellTwistAmount * Progress; 44 | float2 newUV2; 45 | sincos(angle, newUV2.y, newUV2.x); 46 | newUV2 *= distanceFromCenter; 47 | newUV2 += center; 48 | 49 | newUV2 *= cellsize; 50 | newUV2 += cell * cellsize; 51 | 52 | float4 c1 = tex2D(oldInput, newUV2); 53 | float4 c2 = tex2D(implicitInput, uv); 54 | 55 | return lerp(c1,c2, Progress); 56 | } 57 | 58 | 59 | //-------------------------------------------------------------------------------------- 60 | // Pixel Shader 61 | //-------------------------------------------------------------------------------------- 62 | float4 main(float2 uv : TEXCOORD0) : COLOR0 63 | { 64 | return SwirlGrid(uv); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /Shared/ShaderSource/SwirlTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | float2 TwistAmount : register(C1); 3 | sampler2D implicitInput : register(S0); 4 | sampler2D oldInput : register(S1); 5 | 6 | 7 | float4 SampleWithBorder(float4 border, sampler2D tex, float2 uv) 8 | { 9 | if (any(saturate(uv) - uv)) 10 | { 11 | return border; 12 | } 13 | else 14 | { 15 | return tex2D(tex, uv); 16 | } 17 | } 18 | 19 | float4 Swirl(float2 uv) 20 | { 21 | float2 center = float2(0.5,0.5); 22 | float2 toUV = uv - center; 23 | float distanceFromCenter = length(toUV); 24 | float2 normToUV = toUV / distanceFromCenter; 25 | float angle = atan2(normToUV.y, normToUV.x); 26 | 27 | angle += distanceFromCenter * distanceFromCenter * TwistAmount * Progress; 28 | float2 newUV; 29 | sincos(angle, newUV.y, newUV.x); 30 | newUV *= distanceFromCenter; 31 | newUV += center; 32 | 33 | float4 c1 = SampleWithBorder(float4(0,0,0,0), oldInput, newUV); 34 | float4 c2 = tex2D(implicitInput, uv); 35 | 36 | return lerp(c1,c2, Progress); 37 | } 38 | 39 | //-------------------------------------------------------------------------------------- 40 | // Pixel Shader 41 | //-------------------------------------------------------------------------------------- 42 | float4 main(float2 uv : TEXCOORD0) : COLOR0 43 | { 44 | return Swirl(uv); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Shared/ShaderSource/ToneMapping.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- ToneMappingEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //----------------------------------------------------------------------------------------- 8 | // Shader constant register mappings (scalars - float, double, Point, Color, Point3D, etc.) 9 | //----------------------------------------------------------------------------------------- 10 | 11 | // ParameterComment : Exposure value of tone mapping effect 12 | // ParameterType : double 13 | // ParameterDefaultValue : 0.2 14 | float Exposure : register(C0); 15 | 16 | // ParameterComment : Defog value of tone mapping effect 17 | // ParameterType : double 18 | // ParameterDefaultValue : 0.2 19 | float Defog : register(C1); 20 | 21 | // ParameterComment : Gamma value of tone mapping effect 22 | // ParameterType : double 23 | // ParameterDefaultValue : 0.1 24 | float Gamma : register(C2); 25 | 26 | // ParameterComment : FogColor value of tone mapping effect 27 | // ParameterType : Color 28 | // ParameterDefaultValue : MakeColor(0xAF, 0xAF, 0xAF) 29 | float4 FogColor : register(C3); 30 | 31 | // ParameterComment : VignetteRadius value of tone mapping effect 32 | // ParameterType : double 33 | // ParameterDefaultValue : 0.1 34 | // ParameterCoerce : Clamp(VignetteRadius, 0.0, double.MaxValue) 35 | float VignetteRadius : register(C4); 36 | 37 | // ParameterComment : VignetteCenter value of tone mapping effect 38 | // ParameterType : Point 39 | // ParameterDefaultValue : MakePoint(0.5,0.5) 40 | float2 VignetteCenter : register(C5); 41 | 42 | // ParameterComment : BlueShift value of tone mapping effect 43 | // ParameterType : double 44 | // ParameterDefaultValue : 0.1 45 | // ParameterCoerce : Clamp(BlueShift, 0.0, 1.0) 46 | float BlueShift : register(C6); 47 | 48 | //-------------------------------------------------------------------------------------- 49 | // Sampler Inputs (Brushes, including ImplicitInput) 50 | //-------------------------------------------------------------------------------------- 51 | 52 | sampler2D implicitInputSampler : register(S0); 53 | 54 | 55 | //-------------------------------------------------------------------------------------- 56 | // Pixel Shader 57 | //-------------------------------------------------------------------------------------- 58 | 59 | float4 main(float2 uv : TEXCOORD) : COLOR 60 | { 61 | float4 c = tex2D(implicitInputSampler, uv); 62 | c.rgb = max(0, c.rgb - Defog * FogColor.rgb); 63 | c.rgb *= pow(2.0f, Exposure); 64 | c.rgb = pow(c.rgb, Gamma); 65 | 66 | float2 tc = uv - VignetteCenter; 67 | float v = 1.0f - dot(tc, tc); 68 | c.rgb += pow(v, 4) * VignetteRadius; 69 | 70 | float3 d = c.rgb * float3(1.05f, 0.97f, 1.27f); 71 | c.rgb = lerp(c.rgb, d, BlueShift); 72 | 73 | return c; 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /Shared/ShaderSource/Toon.fx: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // 3 | // WPF ShaderEffect HLSL -- ToonEffect 4 | // 5 | //-------------------------------------------------------------------------------------- 6 | 7 | //-------------------------------------------------------------------------------------- 8 | // Sampler Inputs (Brushes, including ImplicitInput) 9 | //-------------------------------------------------------------------------------------- 10 | 11 | sampler2D implicitInputSampler : register(S0); 12 | 13 | //-------------------------------------------------------------------------------------- 14 | // Pixel Shader 15 | //-------------------------------------------------------------------------------------- 16 | 17 | float4 main(float2 uv : TEXCOORD) : COLOR 18 | { 19 | float4 color = tex2D( implicitInputSampler, uv ); 20 | 21 | color *= 3; 22 | color = floor(color); 23 | color /= 3; 24 | 25 | return color; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Shared/ShaderSource/WaterTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | float RandomSeed : register(C1); 3 | sampler2D implicitInput : register(S0); 4 | sampler2D oldInput : register(S1); 5 | sampler2D cloudInput : register(s2); 6 | 7 | struct VS_OUTPUT 8 | { 9 | float4 Position : POSITION; 10 | float4 Color : COLOR0; 11 | float2 UV : TEXCOORD0; 12 | }; 13 | 14 | float4 Water(float2 uv) 15 | { 16 | float2 offset = tex2D(cloudInput, float2(uv.x / 10, frac(uv.y /10 + min(0.9, RandomSeed)))).xy * 2.0 - 1.0; 17 | float4 c1 = tex2D(oldInput, frac(uv + offset * Progress)); 18 | float4 c2 = tex2D(implicitInput, uv); 19 | 20 | if (c1.a <= 0.0) 21 | return c2; 22 | else 23 | return lerp(c1, c2, Progress); 24 | } 25 | 26 | //-------------------------------------------------------------------------------------- 27 | // Pixel Shader 28 | //-------------------------------------------------------------------------------------- 29 | float4 main(VS_OUTPUT input) : COLOR0 30 | { 31 | return Water(input.UV); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Shared/ShaderSource/WaveTransition.fx: -------------------------------------------------------------------------------- 1 | float Progress : register(C0); 2 | sampler2D implicitInput : register(S0); 3 | sampler2D oldInput : register(S1); 4 | 5 | float4 SampleWithBorder(float4 border, sampler2D tex, float2 uv) 6 | { 7 | if (any(saturate(uv) - uv)) 8 | { 9 | return border; 10 | } 11 | else 12 | { 13 | return tex2D(tex, uv); 14 | } 15 | } 16 | 17 | float4 Wave(float2 uv) 18 | { 19 | float mag = 0.1; 20 | float phase = 14; 21 | float freq = 20; 22 | 23 | float2 newUV = uv + float2(mag * Progress * sin(freq * uv.y + phase * Progress), 0); 24 | 25 | float4 c1 = SampleWithBorder(0, oldInput, newUV); 26 | float4 c2 = tex2D(implicitInput, uv); 27 | 28 | return lerp(c1,c2, Progress); 29 | } 30 | 31 | float4 StandingWave(float2 uv) 32 | { 33 | float pi = 3.141592; 34 | float mag = 0.01; 35 | float freq = 8 * pi; 36 | float freq2 = 6 * pi; 37 | 38 | float2 newUV = uv + mag * sin(Progress*freq2) * float2(cos(freq * uv.x), sin(freq * uv.y)); 39 | 40 | float4 c1 = tex2D(oldInput, frac(newUV)); 41 | float4 c2 = tex2D(implicitInput, uv); 42 | 43 | return lerp(c1,c2, Progress); 44 | } 45 | 46 | float4 MotionBlur(float2 uv) 47 | { 48 | float4 c1 = 0; 49 | int count = 26; 50 | float2 direction = float2(0.05, 0.05); 51 | float2 offset = Progress * direction; 52 | float2 startUV = uv - offset * 0.5; 53 | float2 delta = offset / (count-1); 54 | 55 | for(int i=0; i() 25 | { 26 | var pixelShader = 27 | new PixelShader 28 | { 29 | UriSource = GetShaderUri(), 30 | }; 31 | return pixelShader; 32 | } 33 | 34 | public static Uri GetShaderUri() 35 | { 36 | var type = typeof(T); 37 | var fullName = type.Name; 38 | var name = fullName.Substring(0, fullName.Length - "ShaderEffect".Length); 39 | 40 | return MakePackUri(string.Format(@"{0}.fx.ps", name)); 41 | } 42 | 43 | public static Uri MakePackUri(string relativeFile) 44 | { 45 | var assembly = typeof (Utility).Assembly; 46 | 47 | // Extract the short name. 48 | var assemblyShortName = assembly.ToString().Split(',')[0]; 49 | 50 | var uriString = 51 | string.Format( 52 | @"/{0};component/ShaderBinary/{1}", 53 | assemblyShortName, 54 | relativeFile); 55 | 56 | return new Uri(uriString, UriKind.RelativeOrAbsolute); 57 | } 58 | 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SilverlightShaderEffects/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System.Reflection; 17 | using System.Runtime.InteropServices; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("SilverlightShaderEffects")] 23 | [assembly: AssemblyDescription("")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("")] 26 | [assembly: AssemblyProduct("SilverlightShaderEffects")] 27 | [assembly: AssemblyCopyright("Copyright © Mårten Rånge 2009")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Setting ComVisible to false makes the types in this assembly not visible 32 | // to COM components. If you need to access a type in this assembly from 33 | // COM, set the ComVisible attribute to true on that type. 34 | [assembly: ComVisible(false)] 35 | 36 | // The following GUID is for the ID of the typelib if this project is exposed to COM 37 | [assembly: Guid("4daa66fc-e741-4388-bff0-21ce6161f2eb")] 38 | 39 | // Version information for an assembly consists of the following four values: 40 | // 41 | // Major Version 42 | // Minor Version 43 | // Build Number 44 | // Revision 45 | // 46 | // You can specify all the values or you can default the Revision and Build Numbers 47 | // by using the '*' as shown below: 48 | [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyFileVersion("1.0.*")] 50 | -------------------------------------------------------------------------------- /SilverlightTestApplication/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SilverlightTestApplication/App.xaml.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System; 17 | using System.Windows; 18 | using System.Windows.Browser; 19 | 20 | namespace SilverlightTestApplication 21 | { 22 | public partial class App 23 | { 24 | 25 | public App() 26 | { 27 | Startup += ApplicationStartup; 28 | Exit += ApplicationExit; 29 | UnhandledException += ApplicationUnhandledException; 30 | 31 | InitializeComponent(); 32 | } 33 | 34 | private void ApplicationStartup(object sender, StartupEventArgs e) 35 | { 36 | RootVisual = new MainPage(); 37 | } 38 | 39 | private static void ApplicationExit(object sender, EventArgs e) 40 | { 41 | 42 | } 43 | private static void ApplicationUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) 44 | { 45 | // If the app is running outside of the debugger then report the exception using 46 | // the browser's exception mechanism. On IE this will display it a yellow alert 47 | // icon in the status bar and Firefox will display a script error. 48 | if (!System.Diagnostics.Debugger.IsAttached) 49 | { 50 | 51 | // NOTE: This will allow the application to continue running after an exception has been thrown 52 | // but not handled. 53 | // For production applications this error handling should be replaced with something that will 54 | // report the error to the website and stop the application. 55 | e.Handled = true; 56 | Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); 57 | } 58 | } 59 | private static void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) 60 | { 61 | try 62 | { 63 | var errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; 64 | errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); 65 | 66 | HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); 67 | } 68 | catch (Exception) 69 | { 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SilverlightTestApplication/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Normal 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Invert 46 | 47 | 48 | 49 | 50 | 55 | 56 | 57 | 58 | Ripple 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Transition 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /SilverlightTestApplication/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | namespace SilverlightTestApplication 17 | { 18 | public partial class MainPage 19 | { 20 | public MainPage() 21 | { 22 | InitializeComponent(); 23 | RippleStoryBoard.Begin(); 24 | TransitionStoryBoard.Begin(); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SilverlightTestApplication/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SilverlightTestApplication/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System.Reflection; 17 | using System.Runtime.InteropServices; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("SilverlightTestApplication")] 23 | [assembly: AssemblyDescription("")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("")] 26 | [assembly: AssemblyProduct("SilverlightTestApplication")] 27 | [assembly: AssemblyCopyright("Copyright © Mårten Rånge 2009")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Setting ComVisible to false makes the types in this assembly not visible 32 | // to COM components. If you need to access a type in this assembly from 33 | // COM, set the ComVisible attribute to true on that type. 34 | [assembly: ComVisible(false)] 35 | 36 | // The following GUID is for the ID of the typelib if this project is exposed to COM 37 | [assembly: Guid("b3362771-6d48-4b7e-9313-e90afb909e92")] 38 | 39 | // Version information for an assembly consists of the following four values: 40 | // 41 | // Major Version 42 | // Minor Version 43 | // Build Number 44 | // Revision 45 | // 46 | // You can specify all the values or you can default the Revision and Build Numbers 47 | // by using the '*' as shown below: 48 | [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyFileVersion("1.0.*")] 50 | -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/CompiledEffect.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/CompiledEffect.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/CompiledShader.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/CompiledShader.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/CompilerOptions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/CompilerOptions.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/ConstantInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/ConstantInfo.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/D3DXUtil.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/D3DXUtil.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/EffectCompiler.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System; 17 | using WpfShaderEffects.DirectX.Interop; 18 | 19 | namespace WpfShaderEffects.DirectX 20 | { 21 | public class EffectCompiler : IDisposable 22 | { 23 | readonly UnmanagedLibrary m_dx9Handle = D3DXUtil.LoadDirectX9(); 24 | 25 | public byte[] CompilePixelShader( 26 | string source) 27 | { 28 | var effect = CompiledEffect.FromString( 29 | m_dx9Handle, 30 | source, 31 | CompilerOptions.None); 32 | 33 | if (effect.CompileSucceeded) 34 | { 35 | var shader = effect.CompileShader( 36 | "main", 37 | "ps_3_0", 38 | CompilerOptions.None); 39 | 40 | if (shader.CompileSucceeded) 41 | { 42 | return shader.Data; 43 | } 44 | else 45 | { 46 | throw new ArgumentException( 47 | "COMPILE FAILED " + shader.ErrorMessage); 48 | } 49 | } 50 | else 51 | { 52 | throw new ArgumentException("PARSE FAILED " + effect.ErrorMessage); 53 | } 54 | 55 | } 56 | 57 | public void Dispose() 58 | { 59 | m_dx9Handle.Dispose(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXCONSTANTTABLE_DESC.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXCONSTANTTABLE_DESC.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXCONSTANT_DESC.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXCONSTANT_DESC.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXEFFECT_DESC.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXEFFECT_DESC.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXFUNCTION_DESC.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXFUNCTION_DESC.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXMACRO.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXMACRO.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXMatrix16.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXMatrix16.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXPARAMETER_CLASS.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXPARAMETER_CLASS.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXPARAMETER_DESC.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXPARAMETER_DESC.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXPARAMETER_TYPE.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXPARAMETER_TYPE.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXPASS_DESC.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXPASS_DESC.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXREGISTER_SET.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXREGISTER_SET.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXSHADER.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXSHADER.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXTECHNIQUE_DESC.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXTECHNIQUE_DESC.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DXVector4.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DXVector4.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/D3DX_PARAMETER.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/D3DX_PARAMETER.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/ID3DXBuffer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/ID3DXBuffer.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/ID3DXConstantTable.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/ID3DXConstantTable.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/ID3DXEffectCompiler.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/ID3DXEffectCompiler.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/IDirect3DPixelShader9.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/IDirect3DPixelShader9.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Interop/IDirect3DVertexShader9.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/Interop/IDirect3DVertexShader9.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/NativeMethods.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/NativeMethods.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/ParameterClass.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/ParameterClass.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/ParameterFlags.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/ParameterFlags.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/ParameterInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/ParameterInfo.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/ParameterType.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/ParameterType.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System.Reflection; 17 | using System.Runtime.InteropServices; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("WpfShaderEffects.DirectX")] 23 | [assembly: AssemblyDescription("A tool to compile pixel shaders")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("")] 26 | [assembly: AssemblyProduct("WpfShaderEffects.DirectX")] 27 | [assembly: AssemblyCopyright("Copyright © Mårten Rånge 2009")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Setting ComVisible to false makes the types in this assembly not visible 32 | // to COM components. If you need to access a type in this assembly from 33 | // COM, set the ComVisible attribute to true on that type. 34 | [assembly: ComVisible(false)] 35 | 36 | // The following GUID is for the ID of the typelib if this project is exposed to COM 37 | [assembly: Guid("4ae53d39-623d-4f5b-92cd-bb5cb33cadb0")] 38 | 39 | // Version information for an assembly consists of the following four values: 40 | // 41 | // Major Version 42 | // Minor Version 43 | // Build Number 44 | // Revision 45 | // 46 | // You can specify all the values or you can default the Build and Revision Numbers 47 | // by using the '*' as shown below: 48 | // [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyVersion("1.0.*")] 50 | [assembly: AssemblyFileVersion("1.0.*")] 51 | -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/RegisterSet.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/RegisterSet.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/SafeLibraryHandle.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/SafeLibraryHandle.cs -------------------------------------------------------------------------------- /WpfShaderEffects.DirectX/UnmanagedLibrary.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/WpfShaderEffects.DirectX/UnmanagedLibrary.cs -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/DependencyProperties.tt: -------------------------------------------------------------------------------- 1 | <# 2 | var namespaceName = "WpfShaderEffects.Experimental"; 3 | var model = new DependencyObjectClass[] 4 | { 5 | // ---------------------------------------------------------------------------- 6 | // BEGIN_MODEL 7 | // ---------------------------------------------------------------------------- 8 | new DependencyObjectClass 9 | { 10 | Name = "EffectStacker", 11 | Properties = new DependencyObjectProperty[] 12 | { 13 | Property("Effects", "System.Collections.ObjectModel.ObservableCollection" , "null" , DependencyObjectPropertyFlags.None), 14 | }, 15 | }, 16 | new DependencyObjectClass 17 | { 18 | Name = "EffectRepeater", 19 | Properties = new DependencyObjectProperty[] 20 | { 21 | Property("BeforeContentEffects" , "System.Collections.ObjectModel.ObservableCollection" , "null" , DependencyObjectPropertyFlags.None), 22 | Property("AfterContentEffects" , "System.Collections.ObjectModel.ObservableCollection" , "null" , DependencyObjectPropertyFlags.None), 23 | Property("ContentVisibility" , "System.Windows.Visibility" , "System.Windows.Visibility.Visible" , DependencyObjectPropertyFlags.None), 24 | }, 25 | }, 26 | // ---------------------------------------------------------------------------- 27 | // END_MODEL 28 | // ---------------------------------------------------------------------------- 29 | }; 30 | #> 31 | 32 | <#@ include file="..\Shared\DependencyProperties.ttinclude" #> 33 | -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/EffectRepeater.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | using System.Collections.ObjectModel; 16 | using System.Windows; 17 | using System.Windows.Controls; 18 | using System.Windows.Media.Effects; 19 | using System.Windows.Shapes; 20 | 21 | namespace WpfShaderEffects.Experimental 22 | { 23 | [TemplatePart(Name = "PART_Content", Type = typeof(ContentPresenter))] 24 | public partial class EffectRepeater : ContentControl 25 | { 26 | static EffectRepeater() 27 | { 28 | DefaultStyleKeyProperty.OverrideMetadata( 29 | typeof(EffectRepeater), 30 | new FrameworkPropertyMetadata(typeof(EffectRepeater))); 31 | } 32 | 33 | partial void OnBeforeContentEffectsCoerceValue(ObservableCollection baseValue, ref ObservableCollection newValue, ref bool isProcessed) 34 | { 35 | if (baseValue == null) 36 | { 37 | newValue = new ObservableCollection(); 38 | isProcessed = true; 39 | } 40 | } 41 | 42 | partial void OnAfterContentEffectsCoerceValue(ObservableCollection baseValue, ref ObservableCollection newValue, ref bool isProcessed) 43 | { 44 | if (baseValue == null) 45 | { 46 | newValue = new ObservableCollection(); 47 | isProcessed = true; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/EffectStacker.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | using System.Collections.ObjectModel; 16 | using System.Linq; 17 | using System.Windows; 18 | using System.Windows.Controls; 19 | using System.Windows.Media.Effects; 20 | 21 | namespace WpfShaderEffects.Experimental 22 | { 23 | [TemplatePart(Name = "PART_Root", Type = typeof(ContentControl))] 24 | [TemplatePart(Name = "PART_Content", Type = typeof(ContentPresenter))] 25 | public partial class EffectStacker : ContentControl 26 | { 27 | static EffectStacker() 28 | { 29 | DefaultStyleKeyProperty.OverrideMetadata( 30 | typeof(EffectStacker), 31 | new FrameworkPropertyMetadata(typeof(EffectStacker))); 32 | } 33 | 34 | ContentPresenter m_contentPresenter; 35 | ContentControl m_root; 36 | 37 | partial void OnEffectsCoerceValue(ObservableCollection baseValue, ref ObservableCollection newValue, ref bool isProcessed) 38 | { 39 | if(baseValue == null) 40 | { 41 | newValue = new ObservableCollection(); 42 | isProcessed = true; 43 | } 44 | } 45 | 46 | partial void OnEffectsPropertyChanged(ObservableCollection oldValue, ObservableCollection newValue, ref bool isProcessed) 47 | { 48 | if (oldValue != null) 49 | { 50 | oldValue.CollectionChanged -= OnCollectionChanged; 51 | } 52 | if (oldValue != null) 53 | { 54 | newValue.CollectionChanged += OnCollectionChanged; 55 | } 56 | RebuildEffectTree(); 57 | } 58 | 59 | void OnCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) 60 | { 61 | RebuildEffectTree(); 62 | } 63 | 64 | public override void OnApplyTemplate() 65 | { 66 | base.OnApplyTemplate(); 67 | m_root = (ContentControl)GetTemplateChild("PART_Root"); ; 68 | m_contentPresenter = (ContentPresenter)GetTemplateChild("PART_Content"); 69 | 70 | RebuildEffectTree(); 71 | } 72 | 73 | void RebuildEffectTree() 74 | { 75 | if (m_root != null && m_contentPresenter != null) 76 | { 77 | var effects = Effects ?? new ObservableCollection(); 78 | 79 | m_root.Content = null; 80 | 81 | var root = effects 82 | .Select(effect => 83 | new ContentControl 84 | { 85 | Effect = effect, 86 | }) 87 | .Aggregate( 88 | (FrameworkElement) m_contentPresenter, 89 | (seed, contentControl) => 90 | { 91 | contentControl.Content = seed; 92 | return contentControl; 93 | } 94 | ); 95 | 96 | m_root.Content = root; 97 | } 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | using System.Reflection; 16 | using System.Runtime.InteropServices; 17 | using System.Windows; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("WpfShaderEffects.Experimental")] 23 | [assembly: AssemblyDescription("Experimental classes for WpfShaderEffects")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("")] 26 | [assembly: AssemblyProduct("WpfShaderEffects.Experimental")] 27 | [assembly: AssemblyCopyright("Copyright © Mårten Rånge 2009")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Setting ComVisible to false makes the types in this assembly not visible 32 | // to COM components. If you need to access a type in this assembly from 33 | // COM, set the ComVisible attribute to true on that type. 34 | [assembly: ComVisible(false)] 35 | 36 | //In order to begin building localizable applications, set 37 | //CultureYouAreCodingWith in your .csproj file 38 | //inside a . For example, if you are using US english 39 | //in your source files, set the to en-US. Then uncomment 40 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 41 | //the line below to match the UICulture setting in the project file. 42 | 43 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 44 | 45 | 46 | [assembly: ThemeInfo( 47 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 48 | //(used if a resource is not found in the page, 49 | // or application resource dictionaries) 50 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 51 | //(used if a resource is not found in the page, 52 | // app, or any theme specific resource dictionaries) 53 | )] 54 | 55 | 56 | // Version information for an assembly consists of the following four values: 57 | // 58 | // Major Version 59 | // Minor Version 60 | // Build Number 61 | // Revision 62 | // 63 | // You can specify all the values or you can default the Build and Revision Numbers 64 | // by using the '*' as shown below: 65 | // [assembly: AssemblyVersion("1.0.*")] 66 | [assembly: AssemblyVersion("1.0.*")] 67 | [assembly: AssemblyFileVersion("1.0.*")] 68 | -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfShaderEffects.Experimental.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfShaderEffects.Experimental.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfShaderEffects.Experimental.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /WpfShaderEffects.Experimental/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 65 | 66 | 86 | 87 | -------------------------------------------------------------------------------- /WpfShaderEffects.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "0. License", "0. License", "{CA451B2B-A8EA-451F-ACE4-C42C406DA957}" 5 | ProjectSection(SolutionItems) = preProject 6 | license.html = license.html 7 | EndProjectSection 8 | EndProject 9 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1. Wpf", "1. Wpf", "{80FBDC7D-70FF-461B-BEF1-2CAD410DC7C4}" 10 | ProjectSection(SolutionItems) = preProject 11 | Shared\DependencyProperties.ttinclude = Shared\DependencyProperties.ttinclude 12 | EndProjectSection 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "9. DirectX", "9. DirectX", "{E10D38D3-B560-4352-A877-3BAFF031405E}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.1. Experimental", "1.1. Experimental", "{703A9FC3-29AE-451A-BCD1-84EEDFAAF554}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfShaderEffects", "WpfShaderEffects\WpfShaderEffects.csproj", "{B8703764-3BE4-426E-8689-BD7D865D9D4B}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032} = {4BC3EDCD-5870-425D-8CA4-3D9458E17032} 21 | EndProjectSection 22 | EndProject 23 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfTestApplication", "WpfTestApplication\WpfTestApplication.csproj", "{01A2E15F-A0A8-4977-A17C-EC61D769192C}" 24 | EndProject 25 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfShaderEffects.DirectX", "WpfShaderEffects.DirectX\WpfShaderEffects.DirectX.csproj", "{4BC3EDCD-5870-425D-8CA4-3D9458E17032}" 26 | EndProject 27 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfShaderEffects.Experimental", "WpfShaderEffects.Experimental\WpfShaderEffects.Experimental.csproj", "{7688C36A-EBF4-48F9-96B1-83F69287D472}" 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|Any CPU = Debug|Any CPU 32 | Release (Signed)|Any CPU = Release (Signed)|Any CPU 33 | Release|Any CPU = Release|Any CPU 34 | EndGlobalSection 35 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 36 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release (Signed)|Any CPU.ActiveCfg = Release (Signed)|Any CPU 39 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release (Signed)|Any CPU.Build.0 = Release (Signed)|Any CPU 40 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {B8703764-3BE4-426E-8689-BD7D865D9D4B}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {01A2E15F-A0A8-4977-A17C-EC61D769192C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 43 | {01A2E15F-A0A8-4977-A17C-EC61D769192C}.Debug|Any CPU.Build.0 = Debug|Any CPU 44 | {01A2E15F-A0A8-4977-A17C-EC61D769192C}.Release (Signed)|Any CPU.ActiveCfg = Release (Signed)|Any CPU 45 | {01A2E15F-A0A8-4977-A17C-EC61D769192C}.Release (Signed)|Any CPU.Build.0 = Release (Signed)|Any CPU 46 | {01A2E15F-A0A8-4977-A17C-EC61D769192C}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {01A2E15F-A0A8-4977-A17C-EC61D769192C}.Release|Any CPU.Build.0 = Release|Any CPU 48 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032}.Release (Signed)|Any CPU.ActiveCfg = Release (Signed)|Any CPU 51 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032}.Release (Signed)|Any CPU.Build.0 = Release (Signed)|Any CPU 52 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {7688C36A-EBF4-48F9-96B1-83F69287D472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 55 | {7688C36A-EBF4-48F9-96B1-83F69287D472}.Debug|Any CPU.Build.0 = Debug|Any CPU 56 | {7688C36A-EBF4-48F9-96B1-83F69287D472}.Release (Signed)|Any CPU.ActiveCfg = Release (Signed)|Any CPU 57 | {7688C36A-EBF4-48F9-96B1-83F69287D472}.Release (Signed)|Any CPU.Build.0 = Release (Signed)|Any CPU 58 | {7688C36A-EBF4-48F9-96B1-83F69287D472}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {7688C36A-EBF4-48F9-96B1-83F69287D472}.Release|Any CPU.Build.0 = Release|Any CPU 60 | EndGlobalSection 61 | GlobalSection(SolutionProperties) = preSolution 62 | HideSolutionNode = FALSE 63 | EndGlobalSection 64 | GlobalSection(NestedProjects) = preSolution 65 | {703A9FC3-29AE-451A-BCD1-84EEDFAAF554} = {80FBDC7D-70FF-461B-BEF1-2CAD410DC7C4} 66 | {B8703764-3BE4-426E-8689-BD7D865D9D4B} = {80FBDC7D-70FF-461B-BEF1-2CAD410DC7C4} 67 | {01A2E15F-A0A8-4977-A17C-EC61D769192C} = {80FBDC7D-70FF-461B-BEF1-2CAD410DC7C4} 68 | {4BC3EDCD-5870-425D-8CA4-3D9458E17032} = {E10D38D3-B560-4352-A877-3BAFF031405E} 69 | {7688C36A-EBF4-48F9-96B1-83F69287D472} = {703A9FC3-29AE-451A-BCD1-84EEDFAAF554} 70 | EndGlobalSection 71 | EndGlobal 72 | -------------------------------------------------------------------------------- /WpfShaderEffects/Common/Utility.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System; 17 | using System.Windows.Media.Effects; 18 | 19 | namespace WpfShaderEffects.Common 20 | { 21 | static class Utility 22 | { 23 | public static PixelShader CreatePixelShader() 24 | { 25 | var pixelShader = 26 | new PixelShader 27 | { 28 | UriSource = GetShaderUri(), 29 | }; 30 | return pixelShader; 31 | } 32 | 33 | public static Uri GetShaderUri() 34 | { 35 | var type = typeof(T); 36 | var fullName = type.Name; 37 | var name = fullName.Substring(0, fullName.Length - "ShaderEffect".Length); 38 | 39 | return MakePackUri(string.Format(@"{0}.fx.ps", name)); 40 | } 41 | 42 | public static Uri MakePackUri(string relativeFile) 43 | { 44 | var assembly = typeof (Utility).Assembly; 45 | 46 | // Extract the short name. 47 | var assemblyShortName = assembly.ToString().Split(',')[0]; 48 | 49 | var uriString = 50 | string.Format( 51 | @"pack://application:,,,/{0};component/ShaderBinary/{1}", 52 | assemblyShortName, 53 | relativeFile); 54 | 55 | return new Uri(uriString); 56 | } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /WpfShaderEffects/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System.Reflection; 17 | using System.Runtime.InteropServices; 18 | using System.Windows; 19 | 20 | // General Information about an assembly is controlled through the following 21 | // set of attributes. Change these attribute values to modify the information 22 | // associated with an assembly. 23 | [assembly: AssemblyTitle("WpfShaderEffects")] 24 | [assembly: AssemblyDescription("ShaderEffects for WPF")] 25 | [assembly: AssemblyConfiguration("")] 26 | [assembly: AssemblyCompany("")] 27 | [assembly: AssemblyProduct("WpfShaderEffects")] 28 | [assembly: AssemblyCopyright("Copyright © Mårten Rånge 2009")] 29 | [assembly: AssemblyTrademark("")] 30 | [assembly: AssemblyCulture("")] 31 | 32 | // Setting ComVisible to false makes the types in this assembly not visible 33 | // to COM components. If you need to access a type in this assembly from 34 | // COM, set the ComVisible attribute to true on that type. 35 | [assembly: ComVisible(false)] 36 | 37 | // The following GUID is for the ID of the typelib if this project is exposed to COM 38 | [assembly: Guid("34c886c3-eced-4d51-808b-fe5294f60d11")] 39 | 40 | [assembly: ThemeInfo( 41 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 42 | //(used if a resource is not found in the page, 43 | // or application resource dictionaries) 44 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 45 | //(used if a resource is not found in the page, 46 | // app, or any theme specific resource dictionaries) 47 | )] 48 | 49 | // Version information for an assembly consists of the following four values: 50 | // 51 | // Major Version 52 | // Minor Version 53 | // Build Number 54 | // Revision 55 | // 56 | // You can specify all the values or you can default the Build and Revision Numbers 57 | // by using the '*' as shown below: 58 | // [assembly: AssemblyVersion("1.0.*")] 59 | [assembly: AssemblyVersion("1.0.*")] 60 | [assembly: AssemblyFileVersion("1.0.*")] 61 | -------------------------------------------------------------------------------- /WpfShaderEffects/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 36 | 37 | -------------------------------------------------------------------------------- /WpfTestApplication/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /WpfTestApplication/App.xaml.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | namespace WpfTestApplication 17 | { 18 | /// 19 | /// Interaction logic for App.xaml 20 | /// 21 | public partial class App 22 | { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /WpfTestApplication/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Normal 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Invert 50 | 51 | 52 | 53 | 54 | 59 | 60 | 61 | 62 | Ripple 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Transition 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /WpfTestApplication/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | namespace WpfTestApplication 17 | { 18 | /// 19 | /// Interaction logic for MainWindow.xaml 20 | /// 21 | public partial class MainWindow 22 | { 23 | public MainWindow() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /WpfTestApplication/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* **************************************************************************** 2 | * 3 | * Copyright (c) Mårten Rånge. 4 | * 5 | * This source code is subject to terms and conditions of the Microsoft Public License. A 6 | * copy of the license can be found in the License.html file at the root of this distribution. If 7 | * you cannot locate the Microsoft Public License, please send an email to 8 | * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 9 | * by the terms of the Microsoft Public License. 10 | * 11 | * You must not remove this notice, or any other, from this software. 12 | * 13 | * 14 | * ***************************************************************************/ 15 | 16 | using System.Reflection; 17 | using System.Runtime.InteropServices; 18 | using System.Windows; 19 | 20 | // General Information about an assembly is controlled through the following 21 | // set of attributes. Change these attribute values to modify the information 22 | // associated with an assembly. 23 | [assembly: AssemblyTitle("WpfTestApplication")] 24 | [assembly: AssemblyDescription("A test application for WpfShaderEffects")] 25 | [assembly: AssemblyConfiguration("")] 26 | [assembly: AssemblyCompany("")] 27 | [assembly: AssemblyProduct("WpfTestApplication")] 28 | [assembly: AssemblyCopyright("Copyright © Mårten Rånge 2009")] 29 | [assembly: AssemblyTrademark("")] 30 | [assembly: AssemblyCulture("")] 31 | 32 | // Setting ComVisible to false makes the types in this assembly not visible 33 | // to COM components. If you need to access a type in this assembly from 34 | // COM, set the ComVisible attribute to true on that type. 35 | [assembly: ComVisible(false)] 36 | 37 | //In order to begin building localizable applications, set 38 | //CultureYouAreCodingWith in your .csproj file 39 | //inside a . For example, if you are using US english 40 | //in your source files, set the to en-US. Then uncomment 41 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 42 | //the line below to match the UICulture setting in the project file. 43 | 44 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 45 | 46 | 47 | [assembly: ThemeInfo( 48 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 49 | //(used if a resource is not found in the page, 50 | // or application resource dictionaries) 51 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 52 | //(used if a resource is not found in the page, 53 | // app, or any theme specific resource dictionaries) 54 | )] 55 | 56 | 57 | // Version information for an assembly consists of the following four values: 58 | // 59 | // Major Version 60 | // Minor Version 61 | // Build Number 62 | // Revision 63 | // 64 | // You can specify all the values or you can default the Build and Revision Numbers 65 | // by using the '*' as shown below: 66 | // [assembly: AssemblyVersion("1.0.*")] 67 | [assembly: AssemblyVersion("1.0.*")] 68 | [assembly: AssemblyFileVersion("1.0.*")] 69 | -------------------------------------------------------------------------------- /WpfTestApplication/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfTestApplication.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfTestApplication.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /WpfTestApplication/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfTestApplication.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /WpfTestApplication/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /WpfTestApplication/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /license.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | 10 | 11 | 75 | 76 |
12 |

13 | Microsoft Public License (Ms-PL) 14 |

15 |

16 | This license governs use of the accompanying software. If you use the software, 17 | you accept this license. If you do not accept the license, do not use the software.

18 |

19 | 1. Definitions 20 |

21 |

22 | The terms "reproduce," "reproduction," "derivative works," 23 | and "distribution" have the same meaning here as under U.S. copyright 24 | law. A "contribution" is the original software, or any additions or changes 25 | to the software. A "contributor" is any person that distributes its contribution 26 | under this license. "Licensed patents" are a contributor's patent claims 27 | that read directly on its contribution.

28 |

29 | 2. Grant of Rights 30 |

31 |

32 | (A) Copyright Grant- Subject to the terms of this license, including the license 33 | conditions and limitations in section 3, each contributor grants you a non-exclusive, 34 | worldwide, royalty-free copyright license to reproduce its contribution, prepare 35 | derivative works of its contribution, and distribute its contribution or any derivative 36 | works that you create. 37 |

38 |

39 | (B) Patent Grant- Subject to the terms of this license, including the license conditions 40 | and limitations in section 3, each contributor grants you a non-exclusive, worldwide, 41 | royalty-free license under its licensed patents to make, have made, use, sell, offer 42 | for sale, import, and/or otherwise dispose of its contribution in the software or 43 | derivative works of the contribution in the software. 44 |

45 |

46 | 3. Conditions and Limitations 47 |

48 |

49 | (A) No Trademark License- This license does not grant you rights to use any contributors' 50 | name, logo, or trademarks. 51 |

52 |

53 | (B) If you bring a patent claim against any contributor over patents that you claim 54 | are infringed by the software, your patent license from such contributor to the 55 | software ends automatically. 56 |

57 |

58 | (C) If you distribute any portion of the software, you must retain all copyright, 59 | patent, trademark, and attribution notices that are present in the software. 60 |

61 |

62 | (D) If you distribute any portion of the software in source code form, you may do 63 | so only under this license by including a complete copy of this license with your 64 | distribution. If you distribute any portion of the software in compiled or object 65 | code form, you may only do so under a license that complies with this license. 66 |

67 |

68 | (E) The software is licensed "as-is." You bear the risk of using it. The 69 | contributors give no express warranties, guarantees or conditions. You may have 70 | additional consumer rights under your local laws which this license cannot change. 71 | To the extent permitted under your local laws, the contributors exclude the implied 72 | warranties of merchantability, fitness for a particular purpose and non-infringement. 73 |

74 |
77 | 78 | 79 | -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | Ms-PL 2 | Microsoft Public License (Ms-PL) 3 | 4 | This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 5 | 6 | 1. Definitions 7 | 8 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. 9 | 10 | A "contribution" is the original software, or any additions or changes to the software. 11 | 12 | A "contributor" is any person that distributes its contribution under this license. 13 | 14 | "Licensed patents" are a contributor's patent claims that read directly on its contribution. 15 | 16 | 2. Grant of Rights 17 | 18 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. 19 | 20 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 21 | 22 | 3. Conditions and Limitations 23 | 24 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. 25 | 26 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. 27 | 28 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. 29 | 30 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. 31 | 32 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. -------------------------------------------------------------------------------- /sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mrange/WPFShaderEffects/0163efc594142f77e0cf521026cf9438b00302ea/sample.jpg --------------------------------------------------------------------------------