Clip裁剪特效
裁剪特效(Clip),允许对Silverlight元素进行裁剪,裁剪形状由Clip属性内包含的Geometry决定,下面直接上代码:
<StackPanel x:Name="LayoutRoot" Orientation="Horizontal" Background="White"> <!--原图--> <Image Source="../images/Silverlight.jpg" Width="340" Height="217"> </Image> <!--声明Clip属性的位图--> <Image Source="../images/Silverlight.jpg" Width="340" Height="217"> <Image.Clip> <EllipseGeometry RadiusX="100" RadiusY="100" Center="200,100"> </EllipseGeometry> </Image.Clip> </Image> <Image Source="../images/Silverlight.jpg" Width="340" Height="217"> <Image.Clip> <PathGeometry> <!-- 指明是闭线条并且指定起始位置--> <PathFigure IsClosed="True" StartPoint="50,50"> <LineSegment Point="10,150" /> <LineSegment Point="150,75" /> <LineSegment Point="10,75" /> <LineSegment Point="150,150" /> </PathFigure> </PathGeometry> </Image.Clip> </Image> </StackPanel>
运行结果:
两个裁剪效果