问题描述
是否有可能从Silverlight控件生成图像,这样控制会使本身及其内容的图像,这样我可以在图像上做森达像素处理?
Is it possible to generate an image from a silverlight control so that the control would render itself and its contents to an image so that I can do sime pixel manipulation on the image?
推荐答案
有没有办法在Silverlight 2,我看到人们解决此限制张贴XAML到会使用WPF来呈现它为位图的服务器(实现这一目标使用RenderTargetBitmap)并返回一个图像。
There is no way to achieve this in Silverlight 2. I have seen people work around this limitation by posting XAML to a server which would use WPF to render it to a bitmap (using RenderTargetBitmap) and return an image.
然而,刚刚发布的Silverlight 3贝塔包括可用于呈现一个Silverlight的UIElement成像素一WritableBitmap类。在公测但是有一个限制;一旦你渲染元素插入的位图,你不能访问它的像素。这种限制应该有所在最终版有所缓解
However, the just released Silverlight 3 Beta includes a WritableBitmap class which can be used to render a Silverlight UIElement into pixels. In the beta there is however a limitation; once you render an element into the bitmap you cannot access its pixels. This restriction should be eased somewhat in the final release.
的Silverlight 3测试版还包括像素着色器,这样你就可以在HLSL编写自定义着色器,它适用于任何的UIElement - 这可能是你最好的解决方案。本视频教程应该让你开始写作,在Silverlight 3测试版使用像素着色器。
Silverlight 3 Beta also includes pixel shaders, so you can write a custom shader in HLSL and apply it to any UIElement - this might be the best solution for you. This tutorial video should get you started on writing and using pixel shaders in Silverlight 3 Beta. http://silverlight.net/learn/learnvideo.aspx?video=187303
这篇关于Silverlight的:创建一个从Silverlight控件图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!