Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silverlight: Adding transparency to images

I hope someone can help us. We’re trying to put together an image editor, with similar functionality to Photoshop in Silverlight (but nowhere near as intricate). We’ve hit a weird problem when it comes to creating layers (several independent images in a z-index stack). Layering images on top of each other seems fine, but we want users to be able to edit the image in a given layer and we can’t seem to get it working.

In particular we want users to be able to cut “holes” in an image layer (and therefore allow the image below to be seen through), but no matter what we do, Silverlight won’t let us alter the Alpha transparency of PARTS of the image.

Strangely it will allow us to turn the entire image transparent and it will correctly show any transparency the image already has, but we can't figure out a way to make the user's selection transparent.

I hope that’s clear enough for someone to be able to help us!

Thanks a lot.

like image 347
Chuck Le Butt Avatar asked Nov 06 '22 08:11

Chuck Le Butt


1 Answers

If each layer is in a canvas, you can add complex clipping regions to the canvases to remove content from the rendering.

These would need to be generated from polygons for each hole, so not good for random pixel-based regions.

like image 186
Gone Coding Avatar answered Nov 09 '22 16:11

Gone Coding