├── .gitignore ├── BuildNugetPackage.bat ├── CompositionDeviceHelper ├── CompositionDeviceHelper.vcxproj ├── CompositionDeviceHelper.vcxproj.filters ├── DeviceLostHelper.cpp ├── DeviceLostHelper.h ├── pch.cpp └── pch.h ├── CompositionProToolkit.Controls ├── ColorShadow │ └── ColorShadow.cs ├── CompositionProToolkit.Controls.csproj ├── FluidBanner │ └── FluidBanner.cs ├── FluidProgressRing │ └── FluidProgressRing.cs ├── FluidToggleSwitch │ └── FluidToggleSwitch.cs ├── FluidWrapPanel │ ├── FluidBitMatrix.cs │ ├── FluidPointerDragBehavior.cs │ └── FluidWrapPanel.cs ├── FrostedGlass │ └── FrostedGlass.cs ├── ImageCache │ ├── ApplicationUriCacheHandler.cs │ ├── HttpUriCacheHandler.cs │ ├── ICacheHandlers.cs │ ├── ImageCache.cs │ ├── StorageFileCacheHandler.cs │ └── StreamCacheHandler.cs ├── ImageFrame │ └── ImageFrame.cs ├── ProfileControl │ └── ProfileControl.cs ├── ProgressRing3d │ └── ProgressRing3d.cs ├── Properties │ ├── AssemblyInfo.cs │ └── CompositionProToolkit.Controls.rd.xml └── Themes │ └── Generic.xaml ├── CompositionProToolkit.sln ├── CompositionProToolkit ├── ClassDiagram1.cd ├── CompositionDefinitions.cs ├── CompositionExtensions.cs ├── CompositionGenerator.cs ├── CompositionPathInfo.cs ├── CompositionProToolkit.csproj ├── CompositorExtensions.cs ├── Controls │ ├── FluidBanner │ │ └── FluidBanner.cs │ ├── FluidProgressRing │ │ └── FluidProgressRing.cs │ ├── FluidToggleSwitch │ │ └── FluidToggleSwitch.cs │ ├── FluidWrapPanel │ │ ├── FluidBitMatrix.cs │ │ ├── FluidPointerDragBehavior.cs │ │ └── FluidWrapPanel.cs │ ├── FrostedGlass │ │ └── FrostedGlass.cs │ ├── ImageFrame │ │ └── ImageFrame.cs │ ├── ProfileControl │ │ └── ProfileControl.cs │ └── ProgressRing3d │ │ └── ProgressRing3d.cs ├── DoubleExtensions.cs ├── Expressions │ ├── CompositionAnimationExtensions.cs │ ├── CompositionExpressionContext.cs │ ├── CompositionExpressionEngine.cs │ ├── CompositionExpressionResult.cs │ ├── CompositionKeyFrame.cs │ ├── CompositionObjectExtensions.cs │ ├── CompositionPropertySetExtensions.cs │ ├── ExpressionAnimation.cs │ ├── ExpressionParameter.cs │ ├── ExpressionToken.cs │ ├── README.md │ ├── Templates │ │ ├── AmbientLight.cs │ │ ├── ColorBrush.cs │ │ ├── DistantLight.cs │ │ ├── DropShadow.cs │ │ ├── ExpressionTemplate.cs │ │ ├── InsetClip.cs │ │ ├── InteractionTracker.cs │ │ ├── ManipulationPropertySet.cs │ │ ├── NineGridBrush.cs │ │ ├── PointLight.cs │ │ ├── PointerPositionPropertySet.cs │ │ ├── SpotLight.cs │ │ ├── SurfaceBrush.cs │ │ └── Visual.cs │ └── TypeExtensions.cs ├── GaussianMaskSurface.cs ├── GeometrySurface.cs ├── ICompositionGenerator.cs ├── ICompositionGeneratorInternal.cs ├── IGaussianMaskSurface.cs ├── IGeometrySurface.cs ├── IImageMaskSurface.cs ├── IImageSurface.cs ├── IMaskSurface.cs ├── IRenderSurface.cs ├── ImageCache │ ├── ApplicationUriCacheHandler.cs │ ├── HttpUriCacheHandler.cs │ ├── ICacheHandlers.cs │ ├── ImageCache.cs │ ├── StorageFileCacheHandler.cs │ └── StreamCacheHandler.cs ├── ImageMaskSurface.cs ├── ImageSurface.cs ├── MaskSurface.cs ├── Properties │ ├── AssemblyInfo.cs │ └── CompositionProToolkit.rd.xml ├── Scalar.cs ├── Themes │ └── Generic.xaml ├── Utils.cs └── Win2d │ ├── CanvasDrawingSessionExtensions.cs │ ├── CanvasElement.cs │ ├── CanvasObject.cs │ ├── CanvasPathBuilderExtensions.cs │ ├── CanvasRenderLayer.cs │ ├── CanvasStroke.cs │ ├── Common │ └── CommonDefinitions.cs │ ├── Core │ ├── CanvasRoundRect.cs │ ├── PathElementFactory.cs │ └── RegexFactory.cs │ ├── Geometry │ ├── Brush │ │ ├── AbstractCanvasBrushElement.cs │ │ ├── ICanvasBrushElement.cs │ │ ├── LinearGradientBrushElement.cs │ │ ├── LinearGradientHdrBrushElement.cs │ │ ├── RadialGradientBrushElement.cs │ │ ├── RadialGradientHdrBrushElement.cs │ │ └── SolidColorBrushElement.cs │ ├── Path │ │ ├── AbstractPathElement.cs │ │ ├── ArcElement.cs │ │ ├── CanvasEllipseFigure.cs │ │ ├── CanvasPathFigure.cs │ │ ├── CanvasPolygonFigure.cs │ │ ├── CanvasRectangleFigure.cs │ │ ├── CanvasRoundRectangleFigure.cs │ │ ├── ClosePathElement.cs │ │ ├── CubicBezierElement.cs │ │ ├── FillRuleElement.cs │ │ ├── HorizontalLineElement.cs │ │ ├── ICanvasPathElement.cs │ │ ├── LineElement.cs │ │ ├── MoveToElement.cs │ │ ├── QuadraticBezierElement.cs │ │ ├── SmoothCubicBezierElement.cs │ │ ├── SmoothQuadraticBezierElement.cs │ │ └── VerticalLineElement.cs │ └── Stroke │ │ ├── AbstractCanvasStrokeElement.cs │ │ ├── CanvasStrokeElement.cs │ │ ├── CanvasStrokeStyleElement.cs │ │ ├── ICanvasStrokeElement.cs │ │ └── ICanvasStrokeStyleElement.cs │ ├── ICanvasElement.cs │ ├── ICanvasRenderLayer.cs │ ├── ICanvasStroke.cs │ └── Parsers │ ├── CanvasBrushParser.cs │ ├── CanvasGeometryParser.cs │ ├── CanvasStrokeParser.cs │ ├── CanvasStrokeStyleParser.cs │ └── ColorParser.cs ├── CompositionProToolkit_logo.png ├── LICENSE ├── README.md ├── ToolkitGallery ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── Images │ │ ├── Alienist.jpg │ │ ├── Autumn.jpg │ │ ├── Car.jpg │ │ ├── Cat.png │ │ ├── ColorWheel.png │ │ ├── Flower.png │ │ ├── Flowers_Wide.jpg │ │ ├── HaltAndCatchFire.png │ │ ├── Image1.jpg │ │ ├── Image2.jpg │ │ ├── Image3.jpg │ │ ├── Image4.jpg │ │ ├── Image5.jpg │ │ ├── Image6.jpg │ │ ├── Image7.jpg │ │ ├── Image8.jpg │ │ ├── Image9.jpg │ │ ├── RainbowRose.png │ │ ├── p1.jpg │ │ ├── p2.jpg │ │ ├── p3.jpg │ │ ├── p4.jpg │ │ ├── p5.jpg │ │ ├── p6.jpg │ │ └── seascape.jpg │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ ├── Wide310x150Logo.scale-200.png │ └── Win10_Land.jpg ├── Controls │ ├── FluidItemControl.xaml │ ├── FluidItemControl.xaml.cs │ ├── GlyphIcon.xaml │ └── GlyphIcon.xaml.cs ├── Package.appxmanifest ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml ├── Styles │ ├── Custom.xaml │ └── IconGlyphVector.xaml ├── ToolkitGallery.csproj └── Views │ ├── CanvasElementPage.xaml │ ├── CanvasElementPage.xaml.cs │ ├── CanvasGeometryParserPage.xaml │ ├── CanvasGeometryParserPage.xaml.cs │ ├── ColorShadowPage.xaml │ ├── ColorShadowPage.xaml.cs │ ├── CompositionGeometricClipPage.xaml │ ├── CompositionGeometricClipPage.xaml.cs │ ├── FluidBannerPage.xaml │ ├── FluidBannerPage.xaml.cs │ ├── FluidProgressRingPage.xaml │ ├── FluidProgressRingPage.xaml.cs │ ├── FluidToggleSwitchPage.xaml │ ├── FluidToggleSwitchPage.xaml.cs │ ├── FluidWrapPanelPage.xaml │ ├── FluidWrapPanelPage.xaml.cs │ ├── FrostedGlassPage.xaml │ ├── FrostedGlassPage.xaml.cs │ ├── GaussianMaskSurfacePage.xaml │ ├── GaussianMaskSurfacePage.xaml.cs │ ├── GeometrySurfacePage.xaml │ ├── GeometrySurfacePage.xaml.cs │ ├── HomePage.xaml │ ├── HomePage.xaml.cs │ ├── ImageFramePage.xaml │ ├── ImageFramePage.xaml.cs │ ├── ImageMaskSurfacePage.xaml │ ├── ImageMaskSurfacePage.xaml.cs │ ├── ImageSurfacePage.xaml │ ├── ImageSurfacePage.xaml.cs │ ├── LaunchPage.xaml │ ├── LaunchPage.xaml.cs │ ├── MaskSurfacePage.xaml │ ├── MaskSurfacePage.xaml.cs │ ├── MaskedBackdropPage.xaml │ ├── MaskedBackdropPage.xaml.cs │ ├── ProfileControlPage.xaml │ ├── ProfileControlPage.xaml.cs │ ├── ProgressRing3dPage.xaml │ ├── ProgressRing3dPage.xaml.cs │ ├── SquirclePage.xaml │ ├── SquirclePage.xaml.cs │ ├── VisualReflectionPage.xaml │ └── VisualReflectionPage.xaml.cs ├── Win2d Mini Language Specification └── Win2d Mini Language Specification.pdf ├── nuget.exe └── nuget ├── CompositionProToolkit.Controls.nuspec ├── CompositionProToolkit.Controls.targets ├── CompositionProToolkit.nuspec └── CompositionProToolkit.targets /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | int/ 24 | Generated Files/ 25 | 26 | # Visual Studio 2015 cache/options directory 27 | .vs/ 28 | # Uncomment if you have tasks that create the project's static files in wwwroot 29 | #wwwroot/ 30 | 31 | # MSTest test Results 32 | [Tt]est[Rr]esult*/ 33 | [Bb]uild[Ll]og.* 34 | 35 | # NUNIT 36 | *.VisualState.xml 37 | TestResult.xml 38 | 39 | # Build Results of an ATL Project 40 | [Dd]ebugPS/ 41 | [Rr]eleasePS/ 42 | dlldata.c 43 | 44 | # DNX 45 | project.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | # TODO: Comment the next line if you want to checkin your web deploy settings 143 | # but database connection strings (with potential passwords) will be unencrypted 144 | *.pubxml 145 | *.publishproj 146 | 147 | # NuGet Packages 148 | *.nupkg 149 | # The packages folder can be ignored because of Package Restore 150 | **/packages/* 151 | # except build/, which is used as an MSBuild target. 152 | !**/packages/build/ 153 | # Uncomment if necessary however generally it will be regenerated when needed 154 | #!**/packages/repositories.config 155 | # NuGet v3's project.json files produces more ignoreable files 156 | *.nuget.props 157 | *.nuget.targets 158 | 159 | # Microsoft Azure Build Output 160 | csx/ 161 | *.build.csdef 162 | 163 | # Microsoft Azure Emulator 164 | ecf/ 165 | rcf/ 166 | 167 | # Microsoft Azure ApplicationInsights config file 168 | ApplicationInsights.config 169 | 170 | # Windows Store app package directory 171 | AppPackages/ 172 | BundleArtifacts/ 173 | 174 | # Visual Studio cache files 175 | # files ending in .cache can be ignored 176 | *.[Cc]ache 177 | # but keep track of directories ending in .cache 178 | !*.[Cc]ache/ 179 | 180 | # Others 181 | ClientBin/ 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # Paket dependency manager 235 | .paket/paket.exe 236 | 237 | # FAKE - F# Make 238 | .fake/ 239 | -------------------------------------------------------------------------------- /BuildNugetPackage.bat: -------------------------------------------------------------------------------- 1 | @REM This script must be executed inside a Developer Command Prompt for Visual Studio 2 | 3 | @pushd %~dp0 4 | 5 | @echo. 6 | @echo ===== Building CompositionDeviceHelper.dll (x86) ===== 7 | @echo. 8 | @msbuild CompositionDeviceHelper\CompositionDeviceHelper.vcxproj /p:Configuration="Release" /p:Platform="x86" 9 | 10 | @echo. 11 | @echo ===== Building CompositionDeviceHelper.dll (x64) ===== 12 | @echo. 13 | @msbuild CompositionDeviceHelper\CompositionDeviceHelper.vcxproj /p:Configuration="Release" /p:Platform="x64" 14 | 15 | @echo. 16 | @echo ===== Building CompositionDeviceHelper.dll (ARM) ===== 17 | @echo. 18 | @msbuild CompositionDeviceHelper\CompositionDeviceHelper.vcxproj /p:Configuration="Release" /p:Platform="ARM" 19 | 20 | @echo. 21 | @echo ===== Building CompositionProToolkit.dll (x86) ===== 22 | @echo. 23 | @msbuild CompositionProToolkit\CompositionProToolkit.csproj /p:Configuration="Release" /p:Platform="x86" 24 | 25 | @echo. 26 | @echo ===== Building CompositionProToolkit.dll (x64) ===== 27 | @echo. 28 | @msbuild CompositionProToolkit\CompositionProToolkit.csproj /p:Configuration="Release" /p:Platform="x64" 29 | 30 | @echo. 31 | @echo ===== Building CompositionProToolkit.dll (ARM) ===== 32 | @echo. 33 | @msbuild CompositionProToolkit\CompositionProToolkit.csproj /p:Configuration="Release" /p:Platform="ARM" 34 | 35 | @echo. 36 | @echo ===== Building CompositionProToolkit.dll (AnyCPU) ===== 37 | @echo. 38 | 39 | @REM Create a copy of the x86 CompositionProToolkit.dll and remove the 32-bit flag to make it AnyCPU 40 | @if not exist "CompositionProToolkit\bin\AnyCPU\Release\NUL" mkdir "CompositionProToolkit\bin\AnyCPU\Release" 41 | @copy /Y "CompositionProToolkit\bin\x86\Release\CompositionProToolkit.dll" "CompositionProToolkit\bin\AnyCPU\Release" 42 | @corflags.exe /32BITREQ- "CompositionProToolkit\bin\AnyCPU\Release\CompositionProToolkit.dll" 43 | 44 | 45 | @echo. 46 | @echo ===== Building CompositionProToolkit.Controls.dll (x86) ===== 47 | @echo. 48 | @msbuild CompositionProToolkit.Controls\CompositionProToolkit.Controls.csproj /p:Configuration="Release" /p:Platform="x86" 49 | 50 | @REM @echo. 51 | @REM @echo ===== Building CompositionProToolkit.Controls.dll (x64) ===== 52 | @REM @echo. 53 | @REM @msbuild CompositionProToolkit.Controls\CompositionProToolkit.Controls.csproj /p:Configuration="Release" /p:Platform="x64" 54 | 55 | @REM @echo. 56 | @REM @echo ===== Building CompositionProToolkit.Controls.dll (ARM) ===== 57 | @REM @echo. 58 | @REM @msbuild CompositionProToolkit.Controls\CompositionProToolkit.Controls.csproj /p:Configuration="Release" /p:Platform="ARM" 59 | 60 | @REM @echo. 61 | @REM @echo ===== Building CompositionProToolkit.Controls.dll (AnyCPU) ===== 62 | @REM @echo. 63 | 64 | @REM Create a copy of the x86 CompositionProToolkit.dll and remove the 32-bit flag to make it AnyCPU 65 | @if not exist "CompositionProToolkit.Controls\bin\AnyCPU\Release\NUL" mkdir "CompositionProToolkit.Controls\bin\AnyCPU\Release" 66 | @copy /Y "CompositionProToolkit.Controls\bin\x86\Release\CompositionProToolkit.Controls.dll" "CompositionProToolkit.Controls\bin\AnyCPU\Release" 67 | @corflags.exe /32BITREQ- "CompositionProToolkit.Controls\bin\AnyCPU\Release\CompositionProToolkit.Controls.dll" 68 | 69 | 70 | @echo. 71 | @echo ===== Creating NuGet package for CompositionProToolkit ===== 72 | @echo. 73 | @nuget.exe pack nuget\CompositionProToolkit.nuspec 74 | 75 | @echo. 76 | @echo ===== Creating NuGet package for CompositionProToolkit.Controls ===== 77 | @echo. 78 | @nuget.exe pack nuget\CompositionProToolkit.Controls.nuspec 79 | 80 | @popd -------------------------------------------------------------------------------- /CompositionDeviceHelper/CompositionDeviceHelper.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 77c22048-a16d-4d28-8735-1eaf4bd3780d 6 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /CompositionDeviceHelper/DeviceLostHelper.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/CompositionDeviceHelper/DeviceLostHelper.cpp -------------------------------------------------------------------------------- /CompositionDeviceHelper/DeviceLostHelper.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/CompositionDeviceHelper/DeviceLostHelper.h -------------------------------------------------------------------------------- /CompositionDeviceHelper/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /CompositionDeviceHelper/pch.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | -------------------------------------------------------------------------------- /CompositionProToolkit.Controls/ImageCache/ICacheHandlers.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit.Controls v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Threading.Tasks; 32 | 33 | namespace CompositionProToolkit.Controls 34 | { 35 | internal interface ICacheHandler 36 | { 37 | /// 38 | /// Checks if this handler can cache the given object 39 | /// 40 | /// Object to cache 41 | /// True if it can cache, otherwise False 42 | bool CanCache(object objectToCache); 43 | 44 | /// 45 | /// Caches the given Uri to the Application's ImageCache 46 | /// and returns the uri of the cached file. 47 | /// 48 | /// Object to cache 49 | /// Name of the cache file 50 | /// Delegate for handling progress 51 | /// Uri 52 | Task GetCachedUriAsync(object objectToCache, string cacheFileName, 53 | CacheProgressHandler progressHandler = null); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /CompositionProToolkit.Controls/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("CompositionProToolkit.Controls")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("CompositionProToolkit.Controls")] 12 | [assembly: AssemblyCopyright("Copyright © 2020 Ratish Philip")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Version information for an assembly consists of the following four values: 17 | // 18 | // Major Version 19 | // Minor Version 20 | // Build Number 21 | // Revision 22 | // 23 | // You can specify all the values or you can default the Build and Revision Numbers 24 | // by using the '*' as shown below: 25 | // [assembly: AssemblyVersion("1.0.*")] 26 | [assembly: AssemblyVersion("0.9.5.2")] 27 | [assembly: AssemblyFileVersion("0.9.5.2")] 28 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /CompositionProToolkit.Controls/Properties/CompositionProToolkit.Controls.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /CompositionProToolkit/DoubleExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | 32 | namespace CompositionProToolkit 33 | { 34 | /// 35 | /// Extension methods for System.Double 36 | /// 37 | public static class DoubleExtensions 38 | { 39 | /// 40 | /// Converts double value to float 41 | /// 42 | /// double value 43 | /// float 44 | public static float ToSingle(this double value) 45 | { 46 | // Double to float conversion can overflow. 47 | try 48 | { 49 | return Convert.ToSingle(value); 50 | } 51 | catch (OverflowException ex) 52 | { 53 | throw new ArgumentOutOfRangeException("Cannot convert the double value to float!", ex); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/CompositionExpressionResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Collections.Generic; 31 | 32 | namespace CompositionProToolkit.Expressions 33 | { 34 | /// 35 | /// This class stores the result of the Expression Tree visit 36 | /// done by the CompositionExpressionEngine 37 | /// 38 | internal class CompositionExpressionResult 39 | { 40 | #region Properties 41 | 42 | /// 43 | /// Gets the Expression as a string 44 | /// 45 | public string Expression { get; set; } 46 | /// 47 | /// Map of parameters 48 | /// 49 | public Dictionary Parameters { get; set; } 50 | 51 | #endregion 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/ExpressionParameter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | 32 | namespace CompositionProToolkit.Expressions 33 | { 34 | /// 35 | /// Structure which holds a reference to an object used 36 | /// within the Expression. 37 | /// 38 | internal struct ExpressionParameter 39 | { 40 | #region Members 41 | 42 | /// 43 | /// Reference to the object used in the Expression 44 | /// 45 | public object Reference; 46 | /// 47 | /// The type (or super-type i.e. the type from which the 48 | /// object's type is derived) of the object reference. 49 | /// 50 | public Type Type; 51 | 52 | #endregion 53 | 54 | #region Construction / Initialization 55 | 56 | /// 57 | /// ctor 58 | /// 59 | /// Reference to the Object used in the expression 60 | /// The type (or super-type i.e. the type from which the 61 | /// object's type is derived) of the object reference. 62 | public ExpressionParameter(object reference, Type type) 63 | { 64 | Reference = reference; 65 | Type = type; 66 | } 67 | 68 | #endregion 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/AmbientLight.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using Windows.UI; 31 | using Windows.UI.Composition; 32 | 33 | namespace CompositionProToolkit.Expressions.Templates 34 | { 35 | /// 36 | /// Base Template class for AmbientLight 37 | /// 38 | public abstract class AmbientLightTemplate : ExpressionTemplate 39 | { 40 | /// 41 | /// ctor 42 | /// 43 | /// Template name 44 | internal AmbientLightTemplate(string name) : base(name) 45 | { 46 | Type = typeof(AmbientLight); 47 | } 48 | 49 | /// 50 | /// Gets the color of the ambient light. 51 | /// 52 | public Color Color { get; } 53 | 54 | /// 55 | /// Gets the intensity of the light. 56 | /// 57 | public float Intensity { get; } 58 | } 59 | 60 | /// 61 | /// Target Template for AmbientLight. This provides a reference to 62 | /// the AmbientLight object to which an Expression is connected. 63 | /// 64 | public sealed class AmbientLightTarget : AmbientLightTemplate 65 | { 66 | /// 67 | /// ctor 68 | /// 69 | public AmbientLightTarget() : base(string.Empty) 70 | { 71 | 72 | } 73 | } 74 | 75 | /// 76 | /// Reference Template for AmbientLight. When you use this object to define 77 | /// the reference in the Expression of any animation, you must call the 78 | /// SetReference() method of the ExpressionAnimation to set the reference 79 | /// to actual AmbientLight object. 80 | /// 81 | public sealed class AmbientLightReference : AmbientLightTemplate 82 | { 83 | /// 84 | /// ctor 85 | /// 86 | /// Reference name 87 | public AmbientLightReference(string referenceName) : base(referenceName) 88 | { 89 | 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/ColorBrush.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using Windows.UI; 31 | using Windows.UI.Composition; 32 | 33 | namespace CompositionProToolkit.Expressions.Templates 34 | { 35 | /// 36 | /// Base Template class for CompositionColorBrush 37 | /// 38 | public abstract class ColorBrushTemplate : ExpressionTemplate 39 | { 40 | /// 41 | /// ctor 42 | /// 43 | /// Template name 44 | internal ColorBrushTemplate(string name) : base(name) 45 | { 46 | Type = typeof(CompositionColorBrush); 47 | } 48 | 49 | /// 50 | /// The color used to fill a Windows.UI.Composition.SpriteVisual. 51 | /// 52 | public Color Color { get; } 53 | } 54 | 55 | /// 56 | /// Target Template for CompositionColorBrush. This provides a reference to 57 | /// the CompositionColorBrush object to which an Expression is connected. 58 | /// 59 | public sealed class ColorBrushTarget : ColorBrushTemplate 60 | { 61 | /// 62 | /// ctor 63 | /// 64 | public ColorBrushTarget() : base(string.Empty) 65 | { 66 | 67 | } 68 | } 69 | 70 | /// 71 | /// Reference Template for CompositionColorBrush. When you use this object to define 72 | /// the reference in the Expression of any animation, you must call the 73 | /// SetReference() method of the ExpressionAnimation to set the reference 74 | /// to actual CompositionColorBrush object. 75 | /// 76 | public sealed class ColorBrushReference : ColorBrushTemplate 77 | { 78 | /// 79 | /// ctor 80 | /// 81 | /// Reference name 82 | public ColorBrushReference(string referenceName) : base(referenceName) 83 | { 84 | 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/DistantLight.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Windows.UI; 32 | using Windows.UI.Composition; 33 | 34 | namespace CompositionProToolkit.Expressions.Templates 35 | { 36 | /// 37 | /// Base Template class for DistantLight 38 | /// 39 | public abstract class DistantLightTemplate : ExpressionTemplate 40 | { 41 | /// 42 | /// ctor 43 | /// 44 | /// Template name 45 | internal DistantLightTemplate(string name) : base(name) 46 | { 47 | Type = typeof(DistantLight); 48 | } 49 | 50 | /// 51 | /// Color of the emitted DistantLight. 52 | /// 53 | public Color Color { get; } 54 | 55 | /// 56 | /// The direction in which the light is pointing, specified 57 | /// relative to its Windows.UI.Composition.DistantLight.CoordinateSpace Visual. 58 | /// 59 | public Vector3 Direction { get; } 60 | 61 | /// 62 | /// Gets the intensity of the light. 63 | /// 64 | public float Intensity { get; } 65 | 66 | /// 67 | /// Gets the CoordinateSpace Visual 68 | /// 69 | public Visual CoordinateSpace { get; } 70 | } 71 | 72 | /// 73 | /// Target Template for DistantLight. This provides a reference to 74 | /// the DistantLight object to which an Expression is connected. 75 | /// 76 | public sealed class DistantLightTarget : DistantLightTemplate 77 | { 78 | /// 79 | /// ctor 80 | /// 81 | public DistantLightTarget() : base(string.Empty) 82 | { 83 | 84 | } 85 | } 86 | 87 | /// 88 | /// Reference Template for DistantLight. When you use this object to define 89 | /// the reference in the Expression of any animation, you must call the 90 | /// SetReference() method of the ExpressionAnimation to set the reference 91 | /// to actual DistantLight object. 92 | /// 93 | public sealed class DistantLightReference : DistantLightTemplate 94 | { 95 | /// 96 | /// ctor 97 | /// 98 | /// Reference name 99 | public DistantLightReference(string referenceName) : base(referenceName) 100 | { 101 | 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/DropShadow.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Windows.UI; 32 | using Windows.UI.Composition; 33 | 34 | namespace CompositionProToolkit.Expressions.Templates 35 | { 36 | /// 37 | /// Base Template class for DropShadow 38 | /// 39 | public abstract class DropShadowTemplate : ExpressionTemplate 40 | { 41 | /// 42 | /// ctor 43 | /// 44 | /// Template name 45 | internal DropShadowTemplate(string name) : base(name) 46 | { 47 | Type = typeof(DropShadow); 48 | } 49 | 50 | /// 51 | /// The radius of the Gaussian blur used to generate the shadow. 52 | /// 53 | public float BlurRadius { get; } 54 | /// 55 | /// The opacity of the shadow. 56 | /// 57 | public float Opacity { get; } 58 | /// 59 | /// Offset of the shadow relative to its SpriteVisual. 60 | /// 61 | public Vector3 Offset { get; } 62 | /// 63 | /// Color of the shadow 64 | /// 65 | public Color Color { get; } 66 | } 67 | 68 | /// 69 | /// Target Template for DropShadow. This provides a reference to 70 | /// the DropShadow object to which an Expression is connected. 71 | /// 72 | public sealed class DropShadowTarget : DropShadowTemplate 73 | { 74 | /// 75 | /// ctor 76 | /// 77 | public DropShadowTarget() : base(string.Empty) 78 | { 79 | 80 | } 81 | } 82 | 83 | /// 84 | /// Reference Template for DropShadow. When you use this object to define 85 | /// the reference in the Expression of any animation, you must call the 86 | /// SetReference() method of the ExpressionAnimation to set the reference 87 | /// to actual DropShadow object. 88 | /// 89 | public sealed class DropShadowReference : DropShadowTemplate 90 | { 91 | /// 92 | /// ctor 93 | /// 94 | /// Reference name 95 | public DropShadowReference(string referenceName) : base(referenceName) 96 | { 97 | 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/ExpressionTemplate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | 32 | namespace CompositionProToolkit.Expressions.Templates 33 | { 34 | /// 35 | /// Defines the abstract base class from 36 | /// which all other Expression Template classes 37 | /// derive. 38 | /// 39 | public abstract class ExpressionTemplate 40 | { 41 | #region Properties 42 | 43 | /// 44 | /// The base type of the Target/Reference Template 45 | /// 46 | public Type Type { get; protected set; } 47 | /// 48 | /// The name associated with this template 49 | /// 50 | internal string Name { get; } 51 | 52 | #endregion 53 | 54 | #region Construction / Initialization 55 | 56 | internal ExpressionTemplate(string name) 57 | { 58 | Name = name; 59 | } 60 | 61 | #endregion 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/ManipulationPropertySet.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Windows.UI.Composition; 32 | 33 | namespace CompositionProToolkit.Expressions.Templates 34 | { 35 | /// 36 | /// Base Template class for ManipulationPropertySet 37 | /// 38 | public abstract class ManipulationPropertySetTemplate : ExpressionTemplate 39 | { 40 | /// 41 | /// ctor 42 | /// 43 | /// Template name 44 | internal ManipulationPropertySetTemplate(string name) : base(name) 45 | { 46 | Type = typeof(CompositionPropertySet); 47 | } 48 | 49 | /// 50 | /// The point about which rotation or scaling occurs. 51 | /// 52 | public Vector3 CenterPoint { get; } 53 | /// 54 | /// The pan to apply on the ManipulationPropertySet 55 | /// 56 | public Vector3 Pan { get; } 57 | /// 58 | /// The scale to apply on the ManipulationPropertySet 59 | /// 60 | public Vector3 Scale { get; } 61 | /// 62 | /// The Translation to apply on the ManipulationPropertySet 63 | /// 64 | public Vector3 Translation { get; } 65 | /// 66 | /// The transformation matrix to apply on the ManipulationPropertySet 67 | /// 68 | public Matrix4x4 Matrix { get; } 69 | } 70 | 71 | /// 72 | /// Target Template for ManipulationPropertySet. This provides a reference to 73 | /// the ManipulationPropertySet object to which an Expression is connected. 74 | /// 75 | public sealed class ManipulationPropertySetTarget : ManipulationPropertySetTemplate 76 | { 77 | /// 78 | /// ctor 79 | /// 80 | public ManipulationPropertySetTarget() : base(string.Empty) 81 | { 82 | 83 | } 84 | } 85 | 86 | /// 87 | /// Reference Template for ManipulationPropertySet. When you use this object to define 88 | /// the reference in the Expression of any animation, you must call the 89 | /// SetReference() method of the ExpressionAnimation to set the reference 90 | /// to actual ManipulationPropertySet object. 91 | /// 92 | public sealed class ManipulationPropertySetReference : ManipulationPropertySetTemplate 93 | { 94 | /// 95 | /// ctor 96 | /// 97 | /// Reference name 98 | public ManipulationPropertySetReference(string referenceName) : base(referenceName) 99 | { 100 | 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/PointLight.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Windows.UI; 32 | using Windows.UI.Composition; 33 | 34 | namespace CompositionProToolkit.Expressions.Templates 35 | { 36 | /// 37 | /// Base Template class for PointLight 38 | /// 39 | public abstract class PointLightTemplate : ExpressionTemplate 40 | { 41 | /// 42 | /// ctor 43 | /// 44 | /// Template name 45 | internal PointLightTemplate(string name) : base(name) 46 | { 47 | Type = typeof(PointLight); 48 | } 49 | 50 | /// 51 | /// The constant coefficient in the light's attenuation equation. Controls light 52 | /// intensity. Range is from 0 to infinity. 53 | /// 54 | public float ConstantAttenuation { get; } 55 | /// 56 | /// The linear coefficient in the light's attenuation equation that determines how 57 | /// the light falls-off with distance. Range is from 0 to infinity. 58 | /// 59 | public float LinearAttenuation { get; } 60 | /// 61 | /// The quadratic portion of the attenuation equation that determines how the light 62 | /// falls off with distance. Controls light intensity falloff based on distance squared. 63 | /// Range is from 0 to infinity. 64 | /// 65 | public float QuadraticAttentuation { get; } 66 | /// 67 | /// Color of the light. 68 | /// 69 | public Color Color { get; } 70 | /// 71 | /// The intensity of the light. 72 | /// 73 | public float Intensity { get; } 74 | /// 75 | /// Offset of the light source relative to its coordinate space Visual. 76 | /// 77 | public Vector3 Offset { get; } 78 | /// 79 | /// Gets the Minimun Attenuation Cutoff 80 | /// 81 | public float MinAttenuationCutoff { get; } 82 | /// 83 | /// Gets the Maximun Attenuation Cutoff 84 | /// 85 | public float MaxAttenuationCutoff { get; } 86 | } 87 | 88 | /// 89 | /// Target Template for PointLight. This provides a reference to 90 | /// the PointLight object to which an Expression is connected. 91 | /// 92 | public sealed class PointLightTarget : PointLightTemplate 93 | { 94 | /// 95 | /// ctor 96 | /// 97 | public PointLightTarget() : base(string.Empty) 98 | { 99 | 100 | } 101 | } 102 | 103 | /// 104 | /// Reference Template for PointLight. When you use this object to define 105 | /// the reference in the Expression of any animation, you must call the 106 | /// SetReference() method of the ExpressionAnimation to set the reference 107 | /// to actual PointLight object. 108 | /// 109 | public sealed class PointLightReference : PointLightTemplate 110 | { 111 | /// 112 | /// ctor 113 | /// 114 | /// Reference name 115 | public PointLightReference(string referenceName) : base(referenceName) 116 | { 117 | 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /CompositionProToolkit/Expressions/Templates/PointerPositionPropertySet.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Windows.UI.Composition; 32 | 33 | namespace CompositionProToolkit.Expressions.Templates 34 | { 35 | /// 36 | /// Base Template class for CompositionPropertySet 37 | /// 38 | public abstract class PointerPositionPropertySetTemplate : ExpressionTemplate 39 | { 40 | /// 41 | /// ctor 42 | /// 43 | /// Template name 44 | internal PointerPositionPropertySetTemplate(string name) : base(name) 45 | { 46 | Type = typeof(CompositionPropertySet); 47 | } 48 | 49 | /// 50 | /// The position of the visual 51 | /// 52 | public Vector3 Position { get; } 53 | } 54 | 55 | /// 56 | /// Target Template for CompositionPropertySet. This provides a reference to 57 | /// the CompositionPropertySet object to which an Expression is connected. 58 | /// 59 | public sealed class PointerPositionPropertySetTarget : PointerPositionPropertySetTemplate 60 | { 61 | /// 62 | /// ctor 63 | /// 64 | public PointerPositionPropertySetTarget() : base(string.Empty) 65 | { 66 | 67 | } 68 | } 69 | 70 | /// 71 | /// Reference Template for CompositionPropertySet. When you use this object to define 72 | /// the reference in the Expression of any animation, you must call the 73 | /// SetReference() method of the ExpressionAnimation to set the reference 74 | /// to actual CompositionPropertySet object. 75 | /// 76 | public sealed class PointerPositionPropertySetReference : PointerPositionPropertySetTemplate 77 | { 78 | /// 79 | /// ctor 80 | /// 81 | /// Reference name 82 | public PointerPositionPropertySetReference(string referenceName) : base(referenceName) 83 | { 84 | 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /CompositionProToolkit/IGaussianMaskSurface.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Windows.Foundation; 32 | using Windows.UI.Xaml; 33 | using Microsoft.Graphics.Canvas.Geometry; 34 | 35 | namespace CompositionProToolkit 36 | { 37 | /// 38 | /// Interface for rendering custom shaped geometries onto ICompositionSurface 39 | /// so that they can be used as masks on Composition Visuals. These geometries 40 | /// have a Gaussian Blur applied to them. 41 | /// 42 | public interface IGaussianMaskSurface : IMaskSurface 43 | { 44 | #region Properties 45 | 46 | /// 47 | /// Radius of Gaussian Blur to be applied on the GaussianMaskSurface 48 | /// 49 | float BlurRadius { get; } 50 | 51 | #endregion 52 | 53 | #region APIs 54 | 55 | /// 56 | /// Applies the given blur radius to the IGaussianMaskSurface. 57 | /// 58 | /// Radius of Gaussian Blur to be applied on the GaussianMaskSurface 59 | void Redraw(float blurRadius); 60 | 61 | /// 62 | /// Redraws the IGaussianMaskSurface with the new geometry and fills it with White color after applying 63 | /// the Gaussian blur with given blur radius. 64 | /// 65 | /// New CanvasGeometry to be applied to the GaussianMaskSurface 66 | /// The offset from the top left corner of the ICompositionSurface where 67 | /// the Geometry is rendered. 68 | /// Radius of Gaussian Blur to be applied on the IGaussianMaskSurface 69 | void Redraw(CanvasGeometry geometry, Vector2 offset, float blurRadius); 70 | 71 | /// 72 | /// Resizes the IGaussianMaskSurface with the given size and redraws the IGaussianMaskSurface 73 | /// with the new geometry and fills it with White color 74 | /// 75 | /// New size of the mask 76 | /// New CanvasGeometry to be applied to the IGaussianMaskSurface 77 | /// The offset from the top left corner of the ICompositionSurface where 78 | /// the Geometry is rendered. 79 | /// Radius of Gaussian Blur to be applied on the IGaussianMaskSurface 80 | void Redraw(Size size, CanvasGeometry geometry, Vector2 offset, float blurRadius); 81 | 82 | #endregion 83 | } 84 | } -------------------------------------------------------------------------------- /CompositionProToolkit/IMaskSurface.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Windows.Foundation; 32 | using Microsoft.Graphics.Canvas.Geometry; 33 | 34 | namespace CompositionProToolkit 35 | { 36 | /// 37 | /// Interface for rendering custom shaped geometries onto ICompositionSurface 38 | /// so that they can be used as masks on Composition Visuals. 39 | /// 40 | public interface IMaskSurface : IRenderSurface 41 | { 42 | #region Properties 43 | 44 | /// 45 | /// Gets the Geometry of the MaskSurface 46 | /// 47 | CanvasGeometry Geometry { get; } 48 | /// 49 | /// The offset from the top left corner of the ICompositionSurface where 50 | /// the Geometry is rendered. 51 | /// 52 | Vector2 Offset { get; } 53 | 54 | #endregion 55 | 56 | #region APIs 57 | 58 | /// 59 | /// Redraws the MaskSurface with the new geometry 60 | /// 61 | /// New CanvasGeometry to be applied to the IMaskSurface 62 | void Redraw(CanvasGeometry geometry); 63 | 64 | /// 65 | /// Resizes the MaskSurface with the given size and redraws the IMaskSurface 66 | /// with the new geometry and fills it with White color 67 | /// 68 | /// New size of the mask 69 | /// New CanvasGeometry to be applied to the IMaskSurface 70 | void Redraw(Size size, CanvasGeometry geometry); 71 | 72 | /// 73 | /// Redraws the IMaskSurface with the new geometry 74 | /// 75 | /// New CanvasGeometry to be applied to the IMaskSurface 76 | /// The offset from the top left corner of the ICompositionSurface where 77 | /// the Geometry is rendered. 78 | void Redraw(CanvasGeometry geometry, Vector2 offset); 79 | 80 | /// 81 | /// Resizes the IMaskSurface with the given size and redraws the IMaskSurface 82 | /// with the new geometry and fills it with White color 83 | /// 84 | /// New size of the mask 85 | /// New CanvasGeometry to be applied to the IMaskSurface 86 | /// The offset from the top left corner of the ICompositionSurface where 87 | /// the Geometry is rendered. 88 | void Redraw(Size size, CanvasGeometry geometry, Vector2 offset); 89 | 90 | #endregion 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /CompositionProToolkit/IRenderSurface.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using Windows.Foundation; 32 | using Windows.UI.Composition; 33 | 34 | namespace CompositionProToolkit 35 | { 36 | /// 37 | /// Represents the core interface for interfaces 38 | /// which render onto ICompositionSurface. 39 | /// 40 | public interface IRenderSurface : IDisposable 41 | { 42 | #region Properties 43 | 44 | /// 45 | /// Gets the Generator 46 | /// 47 | ICompositionGenerator Generator { get; } 48 | 49 | /// 50 | /// Gets the Surface 51 | /// 52 | ICompositionSurface Surface { get; } 53 | 54 | /// 55 | /// Gets the Surface Size 56 | /// 57 | Size Size { get; } 58 | 59 | #endregion 60 | 61 | #region APIs 62 | 63 | /// 64 | /// Redraws the surface 65 | /// 66 | void Redraw(); 67 | 68 | /// 69 | /// Resizes the surface to the new size. 70 | /// 71 | /// New size of the surface 72 | void Resize(Size size); 73 | 74 | #endregion 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /CompositionProToolkit/ImageCache/ICacheHandlers.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v0.9.0 28 | // 29 | 30 | using System; 31 | using System.Threading.Tasks; 32 | 33 | namespace CompositionProToolkit 34 | { 35 | internal interface ICacheHandler 36 | { 37 | /// 38 | /// Checks if this handler can cache the given object 39 | /// 40 | /// Object to cache 41 | /// True if it can cache, otherwise False 42 | bool CanCache(object objectToCache); 43 | 44 | /// 45 | /// Caches the given Uri to the Application's ImageCache 46 | /// and returns the uri of the cached file. 47 | /// 48 | /// Object to cache 49 | /// Name of the cache file 50 | /// Delegate for handling progress 51 | /// Uri 52 | Task GetCachedUriAsync(object objectToCache, string cacheFileName, 53 | CacheProgressHandler progressHandler = null); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /CompositionProToolkit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CompositionProToolkit")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CompositionProToolkit")] 13 | [assembly: AssemblyCopyright("Copyright © 2020 Ratish Philip")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | [assembly: InternalsVisibleTo("CompositionProToolkit.Controls")] 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("0.9.5.2")] 28 | [assembly: AssemblyFileVersion("0.9.5.2")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /CompositionProToolkit/Properties/CompositionProToolkit.rd.xml: -------------------------------------------------------------------------------- 1 | 2 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /CompositionProToolkit/Scalar.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | 32 | namespace CompositionProToolkit 33 | { 34 | /// 35 | /// Class containing some constants 36 | /// represented as Floating point numbers. 37 | /// 38 | public static class Scalar 39 | { 40 | // Pi related floating point constants 41 | 42 | /// 43 | /// (float)Math.PI radians ( or 180 degrees). 44 | /// 45 | public const float Pi = (float)Math.PI; 46 | /// 47 | /// Two times (float)Math.PI radians ( or 360 degrees). 48 | /// 49 | public const float TwoPi = 2f * Pi; 50 | /// 51 | /// Half of (float)Math.PI radians ( or 90 degrees). 52 | /// 53 | public const float PiByTwo = Pi / 2f; 54 | /// 55 | /// One third of (float)Math.PI radians ( or 60 degrees). 56 | /// 57 | public const float PiByThree = Pi / 3f; 58 | /// 59 | /// One fourth of (float)Math.PI radians ( or 45 degrees). 60 | /// 61 | public const float PiByFour = Pi / 4f; 62 | /// 63 | /// One sixth of (float)Math.PI radians ( or 30 degrees). 64 | /// 65 | public const float PiBySix = Pi / 6f; 66 | /// 67 | /// Three times half of (float)Math.PI radians ( or 270 degrees). 68 | /// 69 | public const float ThreePiByTwo = 3f * Pi / 2f; 70 | 71 | // Conversion constants 72 | 73 | /// 74 | /// 1 degree in radians. 75 | /// 76 | public const float DegreesToRadians = Pi / 180f; 77 | /// 78 | /// 1 radian in degrees. 79 | /// 80 | public const float RadiansToDegrees = 180f / Pi; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Common/CommonDefinitions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | namespace CompositionProToolkit.Win2d.Common 31 | { 32 | /// 33 | /// Enum for the various PathFigures 34 | /// 35 | internal enum PathFigureType 36 | { 37 | FillRule, 38 | PathFigure, 39 | EllipseFigure, 40 | PolygonFigure, 41 | RectangleFigure, 42 | RoundedRectangleFigure 43 | } 44 | 45 | /// 46 | /// Enum for the various PathElements 47 | /// 48 | internal enum PathElementType 49 | { 50 | MoveTo, 51 | Line, 52 | HorizontalLine, 53 | VerticalLine, 54 | QuadraticBezier, 55 | SmoothQuadraticBezier, 56 | CubicBezier, 57 | SmoothCubicBezier, 58 | Arc, 59 | ClosePath 60 | } 61 | 62 | /// 63 | /// Enum for the various types of Brushes 64 | /// 65 | internal enum BrushType 66 | { 67 | SolidColor, 68 | LinearGradient, 69 | RadialGradient, 70 | LinearGradientHdr, 71 | RadialGradientHdr 72 | } 73 | 74 | /// 75 | /// Enum for the various types of 76 | /// GradientStop attributes 77 | /// 78 | internal enum GradientStopAttributeType 79 | { 80 | Main, 81 | Additional, 82 | MainHdr, 83 | AdditionalHdr 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Brush/AbstractCanvasBrushElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Text.RegularExpressions; 32 | using CompositionProToolkit.Win2d.Core; 33 | using Microsoft.Graphics.Canvas; 34 | using Microsoft.Graphics.Canvas.Brushes; 35 | 36 | namespace CompositionProToolkit.Win2d.Geometry.Brush 37 | { 38 | /// 39 | /// Abstract base class for all Brush Elements 40 | /// 41 | internal abstract class AbstractCanvasBrushElement : ICanvasBrushElement 42 | { 43 | #region Fields 44 | 45 | protected float _opacity; 46 | 47 | #endregion 48 | 49 | #region Properties 50 | 51 | /// 52 | /// Gets the Brush data defining the Brush Element 53 | /// 54 | public string Data { get; protected set; } 55 | /// 56 | /// Gets the number of non-whitespace characters in 57 | /// the Brush Data 58 | /// 59 | public int ValidationCount { get; protected set; } 60 | 61 | #endregion 62 | 63 | #region APIs 64 | 65 | /// 66 | /// Initializes the Brush Element with the given Capture 67 | /// 68 | /// Capture object 69 | public virtual void Initialize(Capture capture) 70 | { 71 | Data = capture.Value; 72 | 73 | var regex = GetAttributesRegex(); 74 | var match = regex.Match(Data); 75 | if (!match.Success) 76 | { 77 | return; 78 | } 79 | 80 | GetAttributes(match); 81 | 82 | // Get the number of non-whitespace characters in the data 83 | ValidationCount = RegexFactory.ValidationRegex.Replace(Data, String.Empty).Length; 84 | } 85 | 86 | /// 87 | /// Creates the ICanvasBrush from the parsed data 88 | /// 89 | /// ICanvasResourceCreator object 90 | /// ICanvasBrush 91 | public abstract ICanvasBrush CreateBrush(ICanvasResourceCreator resourceCreator); 92 | 93 | #endregion 94 | 95 | #region Helpers 96 | 97 | /// 98 | /// Gets the Regex for extracting Brush Element Attributes 99 | /// 100 | /// Regex 101 | protected abstract Regex GetAttributesRegex(); 102 | 103 | /// 104 | /// Gets the Brush Element Attributes from the Match 105 | /// 106 | /// Match object 107 | protected abstract void GetAttributes(Match match); 108 | 109 | #endregion 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Brush/ICanvasBrushElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using Microsoft.Graphics.Canvas.Brushes; 31 | using System.Text.RegularExpressions; 32 | using Microsoft.Graphics.Canvas; 33 | 34 | namespace CompositionProToolkit.Win2d.Geometry.Brush 35 | { 36 | /// 37 | /// Interface for a Brush Element 38 | /// 39 | internal interface ICanvasBrushElement 40 | { 41 | #region Properties 42 | 43 | /// 44 | /// Gets the Brush data defining the Brush Element 45 | /// 46 | string Data { get; } 47 | /// 48 | /// Gets the number of non-whitespace characters in 49 | /// the Brush Data 50 | /// 51 | int ValidationCount { get; } 52 | 53 | #endregion 54 | 55 | #region APIs 56 | 57 | /// 58 | /// Initializes the Brush Element with the given Capture 59 | /// 60 | /// Capture object 61 | void Initialize(Capture capture); 62 | 63 | /// 64 | /// Creates the ICanvasBrush from the parsed data 65 | /// 66 | /// ICanvasResourceCreator object 67 | /// ICanvasBrush 68 | ICanvasBrush CreateBrush(ICanvasResourceCreator resourceCreator); 69 | 70 | #endregion 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Brush/SolidColorBrushElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Text.RegularExpressions; 32 | using Windows.UI; 33 | using CompositionProToolkit.Win2d.Common; 34 | using CompositionProToolkit.Win2d.Core; 35 | using CompositionProToolkit.Win2d.Parsers; 36 | using Microsoft.Graphics.Canvas; 37 | using Microsoft.Graphics.Canvas.Brushes; 38 | 39 | namespace CompositionProToolkit.Win2d.Geometry.Brush 40 | { 41 | /// 42 | /// Represents a CanvasSolidColorBrush 43 | /// 44 | internal sealed class SolidColorBrushElement : AbstractCanvasBrushElement 45 | { 46 | #region Fields 47 | 48 | private Color _color; 49 | 50 | #endregion 51 | 52 | #region Construction / Initialization 53 | 54 | /// 55 | /// ctor 56 | /// 57 | /// Capture object 58 | public SolidColorBrushElement(Capture capture) 59 | { 60 | // Set the default values 61 | _color = Colors.Transparent; 62 | _opacity = 1f; 63 | 64 | Initialize(capture); 65 | } 66 | 67 | #endregion 68 | 69 | #region APIs 70 | 71 | /// 72 | /// Creates the ICanvasBrush from the parsed data 73 | /// 74 | /// ICanvasResourceCreator object 75 | /// ICanvasBrush 76 | public override ICanvasBrush CreateBrush(ICanvasResourceCreator resourceCreator) 77 | { 78 | return new CanvasSolidColorBrush(resourceCreator, _color) 79 | { 80 | Opacity = _opacity 81 | }; 82 | } 83 | 84 | #endregion 85 | 86 | #region Helpers 87 | 88 | /// 89 | /// Gets the Regex for extracting Brush Element Attributes 90 | /// 91 | /// Regex 92 | protected override Regex GetAttributesRegex() 93 | { 94 | return RegexFactory.GetAttributesRegex(BrushType.SolidColor); 95 | } 96 | 97 | /// 98 | /// Gets the Brush Element Attributes from the Match 99 | /// 100 | /// Match object 101 | protected override void GetAttributes(Match match) 102 | { 103 | // Parse the Color 104 | _color = ColorParser.Parse(match); 105 | 106 | // Opacity (optional) 107 | var group = match.Groups["Opacity"]; 108 | if (group.Success) 109 | { 110 | Single.TryParse(group.Value, out _opacity); 111 | } 112 | } 113 | 114 | #endregion 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Path/HorizontalLineElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Numerics; 32 | using System.Text; 33 | using System.Text.RegularExpressions; 34 | using CompositionProToolkit.Win2d.Common; 35 | using CompositionProToolkit.Win2d.Core; 36 | using Microsoft.Graphics.Canvas.Geometry; 37 | 38 | namespace CompositionProToolkit.Win2d.Geometry.Path 39 | { 40 | /// 41 | /// Class representing the Horizontal Line Element in a Path Geometry 42 | /// 43 | internal class HorizontalLineElement : AbstractPathElement 44 | { 45 | #region Fields 46 | 47 | private float _x; 48 | 49 | #endregion 50 | 51 | #region Construction / Initialization 52 | 53 | /// 54 | /// ctor 55 | /// 56 | public HorizontalLineElement() 57 | { 58 | _x = 0; 59 | } 60 | 61 | #endregion 62 | 63 | #region APIs 64 | 65 | /// 66 | /// Adds the Path Element to the Path. 67 | /// 68 | /// CanvasPathBuilder object 69 | /// The last active location in the Path before adding 70 | /// the Path Element 71 | /// The previous PathElement in the Path. 72 | /// For logging purpose. To log the set of CanvasPathBuilder 73 | /// commands, used for creating the CanvasGeometry, in string format. 74 | /// The latest location in the Path after adding the Path Element 75 | public override Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint, 76 | ref ICanvasPathElement lastElement, StringBuilder logger) 77 | { 78 | // Calculate coordinates 79 | var point = IsRelative ? 80 | new Vector2(currentPoint.X + _x, currentPoint.Y) : new Vector2(_x, currentPoint.Y); 81 | 82 | // Execute command 83 | pathBuilder.AddLine(point); 84 | 85 | // Log command 86 | logger?.AppendLine($"{Indent}pathBuilder.AddLine(new Vector2({point.X}, {point.Y}));"); 87 | 88 | // Set Last Element 89 | lastElement = this; 90 | // Return current point 91 | return point; 92 | } 93 | 94 | #endregion 95 | 96 | #region Helpers 97 | 98 | /// 99 | /// Get the Regex for extracting Path Element Attributes 100 | /// 101 | /// 102 | protected override Regex GetAttributesRegex() 103 | { 104 | return RegexFactory.GetAttributesRegex(PathElementType.HorizontalLine); 105 | } 106 | 107 | /// 108 | /// Gets the Path Element Attributes from the Match 109 | /// 110 | /// Match object 111 | protected override void GetAttributes(Match match) 112 | { 113 | Single.TryParse(match.Groups["X"].Value, out _x); 114 | } 115 | 116 | #endregion 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Path/ICanvasPathElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using System.Text; 32 | using System.Text.RegularExpressions; 33 | using Microsoft.Graphics.Canvas.Geometry; 34 | 35 | namespace CompositionProToolkit.Win2d.Geometry.Path 36 | { 37 | /// 38 | /// Interface for a Path Element which serves 39 | /// as a building block for CanvasPathGeometry 40 | /// 41 | internal interface ICanvasPathElement 42 | { 43 | #region Properties 44 | 45 | /// 46 | /// Index of the Path Element in the Path Data 47 | /// 48 | int Index { get; } 49 | /// 50 | /// Path data defining the Path Element 51 | /// 52 | string Data { get; } 53 | /// 54 | /// Number of non-whitespace characters in 55 | /// the Path Element Data 56 | /// 57 | int ValidationCount { get; } 58 | /// 59 | /// Indicates whether the path element contains 60 | /// absolute or relative coordinates. 61 | /// 62 | bool IsRelative { get; } 63 | 64 | #endregion 65 | 66 | #region APIs 67 | 68 | /// 69 | /// Initializes the Path Element with the given Match 70 | /// 71 | /// Match object 72 | /// Index of the Path Element in the Path data. 73 | void Initialize(Match match, int index); 74 | 75 | /// 76 | /// Initializes the Path Element with the given Capture 77 | /// 78 | /// Capture object 79 | /// Index of the Path Element in the Path data. 80 | /// Indicates whether the Path Element coordinates are 81 | /// absolute or relative 82 | void InitializeAdditional(Capture capture, int index, bool isRelative); 83 | 84 | /// 85 | /// Adds the Path Element to the PathBuilder. 86 | /// 87 | /// CanvasPathBuilder object 88 | /// The current point on the path before the path element is added 89 | /// The previous PathElement in the Path. 90 | /// For logging purpose. To log the set of CanvasPathBuilder 91 | /// commands, used for creating the CanvasGeometry, in string format. 92 | /// The current point on the path after the path element is added 93 | Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint, 94 | ref ICanvasPathElement lastElement, StringBuilder logger); 95 | 96 | #endregion 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Path/LineElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Numerics; 32 | using System.Text; 33 | using System.Text.RegularExpressions; 34 | using CompositionProToolkit.Win2d.Common; 35 | using CompositionProToolkit.Win2d.Core; 36 | using Microsoft.Graphics.Canvas.Geometry; 37 | 38 | namespace CompositionProToolkit.Win2d.Geometry.Path 39 | { 40 | /// 41 | /// Class representing the Line Element in a Path Geometry 42 | /// 43 | internal class LineElement : AbstractPathElement 44 | { 45 | #region Fields 46 | 47 | private float _x; 48 | private float _y; 49 | 50 | #endregion 51 | 52 | #region Construction / Initialization 53 | 54 | /// 55 | /// ctor 56 | /// 57 | public LineElement() 58 | { 59 | _x = _y = 0; 60 | } 61 | 62 | #endregion 63 | 64 | #region APIs 65 | 66 | /// 67 | /// Adds the Path Element to the Path. 68 | /// 69 | /// CanvasPathBuilder object 70 | /// The last active location in the Path before adding 71 | /// the Path Element 72 | /// The previous PathElement in the Path. 73 | /// For logging purpose. To log the set of CanvasPathBuilder 74 | /// commands, used for creating the CanvasGeometry, in string format. 75 | /// The latest location in the Path after adding the Path Element 76 | public override Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint, 77 | ref ICanvasPathElement lastElement, StringBuilder logger) 78 | { 79 | // Calculate coordinates 80 | var point = new Vector2(_x, _y); 81 | if (IsRelative) 82 | { 83 | point += currentPoint; 84 | } 85 | 86 | // Execute command 87 | pathBuilder.AddLine(point); 88 | 89 | // Log command 90 | logger?.AppendLine($"{Indent}pathBuilder.AddLine(new Vector2({point.X}, {point.Y}));"); 91 | 92 | // Set Last Element 93 | lastElement = this; 94 | // Return current point 95 | return point; 96 | } 97 | 98 | #endregion 99 | 100 | #region Helpers 101 | 102 | /// 103 | /// Get the Regex for extracting Path Element Attributes 104 | /// 105 | /// 106 | protected override Regex GetAttributesRegex() 107 | { 108 | return RegexFactory.GetAttributesRegex(PathElementType.Line); 109 | } 110 | 111 | /// 112 | /// Gets the Path Element Attributes from the Match 113 | /// 114 | /// Match object 115 | protected override void GetAttributes(Match match) 116 | { 117 | Single.TryParse(match.Groups["X"].Value, out _x); 118 | Single.TryParse(match.Groups["Y"].Value, out _y); 119 | } 120 | 121 | #endregion 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Path/VerticalLineElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Numerics; 32 | using System.Text; 33 | using System.Text.RegularExpressions; 34 | using CompositionProToolkit.Win2d.Common; 35 | using CompositionProToolkit.Win2d.Core; 36 | using Microsoft.Graphics.Canvas.Geometry; 37 | 38 | namespace CompositionProToolkit.Win2d.Geometry.Path 39 | { 40 | /// 41 | /// Class representing the Vertical Line Element in a Path Geometry 42 | /// 43 | internal class VerticalLineElement : AbstractPathElement 44 | { 45 | #region Fields 46 | 47 | private float _y; 48 | 49 | #endregion 50 | 51 | #region Construction / Initialization 52 | 53 | /// 54 | /// ctor 55 | /// 56 | public VerticalLineElement() 57 | { 58 | _y = 0; 59 | } 60 | 61 | #endregion 62 | 63 | #region APIs 64 | 65 | /// 66 | /// Adds the Path Element to the Path. 67 | /// 68 | /// CanvasPathBuilder object 69 | /// The last active location in the Path before adding 70 | /// the Path Element 71 | /// The previous PathElement in the Path. 72 | /// For logging purpose. To log the set of CanvasPathBuilder 73 | /// commands, used for creating the CanvasGeometry, in string format. 74 | /// The latest location in the Path after adding the Path Element 75 | public override Vector2 CreatePath(CanvasPathBuilder pathBuilder, Vector2 currentPoint, 76 | ref ICanvasPathElement lastElement, StringBuilder logger) 77 | { 78 | // Calculate coordinates 79 | var point = IsRelative ? 80 | new Vector2(currentPoint.X, currentPoint.Y + _y) : new Vector2(currentPoint.X, _y); 81 | 82 | // Execute command 83 | pathBuilder.AddLine(point); 84 | 85 | // Log command 86 | logger?.AppendLine($"{Indent}pathBuilder.AddLine(new Vector2({point.X}, {point.Y}));"); 87 | 88 | // Set Last Element 89 | lastElement = this; 90 | // Return current point 91 | return point; 92 | } 93 | 94 | #endregion 95 | 96 | #region Helpers 97 | 98 | /// 99 | /// Get the Regex for extracting Path Element Attributes 100 | /// 101 | /// 102 | protected override Regex GetAttributesRegex() 103 | { 104 | return RegexFactory.GetAttributesRegex(PathElementType.VerticalLine); 105 | } 106 | 107 | /// 108 | /// Gets the Path Element Attributes from the Match 109 | /// 110 | /// Match object 111 | protected override void GetAttributes(Match match) 112 | { 113 | Single.TryParse(match.Groups["Y"].Value, out _y); 114 | } 115 | 116 | #endregion 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Stroke/AbstractCanvasStrokeElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Text.RegularExpressions; 32 | using CompositionProToolkit.Win2d; 33 | using CompositionProToolkit.Win2d.Core; 34 | using CompositionProToolkit.Win2d.Geometry.Stroke; 35 | using Microsoft.Graphics.Canvas; 36 | 37 | namespace CompositionProToolkit.Win2d.Geometry.Stroke 38 | { 39 | /// 40 | /// Abstract base class for Stroke Element 41 | /// 42 | internal abstract class AbstractCanvasStrokeElement : ICanvasStrokeElement 43 | { 44 | #region Properties 45 | 46 | /// 47 | /// Gets the Stroke data defining the Brush Element 48 | /// 49 | public string Data { get; protected set; } 50 | /// 51 | /// Gets the number of non-whitespace characters in 52 | /// the Stroke Data 53 | /// 54 | public int ValidationCount { get; protected set; } 55 | 56 | #endregion 57 | 58 | #region APIs 59 | 60 | /// 61 | /// Initializes the Stroke Element with the given Capture 62 | /// 63 | /// Match object 64 | public virtual void Initialize(Match match) 65 | { 66 | Data = match.Value; 67 | 68 | if (!match.Success) 69 | { 70 | return; 71 | } 72 | 73 | GetAttributes(match); 74 | 75 | // Update the validation count 76 | Validate(); 77 | } 78 | 79 | /// 80 | /// Gets the number of non-whitespace characters in the data 81 | /// 82 | protected virtual void Validate() 83 | { 84 | ValidationCount = RegexFactory.ValidationRegex.Replace(Data, String.Empty).Length; 85 | } 86 | 87 | /// 88 | /// Creates the ICanvasStroke from the parsed data 89 | /// 90 | /// ICanvasStroke 91 | public abstract ICanvasStroke CreateStroke(ICanvasResourceCreator resourceCreator); 92 | 93 | #endregion 94 | 95 | #region Helpers 96 | 97 | /// 98 | /// Gets the Stroke Element Attributes from the Match 99 | /// 100 | /// Match object 101 | protected abstract void GetAttributes(Match match); 102 | 103 | #endregion 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Stroke/ICanvasStrokeElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Text.RegularExpressions; 31 | using Microsoft.Graphics.Canvas; 32 | 33 | namespace CompositionProToolkit.Win2d.Geometry.Stroke 34 | { 35 | /// 36 | /// Interface for Stroke Element 37 | /// 38 | internal interface ICanvasStrokeElement 39 | { 40 | #region Properties 41 | 42 | /// 43 | /// Gets the Stroke data defining the Brush Element 44 | /// 45 | string Data { get; } 46 | /// 47 | /// Gets the number of non-whitespace characters in 48 | /// the Stroke Data 49 | /// 50 | int ValidationCount { get; } 51 | 52 | #endregion 53 | 54 | #region APIs 55 | 56 | /// 57 | /// Initializes the Stroke Element with the given Capture 58 | /// 59 | /// Match object 60 | void Initialize(Match match); 61 | 62 | /// 63 | /// Creates the ICanvasStroke from the parsed data 64 | /// 65 | /// ICanvasStroke 66 | ICanvasStroke CreateStroke(ICanvasResourceCreator resourceCreator); 67 | 68 | #endregion 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Geometry/Stroke/ICanvasStrokeStyleElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Text.RegularExpressions; 31 | using Microsoft.Graphics.Canvas.Geometry; 32 | 33 | namespace CompositionProToolkit.Win2d.Geometry.Stroke 34 | { 35 | /// 36 | /// Interface for the CanvasStrokeStyle Element 37 | /// 38 | internal interface ICanvasStrokeStyleElement 39 | { 40 | #region Properties 41 | 42 | /// 43 | /// Gets the Stroke data defining the Brush Element 44 | /// 45 | string Data { get; } 46 | /// 47 | /// Gets the number of non-whitespace characters in 48 | /// the Stroke Data 49 | /// 50 | int ValidationCount { get; } 51 | /// 52 | /// Gets the CanvasStrokeStyle obtained by parsing 53 | /// the style data. 54 | /// 55 | CanvasStrokeStyle Style { get; } 56 | 57 | #endregion 58 | 59 | #region APIs 60 | 61 | /// 62 | /// Initializes the Stroke Element with the given Capture 63 | /// 64 | /// Match object 65 | void Initialize(Match match); 66 | 67 | #endregion 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/ICanvasRenderLayer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using Microsoft.Graphics.Canvas.Brushes; 31 | using Microsoft.Graphics.Canvas.Geometry; 32 | 33 | namespace CompositionProToolkit.Win2d 34 | { 35 | /// 36 | /// Interface for CanvasRenderLayer 37 | /// 38 | public interface ICanvasRenderLayer 39 | { 40 | #region Properties 41 | 42 | /// 43 | /// Gets the CanvasGeometry to be rendered on 44 | /// this layer. 45 | /// 46 | CanvasGeometry Geometry { get; } 47 | /// 48 | /// Gets the ICanvasBrush used to fill the 49 | /// rendered geometry. 50 | /// 51 | ICanvasBrush Brush { get; } 52 | /// 53 | /// Gets the ICanvasStroke used to outline the 54 | /// rendered geometry. 55 | /// 56 | ICanvasStroke Stroke { get; } 57 | 58 | #endregion 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/ICanvasStroke.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System.Numerics; 31 | using Microsoft.Graphics.Canvas.Brushes; 32 | using Microsoft.Graphics.Canvas.Geometry; 33 | 34 | namespace CompositionProToolkit.Win2d 35 | { 36 | /// 37 | /// Interface to represent the Stroke which 38 | /// can be used to render an outline on a CanvasGeometry 39 | /// 40 | public interface ICanvasStroke 41 | { 42 | /// 43 | /// Gets or sets the brush with which the stroke will be rendered 44 | /// 45 | ICanvasBrush Brush { get; set; } 46 | 47 | /// 48 | /// Gets or sets the width of the stroke 49 | /// 50 | float Width { get; set; } 51 | 52 | /// 53 | /// Gets or sets the Style of the stroke 54 | /// 55 | CanvasStrokeStyle Style { get; set; } 56 | 57 | /// 58 | /// Gets or sets transform matrix of the Stroke brush. 59 | /// 60 | Matrix3x2 Transform { get; set; } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /CompositionProToolkit/Win2d/Parsers/CanvasStrokeStyleParser.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Text.RegularExpressions; 32 | using CompositionProToolkit.Win2d.Core; 33 | using CompositionProToolkit.Win2d.Geometry.Stroke; 34 | using Microsoft.Graphics.Canvas.Geometry; 35 | 36 | namespace CompositionProToolkit.Win2d.Parsers 37 | { 38 | /// 39 | /// Parser for the CanvasStrokeStyle 40 | /// 41 | internal static class CanvasStrokeStyleParser 42 | { 43 | /// 44 | /// Parses the given style data and converts it to CanvasStrokeStyle 45 | /// 46 | /// Style data 47 | /// CanvasStrokeStyle 48 | internal static CanvasStrokeStyle Parse(string styleData) 49 | { 50 | var matches = RegexFactory.CanvasStrokeStyleRegex.Matches(styleData); 51 | // If no match is found or no captures in the match, then it means 52 | // that the style data is invalid. 53 | if ((matches == null) || (matches.Count == 0)) 54 | { 55 | throw new ArgumentException($"Invalid CanvasStrokeStyle data!\nCanvasStrokeStyle Data: {styleData}", nameof(styleData)); 56 | } 57 | 58 | // If the match contains more than one captures, it means that there 59 | // are multiple CanvasStrokeStyles present in the CanvasStrokeStyle data. There should 60 | // be only one CanvasStrokeStyle defined in the CanvasStrokeStyle data. 61 | if (matches.Count > 1) 62 | { 63 | throw new ArgumentException("Multiple CanvasStrokeStyles defined in CanvasStrokeStyle Data! " + 64 | "There should be only one CanvasStrokeStyle definition within the CanvasStrokeStyle Data. " + 65 | "You can either remove CanvasStrokeStyle definitions or split the CanvasStrokeStyle Data " + 66 | "into multiple CanvasStrokeStyle Data and call the CanvasObject.CreateStrokeStyle() method on each of them." + 67 | $"\nCanvasStrokeStyle Data: {styleData}"); 68 | } 69 | 70 | // There should be only one match 71 | var match = matches[0]; 72 | var styleElement = new CanvasStrokeStyleElement(match); 73 | 74 | // Perform validation to check if there are any invalid characters in the brush data that were not captured 75 | var preValidationCount = RegexFactory.ValidationRegex.Replace(styleData, string.Empty).Length; 76 | 77 | var postValidationCount = styleElement.ValidationCount; 78 | 79 | if (preValidationCount != postValidationCount) 80 | { 81 | throw new ArgumentException($"CanvasStrokeStyle data contains invalid characters!\nCanvasStrokeStyle Data: {styleData}", nameof(styleData)); 82 | } 83 | 84 | return styleElement.Style; 85 | } 86 | 87 | /// 88 | /// Parses and constructs a ICanvasStrokeStyleElement from the 89 | /// specified Match object. 90 | /// 91 | /// Match object 92 | /// ICanvasStrokeStyleElement 93 | internal static ICanvasStrokeStyleElement Parse(Match match) 94 | { 95 | return new CanvasStrokeStyleElement(match); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /CompositionProToolkit_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/CompositionProToolkit_logo.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | 4 | Copyright (c) 2018 Ratish Philip 5 | 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. 26 | -------------------------------------------------------------------------------- /ToolkitGallery/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | #ffffff 8 | #fffffa 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ToolkitGallery/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Windows.ApplicationModel; 3 | using Windows.ApplicationModel.Activation; 4 | using Windows.UI.Xaml; 5 | using Windows.UI.Xaml.Controls; 6 | using Windows.UI.Xaml.Navigation; 7 | using ToolkitGallery.Views; 8 | 9 | namespace ToolkitGallery 10 | { 11 | /// 12 | /// Provides application-specific behavior to supplement the default Application class. 13 | /// 14 | sealed partial class App : Application 15 | { 16 | /// 17 | /// Initializes the singleton application object. This is the first line of authored code 18 | /// executed, and as such is the logical equivalent of main() or WinMain(). 19 | /// 20 | public App() 21 | { 22 | this.InitializeComponent(); 23 | this.Suspending += OnSuspending; 24 | } 25 | 26 | /// 27 | /// Invoked when the application is launched normally by the end user. Other entry points 28 | /// will be used such as when the application is launched to open a specific file. 29 | /// 30 | /// Details about the launch request and process. 31 | protected override void OnLaunched(LaunchActivatedEventArgs e) 32 | { 33 | Frame rootFrame = Window.Current.Content as Frame; 34 | 35 | // Do not repeat app initialization when the Window already has content, 36 | // just ensure that the window is active 37 | if (rootFrame == null) 38 | { 39 | // Create a Frame to act as the navigation context and navigate to the first page 40 | rootFrame = new Frame(); 41 | 42 | rootFrame.NavigationFailed += OnNavigationFailed; 43 | 44 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 45 | { 46 | //TODO: Load state from previously suspended application 47 | } 48 | 49 | // Place the frame in the current Window 50 | Window.Current.Content = rootFrame; 51 | } 52 | 53 | if (e.PrelaunchActivated == false) 54 | { 55 | if (rootFrame.Content == null) 56 | { 57 | // When the navigation stack isn't restored navigate to the first page, 58 | // configuring the new page by passing required information as a navigation 59 | // parameter 60 | rootFrame.Navigate(typeof(LaunchPage), e.Arguments); 61 | } 62 | // Ensure the current window is active 63 | Window.Current.Activate(); 64 | } 65 | } 66 | 67 | /// 68 | /// Invoked when Navigation to a certain page fails 69 | /// 70 | /// The Frame which failed navigation 71 | /// Details about the navigation failure 72 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e) 73 | { 74 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName); 75 | } 76 | 77 | /// 78 | /// Invoked when application execution is being suspended. Application state is saved 79 | /// without knowing whether the application will be terminated or resumed with the contents 80 | /// of memory still intact. 81 | /// 82 | /// The source of the suspend request. 83 | /// Details about the suspend request. 84 | private void OnSuspending(object sender, SuspendingEventArgs e) 85 | { 86 | var deferral = e.SuspendingOperation.GetDeferral(); 87 | //TODO: Save application state and stop any background activity 88 | deferral.Complete(); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Alienist.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Alienist.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Autumn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Autumn.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Car.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Cat.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/ColorWheel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/ColorWheel.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Flower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Flower.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Flowers_Wide.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Flowers_Wide.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/HaltAndCatchFire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/HaltAndCatchFire.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image1.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image2.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image3.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image4.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image5.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image6.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image7.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image8.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/Image9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/Image9.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/RainbowRose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/RainbowRose.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/p1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/p1.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/p2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/p2.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/p3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/p3.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/p4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/p4.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/p5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/p5.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/p6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/p6.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Images/seascape.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Images/seascape.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/StoreLogo.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /ToolkitGallery/Assets/Win10_Land.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ratishphilip/CompositionProToolkit/66126a5fd284bdd2bb3a661674a5c524dfff4721/ToolkitGallery/Assets/Win10_Land.jpg -------------------------------------------------------------------------------- /ToolkitGallery/Controls/FluidItemControl.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 19 | 22 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ToolkitGallery/Controls/FluidItemControl.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using Windows.UI; 31 | using Windows.UI.Xaml; 32 | using Windows.UI.Xaml.Controls; 33 | using Windows.UI.Xaml.Media; 34 | 35 | // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 36 | 37 | namespace ToolkitGallery.Controls 38 | { 39 | public sealed partial class FluidItemControl : UserControl 40 | { 41 | #region Fill 42 | 43 | /// 44 | /// Fill Dependency Property 45 | /// 46 | public static readonly DependencyProperty FillProperty = 47 | DependencyProperty.Register("Fill", typeof(Brush), typeof(FluidItemControl), 48 | new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); 49 | 50 | /// 51 | /// Gets or sets the Fill property. This dependency property 52 | /// indicates the fill color of the inner content. 53 | /// 54 | public Brush Fill 55 | { 56 | get { return (Brush)GetValue(FillProperty); } 57 | set { SetValue(FillProperty, value); } 58 | } 59 | 60 | #endregion 61 | 62 | #region Data 63 | 64 | /// 65 | /// Data Dependency Property 66 | /// 67 | public static readonly DependencyProperty DataProperty = 68 | DependencyProperty.Register("Data", typeof(string), typeof(FluidItemControl), 69 | new PropertyMetadata(string.Empty)); 70 | 71 | /// 72 | /// Gets or sets the Data property. This dependency property 73 | /// indicates the data to be displayed. 74 | /// 75 | public string Data 76 | { 77 | get { return (string)GetValue(DataProperty); } 78 | set { SetValue(DataProperty, value); } 79 | } 80 | 81 | #endregion 82 | 83 | public FluidItemControl() 84 | { 85 | this.InitializeComponent(); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /ToolkitGallery/Controls/GlyphIcon.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ToolkitGallery/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | TokenGallery 18 | Ratish 19 | Assets\StoreLogo.png 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ToolkitGallery/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TokenGallery")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TokenGallery")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /ToolkitGallery/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/CanvasElementPage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 30 | 31 | 32 | 33 | Layer 1 34 | 40 | 41 | 42 | Layer 2 43 | 49 | 50 | 51 | Layer 3 52 | 58 | 59 | 60 | Layer 4 61 | 67 | 68 | 69 | Layer 5 70 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/ColorShadowPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Collections.Generic; 32 | using System.Linq; 33 | using Windows.UI; 34 | using Windows.UI.Xaml; 35 | using Windows.UI.Xaml.Controls; 36 | using Windows.UI.Xaml.Controls.Primitives; 37 | 38 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 39 | 40 | namespace ToolkitGallery.Views 41 | { 42 | /// 43 | /// An empty page that can be used on its own or navigated to within a Frame. 44 | /// 45 | public sealed partial class ColorShadowPage : Page 46 | { 47 | private Dictionary _images; 48 | private Dictionary _shadowColors; 49 | 50 | public ColorShadowPage() 51 | { 52 | this.InitializeComponent(); 53 | _images = new Dictionary 54 | { 55 | {"Image1", new Uri("ms-appx:///Assets/Images/RainbowRose.png")}, 56 | {"Image2", new Uri("ms-appx:///Assets/Images/Flower.png")}, 57 | {"Image3", new Uri("ms-appx:///Assets/Images/Autumn.jpg")}, 58 | {"Image4", new Uri("ms-appx:///Assets/Images/ColorWheel.png")}, 59 | {"Image5", new Uri("ms-appx:///Assets/Images/HaltAndCatchFire.png")}, 60 | {"Image6", new Uri("ms-appx:///Assets/Images/Flowers_Wide.jpg")}, 61 | {"Image7", new Uri("ms-appx:///Assets/Images/Alienist.jpg")}, 62 | }; 63 | 64 | ImageList.ItemsSource = _images.Keys.ToList(); 65 | 66 | _shadowColors = new Dictionary 67 | { 68 | {"Black", Colors.Black}, 69 | {"Gray", Colors.Gray}, 70 | {"Yellow", Colors.Yellow}, 71 | {"Blue", Colors.SlateBlue}, 72 | {"Magenta", Colors.Magenta}, 73 | {"Red", Colors.Red}, 74 | }; 75 | 76 | ShadowColorList.ItemsSource = _shadowColors.Keys.ToList(); 77 | } 78 | 79 | private void OnImageSelected(object sender, SelectionChangedEventArgs e) 80 | { 81 | var selValue = ImageList.SelectedValue as string; 82 | if (!String.IsNullOrWhiteSpace(selValue) && _images.ContainsKey(selValue)) 83 | { 84 | ColorShadowCtrl.ImageUri = _images[selValue]; 85 | } 86 | } 87 | 88 | private void ColorShadowPaddingValueChanged(object sender, RangeBaseValueChangedEventArgs e) 89 | { 90 | var padding = CSPaddingSlider?.Value ?? 0; 91 | ColorShadowCtrl.ColorShadowPadding = new Thickness(padding); 92 | } 93 | 94 | private void ColorMaskPaddingValueChanged(object sender, RangeBaseValueChangedEventArgs e) 95 | { 96 | ColorShadowCtrl.ColorMaskPadding = new Thickness(MaskPaddingSlider?.Value ?? 0); 97 | } 98 | 99 | private void OnShadowToggled(object sender, RoutedEventArgs e) 100 | { 101 | ShadowStack.Visibility = ShadowSwitch.IsOn ? Visibility.Visible : Visibility.Collapsed; 102 | } 103 | 104 | private void OnShadowColorChanged(object sender, SelectionChangedEventArgs e) 105 | { 106 | var selColor = ShadowColorList.SelectedValue as string; 107 | 108 | if (!String.IsNullOrWhiteSpace(selColor) && _shadowColors.ContainsKey(selColor)) 109 | { 110 | ColorShadowCtrl.ShadowColor = _shadowColors[selColor]; 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/CompositionGeometricClipPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 14 | 20 | Click (Tap) and drag to start animation, release to stop animation. 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/FluidBannerPage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/FluidBannerPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Collections.Generic; 32 | using System.Linq; 33 | using System.Net.Http; 34 | using System.Threading.Tasks; 35 | using System.Xml.Linq; 36 | using Windows.UI.Xaml; 37 | using Windows.UI.Xaml.Controls; 38 | 39 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 40 | 41 | namespace ToolkitGallery.Views 42 | { 43 | /// 44 | /// An empty page that can be used on its own or navigated to within a Frame. 45 | /// 46 | public sealed partial class FluidBannerPage : Page 47 | { 48 | public FluidBannerPage() 49 | { 50 | this.InitializeComponent(); 51 | 52 | Loaded += OnLoaded; 53 | Banner.ItemsLoading += Banner_ItemsLoading; 54 | Banner.ItemsLoaded += Banner_ItemsLoaded; 55 | } 56 | 57 | private void Banner_ItemsLoading(object sender, EventArgs e) 58 | { 59 | LoadingIndicator.Visibility = Visibility.Visible; 60 | } 61 | 62 | private void Banner_ItemsLoaded(object sender, EventArgs e) 63 | { 64 | LoadingIndicator.Visibility = Visibility.Collapsed; 65 | } 66 | 67 | private async void OnLoaded(object sender, RoutedEventArgs e) 68 | { 69 | var itemCount = 10; 70 | 71 | var items = new List(); 72 | var urls = (await GetUrls()).Take(itemCount).ToList(); 73 | for (var i = 0; i < itemCount; i++) 74 | { 75 | //items.Add(new Uri($"ms-appx:///Assets/Images/Image{i + 1}.jpg")); 76 | items.Add(new Uri(urls.ElementAt(i))); 77 | } 78 | 79 | Banner.ItemsSource = items; 80 | } 81 | 82 | private static async Task> GetUrls() 83 | { 84 | string xml; 85 | 86 | using (var client = new HttpClient()) 87 | { 88 | xml = await client.GetStringAsync("http://trailers.apple.com/trailers/home/xml/current.xml"); 89 | } 90 | 91 | xml = xml.Replace("\u001f", ""); 92 | 93 | var result = new List(); 94 | try 95 | { 96 | var xDoc = XDocument.Parse(xml); 97 | if (xDoc == null) 98 | return result; 99 | var movieInfos = xDoc.Root.Elements("movieinfo"); 100 | result.AddRange(from info in movieInfos 101 | select info.Element("poster") 102 | into poster 103 | where poster != null 104 | select poster.Element("xlarge").Value); 105 | 106 | return result; 107 | } 108 | catch (Exception) 109 | { 110 | 111 | throw; 112 | } 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/FluidProgressRingPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/FluidProgressRingPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using Windows.UI.Xaml.Controls; 31 | 32 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 33 | 34 | namespace ToolkitGallery.Views 35 | { 36 | /// 37 | /// An empty page that can be used on its own or navigated to within a Frame. 38 | /// 39 | public sealed partial class FluidProgressRingPage : Page 40 | { 41 | public FluidProgressRingPage() 42 | { 43 | this.InitializeComponent(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/FluidToggleSwitchPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using Windows.UI.Xaml.Controls; 31 | 32 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 33 | 34 | namespace ToolkitGallery.Views 35 | { 36 | /// 37 | /// An empty page that can be used on its own or navigated to within a Frame. 38 | /// 39 | public sealed partial class FluidToggleSwitchPage : Page 40 | { 41 | public FluidToggleSwitchPage() 42 | { 43 | this.InitializeComponent(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/FluidWrapPanelPage.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 17 | 23 | 24 | 28 | 32 | 40 | 47 | 53 | 48 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/ProfileControlPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Ratish Philip 2 | // 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | // SOFTWARE. 23 | // 24 | // This file is part of the CompositionProToolkit project: 25 | // https://github.com/ratishphilip/CompositionProToolkit 26 | // 27 | // CompositionProToolkit v1.0.1 28 | // 29 | 30 | using System; 31 | using System.Collections.Generic; 32 | using Windows.UI.Xaml; 33 | using Windows.UI.Xaml.Controls; 34 | 35 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 36 | 37 | namespace ToolkitGallery.Views 38 | { 39 | /// 40 | /// An empty page that can be used on its own or navigated to within a Frame. 41 | /// 42 | public sealed partial class ProfileControlPage : Page 43 | { 44 | private readonly List _profiles; 45 | private int currentIndex; 46 | private int totalProfiles; 47 | public ProfileControlPage() 48 | { 49 | InitializeComponent(); 50 | _profiles = new List 51 | { 52 | new Uri("ms-appx:///Assets/Images/p1.jpg"), 53 | new Uri("ms-appx:///Assets/Images/p2.jpg"), 54 | new Uri("ms-appx:///Assets/Images/p3.jpg"), 55 | new Uri("ms-appx:///Assets/Images/p4.jpg"), 56 | new Uri("ms-appx:///Assets/Images/p5.jpg"), 57 | new Uri("ms-appx:///Assets/Images/p6.jpg") 58 | }; 59 | currentIndex = 0; 60 | totalProfiles = _profiles.Count; 61 | 62 | Loaded += OnLoaded; 63 | } 64 | 65 | private void OnLoaded(object sender, RoutedEventArgs e) 66 | { 67 | profile.Source = _profiles[currentIndex]; 68 | } 69 | 70 | private void OnPreviousProfile(object sender, RoutedEventArgs e) 71 | { 72 | currentIndex = (--currentIndex + totalProfiles) % totalProfiles; 73 | profile.Source = _profiles[currentIndex]; 74 | } 75 | 76 | private void OnNextProfile(object sender, RoutedEventArgs e) 77 | { 78 | currentIndex = (++currentIndex) % totalProfiles; 79 | profile.Source = _profiles[currentIndex]; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /ToolkitGallery/Views/ProgressRing3dPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 24 |