开发者

Silverlight: Adding transparency to images

开发者 https://www.devze.com 2023-01-18 05:28 出处:网络
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 co

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 to开发者_运维百科p 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.


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.


You might want to look at this sample on silverlight.net site: http://www.silverlight.net/community/samples/silverlight-samples/scratch-surface/

0

精彩评论

暂无评论...
验证码 换一张
取 消