Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the Render surfaces and their XAML brushes. (Ported from CompositionProToolkit) #4115

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8b58b43
merged from features/win2dparser
ratishphilip Sep 26, 2020
a965335
RenderSurface classes - initial commit
ratishphilip Dec 12, 2020
5dfc74f
Merge branch 'feature/win2dparser' into feature/rendersurfaces
ratishphilip Dec 22, 2020
42139a0
Merge branch 'feature/win2dparser' into feature/rendersurfaces
ratishphilip Jan 20, 2021
824a5a5
Code comments updated. Usage of Guard included.
ratishphilip Jan 20, 2021
40aa2b5
Merge branch 'feature/win2dparser' into feature/rendersurfaces
ratishphilip Jan 24, 2021
31633bd
Build error fix for Effects.
ratishphilip Jan 25, 2021
190fbfb
Merge branch 'master' into feature/rendersurfaces
ratishphilip Feb 5, 2021
fe1ff11
RenderSurfaces and basic CanvasGeometry classes for XAML added.
ratishphilip Feb 17, 2021
203a4ca
Merge branch 'master' into feature/rendersurfaces
ratishphilip Feb 17, 2021
eb82549
updated geometries, compositionGenerator
ratishphilip Feb 26, 2021
f998788
Merge branch 'master' into feature/rendersurfaces
ratishphilip Feb 26, 2021
ac5f992
GeometryMaskSurfaceBrush initial commit.
ratishphilip Mar 2, 2021
60d0d68
Merge branch 'master' into feature/rendersurfaces
ratishphilip Mar 2, 2021
8cf0cf5
Updated Brushes
ratishphilip Apr 24, 2021
fca214e
Merge branch 'master' into feature/rendersurfaces
ratishphilip Apr 24, 2021
77d59fd
Merge branch 'master' into feature/rendersurfaces
ratishphilip Jun 5, 2021
5b03b88
Render Surface Brushes added.
ratishphilip Jun 5, 2021
2ec8736
updated namespace to common Microsoft.Toolkit.Uwp.UI.Media. Added mis…
ratishphilip Jun 9, 2021
fc4434d
Initial commit for GeometrySurfaceBrush sample application.
ratishphilip Jun 21, 2021
1cafd80
merged master into feature/rendersurfaces
ratishphilip Jun 26, 2021
098759d
Working GeometrySurfaceBrush sample.
ratishphilip Jul 10, 2021
2008ca4
Merge branch 'master' into feature/rendersurfaces
ratishphilip Jul 10, 2021
979ce76
Created samples for Surface Brushes.
ratishphilip Jul 14, 2021
3ff3f80
Optimized the SurfaceBrushes' rendering.
ratishphilip Jul 15, 2021
ede2246
Code and comments cleanup.
ratishphilip Jul 17, 2021
66f9404
merged master into feature/rendersurfaces.
ratishphilip Jul 17, 2021
2c46da6
cleanup of ImageMaskSurfaceBrush sample.
ratishphilip Jul 17, 2021
03a1270
Updated method headers with proper references.
ratishphilip Jul 18, 2021
cc70ff3
Merge branch 'main' into feature/rendersurfaces
michael-hawker Jul 19, 2021
cc73e9f
Merge branch 'master' into feature/rendersurfaces
ratishphilip Jul 19, 2021
6347212
Merge branch 'feature/rendersurfaces' of https://github.com/ratishphi…
ratishphilip Jul 19, 2021
7b37780
Merge branch 'master' into feature/rendersurfaces
ratishphilip Jul 23, 2021
0f52c29
Merge branch 'master' into feature/rendersurfaces
ratishphilip Jul 24, 2021
5bc4134
updated namespaces. Fixed CanvasPathGeometry file overwrite.
ratishphilip Jul 25, 2021
027b8ce
Changed Dispatcher.RunAsync to DispatcherQueue.GetForCurrentThread().…
ratishphilip Jul 25, 2021
e2d9c41
Merge branch 'main' into feature/rendersurfaces
ratishphilip Aug 15, 2021
4d7bbb8
Merged main branch into feature/rendersurfaces
ratishphilip Aug 15, 2021
ebef5d1
Resolved conflicts.
ratishphilip Aug 15, 2021
4ac882d
updated comments, removed unwanted using.
ratishphilip Sep 6, 2021
76950d8
merged main branch into feature/rendersurfaces branch.
ratishphilip Sep 6, 2021
ca7db91
minor update (comments and bind file)
ratishphilip Sep 9, 2021
8a4610c
Updated the effect name.
ratishphilip Sep 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,16 @@
<Content Include="SamplePages\Animations\Effects\EffectAnimations.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="SamplePages\GeometryMaskSurfaceBrush\GeometryMaskSurfaceBrush.png" />
<Content Include="SamplePages\GeometrySurfaceBrush\GeometrySurfaceBrush.png" />
<Content Include="SamplePages\Graph\LoginButton.png" />
<Content Include="SamplePages\Graph\PeoplePicker.png" />
<Content Include="SamplePages\Graph\PersonView.png" />
<Content Include="SamplePages\ImageMaskSurfaceBrush\ImageMaskSurfaceBrush.png" />
<Content Include="SamplePages\ImageMaskSurfaceBrush\MaskImage1.png" />
<Content Include="SamplePages\ImageMaskSurfaceBrush\MaskImage2.png" />
<Content Include="SamplePages\ImageMaskSurfaceBrush\MaskImage3.png" />
<Content Include="SamplePages\ImageSurfaceBrush\ImageSurfaceBrush.png" />
<Content Include="SamplePages\Primitives\SwitchPresenter.png" />
<Content Include="SamplePages\TabbedCommandBar\TabbedCommandBar.png" />
<Content Include="SamplePages\Animations\Effects\FadeBehavior.png" />
Expand Down Expand Up @@ -507,9 +514,21 @@
<Compile Include="SamplePages\FocusBehavior\FocusBehaviorPage.xaml.cs">
<DependentUpon>FocusBehaviorPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\GeometryMaskSurfaceBrush\GeometryMaskSurfaceBrushPage.xaml.cs">
<DependentUpon>GeometryMaskSurfaceBrushPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\ImageMaskSurfaceBrush\ImageMaskSurfaceBrushPage.xaml.cs">
<DependentUpon>ImageMaskSurfaceBrushPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\ImageSurfaceBrush\ImageSurfaceBrushPage.xaml.cs">
<DependentUpon>ImageSurfaceBrushPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\MetadataControl\MetadataControlPage.xaml.cs">
<DependentUpon>MetadataControlPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\GeometrySurfaceBrush\GeometrySurfaceBrushPage.xaml.cs">
<DependentUpon>GeometrySurfaceBrushPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\TilesBrush\TilesBrushPage.xaml.cs">
<DependentUpon>TilesBrushPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -627,6 +646,10 @@
<Content Include="SamplePages\Graph\PeoplePickerXaml.bind" />
<Content Include="SamplePages\Graph\PersonViewXaml.bind" />
<Content Include="SamplePages\ListViewExtensions\ListViewExtensionsCode.bind" />
<Content Include="SamplePages\GeometrySurfaceBrush\GeometrySurfaceBrushXaml.bind" />
<Content Include="SamplePages\GeometryMaskSurfaceBrush\GeometryMaskSurfaceBrushXaml.bind" />
<Content Include="SamplePages\ImageSurfaceBrush\ImageSurfaceBrushXaml.bind" />
<Content Include="SamplePages\ImageMaskSurfaceBrush\ImageMaskSurfaceBrushXaml.bind" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
Expand Down Expand Up @@ -975,6 +998,18 @@
<Content Include="SamplePages\MetadataControl\MetadataControlCode.bind">
<SubType>Designer</SubType>
</Content>
<Page Include="SamplePages\GeometryMaskSurfaceBrush\GeometryMaskSurfaceBrushPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\ImageMaskSurfaceBrush\ImageMaskSurfaceBrushPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\ImageSurfaceBrush\ImageSurfaceBrushPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\MetadataControl\MetadataControlPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -986,6 +1021,10 @@
<Content Include="SamplePages\Primitives\SwitchPresenter.bind">
<SubType>Designer</SubType>
</Content>
<Page Include="SamplePages\GeometrySurfaceBrush\GeometrySurfaceBrushPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\TilesBrush\TilesBrushPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
297 changes: 152 additions & 145 deletions Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.Graphics.Canvas.UI.Xaml;
using Microsoft.Toolkit.Uwp.UI;
using Microsoft.Toolkit.Uwp.UI.Media.Geometry;
using Microsoft.Toolkit.Uwp.UI.Media;
using Windows.System;
using Windows.UI;
using Windows.UI.Xaml;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.GeometryMaskSurfaceBrushPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
mc:Ignorable="d">

