Silverlight:为图像添加透明度
我希望有人能帮助我们。我们正在尝试整合一个图像编辑器,其功能与 Silverlight 中的 Photoshop 类似(但远没有那么复杂)。在创建图层(z 索引堆栈中的多个独立图像)时,我们遇到了一个奇怪的问题。将图像分层似乎很好,但我们希望用户能够在给定层中编辑图像,但我们似乎无法使其正常工作。
特别是,我们希望用户能够在图像层中切“洞”(从而允许看穿下面的图像),但无论我们做什么,Silverlight 都不会让我们改变部分图像的 Alpha 透明度。图像。
奇怪的是,它将允许我们将整个图像变成透明的,并且它将正确地显示图像已经具有的任何透明度,但我们无法找到一种方法来使用户的选择透明。
我希望这足够清楚,有人能够帮助我们!
多谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果每个图层都在画布中,您可以向画布添加复杂的剪切区域以从渲染中删除内容。
这些需要从每个孔的多边形生成,因此不适合基于随机像素的区域。
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.
您可能想在 silverlight.net 站点上查看此示例:http: //www.silverlight.net/community/samples/silverlight-samples/scratch-surface/
You might want to look at this sample on silverlight.net site: http://www.silverlight.net/community/samples/silverlight-samples/scratch-surface/