Permalink
Fetching contributors…
Cannot retrieve contributors at this time
285 lines (220 sloc) 9.77 KB
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="GeoOvwSample.GeometryExamples"
WindowTitle="Geometry Overview Samples">
<ScrollViewer>
<StackPanel Name="MainStackPanel">
<Border Style="{StaticResource GraphBorderStyle}" HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMLineGeometryExample> -->
<Path Stroke="Black" StrokeThickness="1" >
<Path.Data>
<LineGeometry StartPoint="10,20" EndPoint="100,130" />
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMLineGeometryExample> -->
</Border>
<Border Style="{StaticResource GraphBorderStyle}"
HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMEllipseGeometryExample> -->
<Path Fill="Gold" Stroke="Black" StrokeThickness="1">
<Path.Data>
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50" />
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMEllipseGeometryExample> -->
</Border>
<Border Style="{StaticResource GraphBorderStyle}"
HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMRectangleGeometryExample> -->
<Path Fill="LemonChiffon" Stroke="Black" StrokeThickness="1">
<Path.Data>
<RectangleGeometry Rect="50,50,25,25" />
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMRectangleGeometryExample> -->
</Border>
<Grid HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Margin="10,0,0,0">Without Clipping</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" Margin="10,0,0,0">Clipped</TextBlock>
<Border Grid.Column="0" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}"
HorizontalAlignment="Left" Width="200" Height="150">
<Image
Source="sampleImages\Waterlilies.jpg"
Width="200" Height="150" HorizontalAlignment="Left">
</Image>
</Border>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}"
HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMImageClipGeometryExample> -->
<Image
Source="sampleImages\Waterlilies.jpg"
Width="200" Height="150" HorizontalAlignment="Left">
<Image.Clip>
<EllipseGeometry
RadiusX="100"
RadiusY="75"
Center="100,75"/>
</Image.Clip>
</Image>
<!-- </SnippetGraphicsMMImageClipGeometryExample> -->
</Border>
</Grid>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}"
HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMPathGeometryLineExample> -->
<Path Stroke="Black" StrokeThickness="1">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="10,20">
<PathFigure.Segments>
<LineSegment Point="100,130"/>
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMPathGeometryLineExample> -->
</Border>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}"
HorizontalAlignment="Left" Width="450" Height="250">
<!-- <SnippetGraphicsMMPathGeometryComplexExample> -->
<Path Stroke="Black" StrokeThickness="1" >
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="10,50">
<PathFigure.Segments>
<BezierSegment
Point1="100,0"
Point2="200,200"
Point3="300,100"/>
<LineSegment Point="400,100" />
<ArcSegment
Size="50,50" RotationAngle="45"
IsLargeArc="True" SweepDirection="Clockwise"
Point="200,100"/>
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMPathGeometryComplexExample> -->
</Border>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}"
HorizontalAlignment="Left" Width="450" Height="250">
<!-- <SnippetGraphicsMMPathGeometryComplexMultiExample> -->
<Path Stroke="Black" StrokeThickness="1" >
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="10,50">
<PathFigure.Segments>
<BezierSegment
Point1="100,0"
Point2="200,200"
Point3="300,100"/>
<LineSegment Point="400,100" />
<ArcSegment
Size="50,50" RotationAngle="45"
IsLargeArc="True" SweepDirection="Clockwise"
Point="200,100"/>
</PathFigure.Segments>
</PathFigure>
<PathFigure StartPoint="10,100">
<PathFigure.Segments>
<PolyLineSegment Points="50,100 50,150" />
<QuadraticBezierSegment Point1="200,200" Point2="300,100"/>
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMPathGeometryComplexMultiExample> -->
</Border>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}" HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMCompositeGeometryUnionExample> -->
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Combines two geometries using the exclude combine mode. -->
<CombinedGeometry GeometryCombineMode="Union">
<CombinedGeometry.Geometry1>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="75,75" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="125,75" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMCompositeGeometryUnionExample> -->
</Border>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}" HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMCompositeGeometryXorExample> -->
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Combines two geometries using the exclude combine mode. -->
<CombinedGeometry GeometryCombineMode="Xor">
<CombinedGeometry.Geometry1>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="75,75" />
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="125,75" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMCompositeGeometryXorExample> -->
</Border>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}" HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMFillRuleNonZeroExample> -->
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Creates a composite shape from three geometries. -->
<GeometryGroup FillRule="NonZero">
<LineGeometry StartPoint="10,10" EndPoint="50,30" />
<EllipseGeometry Center="40,70" RadiusX="30" RadiusY="30" />
<RectangleGeometry Rect="30,55 100 30" />
</GeometryGroup>
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMFillRuleNonZeroExample> -->
</Border>
<Border Grid.Column="1" Grid.Row="1"
Style="{StaticResource GraphBorderStyle}" HorizontalAlignment="Left" Width="200" Height="150">
<!-- <SnippetGraphicsMMFillRuleEvenOddExample> -->
<Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
<Path.Data>
<!-- Creates a composite shape from three geometries. -->
<GeometryGroup FillRule="EvenOdd">
<LineGeometry StartPoint="10,10" EndPoint="50,30" />
<EllipseGeometry Center="40,70" RadiusX="30" RadiusY="30" />
<RectangleGeometry Rect="30,55 100 30" />
</GeometryGroup>
</Path.Data>
</Path>
<!-- </SnippetGraphicsMMFillRuleEvenOddExample> -->
</Border>
</StackPanel>
</ScrollViewer>
</Page>