在 Silverlight 中寻找高速位图渲染
我试图在 Silverlight 中实现高速位图写入,并使用 WriteableBitmap
来实现。该场景是重复将 UIElement(如 Image)写入 1000x1000 大小的位图:
WriteableBitmap bitmap = new WriteableBitmap(w, h);
...
for (...) {
bitmap.Render(patternImg, mymatrix);
bitmap.Invalidate();
}
这里,silverlight 似乎每秒只能绘制大约 50 次。 而在 HTML5 中,通过使用 Canvas, context.drawImage(image, dx, dy) ,它每秒可以执行超过 5000 次(在 1000x1000 位图上,如果我没有犯错的话...... )
看来silverlight的writableBitmap并没有利用硬件图形管道,有没有办法在silverlight中实现高速位图渲染?
I was trying to achieve high speed bitmap writing in Silverlight, and used WriteableBitmap
to do it. The scenario is repeatedly writing UIElement like Image onto a 1000x1000 sized bitmap:
WriteableBitmap bitmap = new WriteableBitmap(w, h);
...
for (...) {
bitmap.Render(patternImg, mymatrix);
bitmap.Invalidate();
}
Here, silverlight seems can only draw about 50 times per second.
While in HTML5, by using Canvas, context.drawImage(image, dx, dy)
, it can do over 5000 times per second (on a 1000x1000 bitmap, if I didn't make mistake...)
It seems silverlight's writableBitmap does not utilize the hardware graphic pipeline, is there any way to achieve high-speed bitmap rendering in silverlight?
如果您还没有找到这些,这里有一些可能有用的链接:
WriteableBitmapEX(开源项目):
http:// /writeablebitmapex.codeplex.com/
WriteableBitmapEx 功能介绍:
http://blogs.claritycon.com/blog/2011/03/30/advanced-animation-animating-15000-visuals-in-silverlight-2/
Silverlight 中的高性能渲染:
http://andrewrussell.net/2010/12/high-performance-rendering-in-silverlight/
If you haven't found these already, here are some links that may be helpful:
WriteableBitmapEX (open source project):
http://writeablebitmapex.codeplex.com/
introduction into WriteableBitmapEx capabilities here:
http://blogs.claritycon.com/blog/2011/03/30/advanced-animation-animating-15000-visuals-in-silverlight-2/
High performance redering in Silverlight:
http://andrewrussell.net/2010/12/high-performance-rendering-in-silverlight/