How to clip an image in a heart shape in Silverlight?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to clip an image in a heart shape in Silverlight?



I am working on image processing application in Silverlight. Currently I am stuck to one.



The problem is I want to clip the image in heart shape. How to clip the image in heart shape in Silverlight?




2 Answers
2



You can use a clipping path - something like this:


<Image Source="myimage.jpg" Width="300" Height="300" >
<Image.Clip>
<PathGeometry >
<PathFigure x:Name="pf" StartPoint="150,50" IsClosed="True" >
<ArcSegment IsLargeArc="True" Point="250,150" Size="141,141" SweepDirection="Clockwise" />
<LineSegment Point="150,250" />
<LineSegment Point="50,150" />
<ArcSegment IsLargeArc="True" Point="50,150" Size="141,141" SweepDirection="Clockwise" />
</PathFigure>
</Image.Clip>
</Image>



(you'll need to vary the exact path to suit your image).



Alternatively you can use an opacity mask in the shape of a heart.



I would recommend just creating a heart in Photoshop or something with the center transparent and the outsides a solid color. Then just draw the heart onto your image. This way you don't have to deal with clipping and you can have more control over the shape.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS