Geometry Used as a Clip : RectangleGeometry « Shapes « Silverlight






Geometry Used as a Clip

   
<UserControl x:Class='SilverlightApplication3.MainPage'
    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' 
    mc:Ignorable='d' 
    d:DesignWidth='640' 
    d:DesignHeight='480'>

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


</UserControl>

   
    
    
  








Related examples in the same category

1.RectangleGeometry and RadiusXRectangleGeometry and RadiusX
2.Use RectangleGeometry to clip ImageUse RectangleGeometry to clip Image
3.Specify a Path element with a RectangleGeometrySpecify a Path element with a RectangleGeometry
4.Geometry Transform for RectangleGeometry Transform for Rectangle
5.Geometry Transform for Path
6.Use RectangleGeometry as the Path data
7.A RectangleGeometry compared to a RectangleA RectangleGeometry compared to a Rectangle