Combines two geometries using the union combine mode

image_pdfimage_print


   
    


<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="Opacity Masking Examples" >

   <Canvas> 
        <Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
          <Path.Data>

            <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>
    </Canvas> 


</Window>

   
    
    
    
     


Combines two geometries using the exclude combine mode

image_pdfimage_print


   
    



<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="  Examples" >

   <Canvas> 
        <Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
          <Path.Data>
            <CombinedGeometry GeometryCombineMode="Exclude">
              <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>

   </Canvas> 


</Window>

   
    
    
    
     


Geometry Used with a DrawingBrush

image_pdfimage_print
   
    
<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="  Examples" >

   <Canvas> 
        <Rectangle Height="200" Width="200" Stroke="Black" StrokeThickness="1"
          HorizontalAlignment="Left">
          <Rectangle.Fill>
            <DrawingBrush Viewbox="0,0,200,200" ViewboxUnits="Absolute">
              <DrawingBrush.Drawing>
                <GeometryDrawing Brush="#CCCCFF">
                  <GeometryDrawing.Pen>
                    <Pen Thickness="1" Brush="Black" />
                  </GeometryDrawing.Pen>
                  <GeometryDrawing.Geometry>
                    <GeometryGroup>
                      <RectangleGeometry Rect="50,5 100,10" />
                      <RectangleGeometry Rect="50,175 100,10" />
                      <PathGeometry>
                        <PathGeometry.Figures>
                          <PathFigureCollection>
                            <PathFigure IsClosed="true" StartPoint="50,50">
                              <PathFigure.Segments>
                                <PathSegmentCollection>
                                  <BezierSegment Point1="175,300" Point2="625,100" Point3="150,50"/>
                                  <BezierSegment Point1="275,300" Point2="725,100" Point3="250,50"/>
                                  <BezierSegment Point1="375,300" Point2="825,100" Point3="350,50"/>
                                  <BezierSegment Point1="475,300" Point2="925,100" Point3="450,50"/>
                                  <BezierSegment Point1="575,300" Point2="125,100" Point3="550,50"/>
                                  <BezierSegment Point1="625,300" Point2="115,100" Point3="50,50"/>
                                </PathSegmentCollection>
                              </PathFigure.Segments>
                            </PathFigure>
                          </PathFigureCollection>
                        </PathGeometry.Figures>
                      </PathGeometry>               
                    </GeometryGroup>                  
                  </GeometryDrawing.Geometry>
                </GeometryDrawing>
              </DrawingBrush.Drawing>
            </DrawingBrush>
          </Rectangle.Fill>
        </Rectangle>
   </Canvas> 


</Window>

   
    
    
    
     


Geometry Used as a Clip

image_pdfimage_print
   
    
<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="  Examples" >

   <Canvas> 
       <Image Source="c:image.jpg" Width="200" Height="200" HorizontalAlignment="Left">
          <Image.Clip>
              <GeometryGroup>
                  <RectangleGeometry Rect="50,5 100,10" />
                  <RectangleGeometry Rect="5,5 95,180" />
                  <PathGeometry>
                    <PathGeometry.Figures>
                      <PathFigureCollection>
                        <PathFigure IsClosed="true" StartPoint="50,50">
                          <PathFigure.Segments>
                            <PathSegmentCollection>
                              <BezierSegment Point1="175,300" Point2="425,300" Point3="120,150"/>
                              <BezierSegment Point1="225,30" Point2="75,140" Point3="450,150"/>
                              <BezierSegment Point1="35,300" Point2="125,150" Point3="150,350"/>
                              <BezierSegment Point1="425,30" Point2="375,170" Point3="250,450"/>
                              <BezierSegment Point1="55,300" Point2="125,180" Point3="150,150"/>
                              <BezierSegment Point1="625,30" Point2="175,130" Point3="150,150"/>
                            </PathSegmentCollection>
                          </PathFigure.Segments>
                        </PathFigure>
                      </PathFigureCollection>
                    </PathGeometry.Figures>
                  </PathGeometry>               
              </GeometryGroup>            
          </Image.Clip>
        </Image>
   </Canvas> 


</Window>

   
    
    
    
     


Tiled Geometry

image_pdfimage_print
   
    
<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="  Examples" >

   <Canvas> 
        <Rectangle Height="200" Width="200" Stroke="Black" StrokeThickness="1"
          HorizontalAlignment="Left">
          <Rectangle.Fill>
            <DrawingBrush Viewbox="0,0,200,200" ViewboxUnits="Absolute" Viewport="0,0,0.5,0.5" TileMode="FlipXY">
              <DrawingBrush.Drawing>
                <GeometryDrawing Brush="#CCCCFF">
                  <GeometryDrawing.Pen>
                    <Pen Thickness="1" Brush="Black" />
                  </GeometryDrawing.Pen>
                  <GeometryDrawing.Geometry>
                    <GeometryGroup>
                      <RectangleGeometry Rect="50,50 195,80" />
                      <EllipseGeometry Center="100, 100" RadiusX="20" RadiusY="30"/>
                      <RectangleGeometry Rect="50,175 100,10" />
                      <PathGeometry>
                        <PathGeometry.Figures>
                          <PathFigureCollection>
                            <PathFigure IsClosed="true" StartPoint="50,50">
                              <PathFigure.Segments>
                                <PathSegmentCollection>
                                  <BezierSegment Point1="75,300" Point2="125,100" Point3="150,50"/>

                                  <BezierSegment Point1="5,700" Point2="225,100" Point3="150,50"/>
                                  <BezierSegment Point1="175,30" Point2="325,100" Point3="150,50"/>
                                  <BezierSegment Point1="125,300" Point2="75,200" Point3="50,50"/>
                                  <BezierSegment Point1="5,30"  Point2="175,400" Point3="150,50"/>
                                </PathSegmentCollection>
                              </PathFigure.Segments>
                            </PathFigure>
                          </PathFigureCollection>
                        </PathGeometry.Figures>
                      </PathGeometry>               
                    </GeometryGroup>                  
                  </GeometryDrawing.Geometry>
                </GeometryDrawing>
              </DrawingBrush.Drawing>
            </DrawingBrush>
          </Rectangle.Fill>
        </Rectangle> 
   </Canvas> 


</Window>