<Grid>
<Grid.Background>
<media:GeometryMaskSurfaceBrush BlurRadius="0"
OffsetX="0"
OffsetY="0"
SurfaceHeight="600"
SurfaceWidth="899.25">
<media:GeometryMaskSurfaceBrush.Target>
<media:ImageSurfaceBrush Source="ms-appx:///Assets/Photos/SpeedTripleAtristsPoint.jpg"
SurfaceHeight="600"
SurfaceWidth="899.25" />
</media:GeometryMaskSurfaceBrush.Target>
<media:GeometryMaskSurfaceBrush.Mask>
<media:CanvasRoundedRectangleGeometry Width="200"
Height="200"
RadiusX="30"
RadiusY="30"/>
</media:GeometryMaskSurfaceBrush.Mask>
</media:GeometryMaskSurfaceBrush>
</Grid.Background>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Windows.UI.Xaml.Controls;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class GeometryMaskSurfaceBrushPage : Page
{
public GeometryMaskSurfaceBrushPage()
{
this.InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
mc:Ignorable="d">

<Grid>
<Grid.Background>
<media:GeometryMaskSurfaceBrush BlurRadius="@[BlurRadius:DoubleSlider:4:0-30]"
OffsetX="@[OffsetX:DoubleSlider:100:0-600]"
OffsetY="@[OffsetY:DoubleSlider:100:0-600]"
SurfaceHeight="600"
SurfaceWidth="899.25">
<media:GeometryMaskSurfaceBrush.Target>
<media:ImageSurfaceBrush Source="ms-appx:///Assets/Photos/SpeedTripleAtristsPoint.jpg"
SurfaceHeight="600"
SurfaceWidth="899.25" />
</media:GeometryMaskSurfaceBrush.Target>
<media:GeometryMaskSurfaceBrush.Mask>
<media:CanvasRoundedRectangleGeometry Width= "@[Width:DoubleSlider:400:100-600]"
Height="@[Height:DoubleSlider:300:100-500]"
RadiusX="@[RadiusX:DoubleSlider:30:0-100]"
RadiusY="@[RadiusY:DoubleSlider:30:0-100]"/>
</media:GeometryMaskSurfaceBrush.Mask>
</media:GeometryMaskSurfaceBrush>
</Grid.Background>
</Grid>
</Page>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.GeometrySurfaceBrushPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
mc:Ignorable="d">

<!-- Shallow Copy -->
<Grid>
<Grid.Background>
<media:GeometrySurfaceBrush x:Name="surfaceBrush"
SurfaceHeight="800"
SurfaceWidth="800"
StrokeThickness="15">
<media:GeometrySurfaceBrush.RenderStrokeStyle>
<media:StrokeStyle />
</media:GeometrySurfaceBrush.RenderStrokeStyle>
<media:GeometrySurfaceBrush.Stroke>
<media:SolidColorCanvasBrush Color="Blue"></media:SolidColorCanvasBrush>
</media:GeometrySurfaceBrush.Stroke>
<media:GeometrySurfaceBrush.FillBrush>
<media:SolidColorCanvasBrush Color="Yellow"></media:SolidColorCanvasBrush>
</media:GeometrySurfaceBrush.FillBrush>
<media:GeometrySurfaceBrush.Geometry>
<media:CanvasCombinedGeometry GeometryCombineMode="Exclude">
<media:CanvasCombinedGeometry.Geometry1>
<media:CanvasPathGeometry Data="F1 M 417.661,109.978 L 508.676,294.396 L 751.683,329.707 L 575.842,501.110 L 610.607,703.805 C 613.366,719.893 596.479,732.162 582.031,724.566 L 400.000,628.867 L 217.969,724.566 C 203.521,732.162 186.634,719.893 189.393,703.805 L 224.158,501.110 L 48.317,329.707 L 291.324,294.396 L 382.339,109.978 C 389.564,95.341 410.436,95.341 417.661,109.978 Z" />
</media:CanvasCombinedGeometry.Geometry1>
<media:CanvasCombinedGeometry.Geometry2>
<media:CanvasRoundedRectangleGeometry x:Name="MaskGeometry2"
Width="200"
Height="200"
RadiusX="30"
RadiusY="30"
X="300"
Y="350" />
</media:CanvasCombinedGeometry.Geometry2>
</media:CanvasCombinedGeometry>
</media:GeometrySurfaceBrush.Geometry>
</media:GeometrySurfaceBrush>
</Grid.Background>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Windows.UI.Xaml.Controls;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class GeometrySurfaceBrushPage : Page
{
public GeometrySurfaceBrushPage()
{
this.InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:media="using:Microsoft.Toolkit.Uwp.UI.Media"
mc:Ignorable="d">

<Grid>
<Grid.Background>
<media:GeometrySurfaceBrush x:Name="surfaceBrush"
SurfaceHeight="800"
SurfaceWidth="800"
StrokeThickness="@[StrokeThickness:DoubleSlider:15:0-100]">
<media:GeometrySurfaceBrush.RenderStrokeStyle>
<media:StrokeStyle />
</media:GeometrySurfaceBrush.RenderStrokeStyle>
<media:GeometrySurfaceBrush.Stroke>
<media:SolidColorCanvasBrush Color="Blue"></media:SolidColorCanvasBrush>
</media:GeometrySurfaceBrush.Stroke>
<media:GeometrySurfaceBrush.FillBrush>
<media:SolidColorCanvasBrush Color="Yellow"></media:SolidColorCanvasBrush>
</media:GeometrySurfaceBrush.FillBrush>
<media:GeometrySurfaceBrush.Geometry>
<media:CanvasCombinedGeometry GeometryCombineMode="Exclude">
<media:CanvasCombinedGeometry.Geometry1>
<media:CanvasPathGeometry Data="F1 M 417.661,109.978 L 508.676,294.396 L 751.683,329.707 L 575.842,501.110 L 610.607,703.805 C 613.366,719.893 596.479,732.162 582.031,724.566 L 400.000,628.867 L 217.969,724.566 C 203.521,732.162 186.634,719.893 189.393,703.805 L 224.158,501.110 L 48.317,329.707 L 291.324,294.396 L 382.339,109.978 C 389.564,95.341 410.436,95.341 417.661,109.978 Z" />
</media:CanvasCombinedGeometry.Geometry1>
<media:CanvasCombinedGeometry.Geometry2>
<media:CanvasRoundedRectangleGeometry x:Name="MaskGeometry2"
Width="200"
Height="200"
RadiusX="@[RadiusX:DoubleSlider:30:10-60]"
RadiusY="@[RadiusY:DoubleSlider:30:10-60]"
X="@[X:DoubleSlider:300:100-500]"
Y="@[Y:DoubleSlider:350:150-550]" />
</media:CanvasCombinedGeometry.Geometry2>
</media:CanvasCombinedGeometry>
</media:GeometrySurfaceBrush.Geometry>
</media:GeometrySurfaceBrush>
</Grid.Background>
</Grid>
</Page>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading