Skip to content

Commit 44eb3e2

Browse files
Merge pull request #3503 from ratishphilip/feature/win2dparser
Added the Win2d Path Geometry parser.
2 parents 5a8482b + 4bafb55 commit 44eb3e2

File tree

60 files changed

+8713
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+8713
-1
lines changed

Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@
273273
<Content Include="SamplePages\Eyedropper\Eyedropper.png" />
274274
<Content Include="SamplePages\OnDevice\OnDevice.png" />
275275
<Content Include="SamplePages\AcrylicBrush\AcrylicBrush.png" />
276+
<Content Include="SamplePages\CanvasPathGeometry\CanvasPathGeometry.png" />
276277
<Content Include="SamplePages\PipelineBrush\PipelineBrush.png" />
277278
<Content Include="SamplePages\RemoteDeviceHelper\RemoteDeviceHelper.png" />
278279
<Content Include="SamplePages\ImageCropper\ImageCropper.png" />
@@ -485,6 +486,7 @@
485486
<Compile Include="SamplePages\AutoFocusBehavior\AutoFocusBehaviorPage.xaml.cs">
486487
<DependentUpon>AutoFocusBehaviorPage.xaml</DependentUpon>
487488
</Compile>
489+
<Compile Include="SamplePages\CanvasPathGeometry\GeometryStreamReader.cs" />
488490
<Compile Include="SamplePages\ColorPicker\ColorPickerButtonPage.xaml.cs">
489491
<DependentUpon>ColorPickerButtonPage.xaml</DependentUpon>
490492
</Compile>
@@ -494,6 +496,9 @@
494496
<Compile Include="SamplePages\EnumValuesExtension\EnumValuesExtensionPage.xaml.cs">
495497
<DependentUpon>EnumValuesExtensionPage.xaml</DependentUpon>
496498
</Compile>
499+
<Compile Include="SamplePages\CanvasPathGeometry\CanvasPathGeometryPage.xaml.cs">
500+
<DependentUpon>CanvasPathGeometryPage.xaml</DependentUpon>
501+
</Compile>
497502
<Compile Include="SamplePages\FocusBehavior\FocusBehaviorPage.xaml.cs">
498503
<DependentUpon>FocusBehaviorPage.xaml</DependentUpon>
499504
</Compile>
@@ -975,6 +980,10 @@
975980
<Generator>MSBuild:Compile</Generator>
976981
<SubType>Designer</SubType>
977982
</Page>
983+
<Page Include="SamplePages\CanvasPathGeometry\CanvasPathGeometryPage.xaml">
984+
<SubType>Designer</SubType>
985+
<Generator>MSBuild:Compile</Generator>
986+
</Page>
978987
<Page Include="SamplePages\TilesBrush\TilesBrushPage.xaml">
979988
<Generator>MSBuild:Compile</Generator>
980989
<SubType>Designer</SubType>
4.54 KB
Loading
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.CanvasPathGeometryPage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:win2d="using:Microsoft.Graphics.Canvas.UI.Xaml"
7+
mc:Ignorable="d">
8+
9+
<Grid Padding="10">
10+
<Grid.RowDefinitions>
11+
<RowDefinition Height="32" />
12+
<RowDefinition Height="48" />
13+
<RowDefinition Height="0.1*" />
14+
<RowDefinition Height="48" />
15+
<RowDefinition Height="0.9*" />
16+
</Grid.RowDefinitions>
17+
<TextBlock Margin="12,3"
18+
VerticalAlignment="Center"
19+
Text="Samples: " />
20+
<Grid Grid.Row="1">
21+
<Grid.ColumnDefinitions>
22+
<ColumnDefinition Width="*"
23+
MinWidth="145" />
24+
<ColumnDefinition Width="*"
25+
MinWidth="145" />
26+
<ColumnDefinition Width="*"
27+
MinWidth="145" />
28+
<ColumnDefinition Width="*"
29+
MinWidth="145" />
30+
<ColumnDefinition Width="*"
31+
MinWidth="145" />
32+
</Grid.ColumnDefinitions>
33+
<Button Grid.Column="0"
34+
Width="120"
35+
Height="36"
36+
Margin="10,3"
37+
HorizontalAlignment="Center"
38+
Click="{x:Bind OnShowRoundedStarSample}"
39+
Content="Rounded Star" />
40+
<Button Grid.Column="1"
41+
Width="120"
42+
Height="36"
43+
Margin="10,3"
44+
HorizontalAlignment="Center"
45+
Click="{x:Bind OnShowStarSample}"
46+
Content="Star" />
47+
<Button Grid.Column="2"
48+
Width="120"
49+
Height="36"
50+
Margin="10,3"
51+
HorizontalAlignment="Center"
52+
Click="{x:Bind OnShowSpiralSample}"
53+
Content="Spiral" />
54+
<Button Grid.Column="3"
55+
Width="120"
56+
Height="36"
57+
Margin="10,3"
58+
HorizontalAlignment="Center"
59+
Click="{x:Bind OnShowFlowerSample}"
60+
Content="Flower" />
61+
<Button Grid.Column="4"
62+
Width="120"
63+
Height="36"
64+
Margin="10,3"
65+
HorizontalAlignment="Center"
66+
Click="{x:Bind OnShowGearSample}"
67+
Content="Gear" />
68+
69+
</Grid>
70+
<TextBox x:Name="InputData"
71+
Grid.Row="2"
72+
Margin="10,3"
73+
FontFamily="Courier New"
74+
FontSize="14"
75+
PlaceholderText="Enter SVG/XAML Path Data and press Parse. (Or click on one of the Samples from above)"
76+
ScrollViewer.VerticalScrollBarVisibility="Auto"
77+
SelectionHighlightColor="#007aff"
78+
Text="{Binding InputText, Mode=TwoWay}"
79+
TextChanged="{x:Bind OnInputTextChanged}"
80+
TextWrapping="Wrap" />
81+
<Button Grid.Row="3"
82+
Width="120"
83+
Height="36"
84+
Margin="10,3"
85+
HorizontalAlignment="Left"
86+
Click="{x:Bind OnClearCanvas}"
87+
Content="Clear" />
88+
<Pivot x:Name="RootPivot"
89+
Grid.Row="4">
90+
<PivotItem Foreground="Black"
91+
Header="Canvas">
92+
<ScrollViewer x:Name="RenderScroll"
93+
HorizontalScrollBarVisibility="Auto"
94+
VerticalScrollBarVisibility="Auto">
95+
<win2d:CanvasControl x:Name="RenderCanvas"
96+
Width="{Binding ElementName=RenderScroll, Path=ActualWidth}"
97+
Height="{Binding ElementName=RenderScroll, Path=ActualHeight}"
98+
MinWidth="1200"
99+
MinHeight="800"
100+
HorizontalAlignment="Stretch"
101+
VerticalAlignment="Stretch"
102+
HorizontalContentAlignment="Stretch"
103+
VerticalContentAlignment="Stretch"
104+
ClearColor="#A7A7A7"
105+
Draw="{x:Bind OnCanvasDraw}" />
106+
</ScrollViewer>
107+
</PivotItem>
108+
<PivotItem Foreground="Black"
109+
Header="Commands">
110+
<ScrollViewer Background="#272727"
111+
HorizontalScrollBarVisibility="Disabled"
112+
VerticalScrollBarVisibility="Auto">
113+
<TextBlock x:Name="CommandsList"
114+
Padding="10"
115+
FontFamily="Courier New"
116+
FontSize="16"
117+
Foreground="White"
118+
IsTextSelectionEnabled="True"
119+
SelectionHighlightColor="#007aff"
120+
TextWrapping="Wrap" />
121+
</ScrollViewer>
122+
</PivotItem>
123+
</Pivot>
124+
<StackPanel Grid.Row="4"
125+
HorizontalAlignment="Right"
126+
VerticalAlignment="Top"
127+
Orientation="Horizontal">
128+
<TextBlock Margin="10,10,5,-10"
129+
Text="StrokeThickness" />
130+
<Slider x:Name="StrokeThickness"
131+
Width="150"
132+
Height="30"
133+
Margin="0,4,10,4"
134+
Background="White"
135+
Foreground="White"
136+
Maximum="10"
137+
Minimum="0"
138+
StepFrequency="0.1"
139+
ValueChanged="{x:Bind OnStrokeThicknessChanged}" />
140+
<TextBlock Margin="10,10,5,-10"
141+
Text="Stroke Color: " />
142+
<ComboBox x:Name="StrokeList"
143+
Width="150"
144+
Height="30"
145+
Margin="0,4,10,4"
146+
SelectionChanged="{x:Bind OnStrokeColorChanged}" />
147+
<TextBlock Margin="10,10,5,-10"
148+
Text="Fill Color: " />
149+
<ComboBox x:Name="FillList"
150+
Width="150"
151+
Height="30"
152+
Margin="0,4,10,4"
153+
SelectionChanged="{x:Bind OnFillColorChanged}" />
154+
</StackPanel>
155+
</Grid>
156+
</Page>

0 commit comments

Comments
 (0)