【发布时间】:2013-04-23 04:41:33
【问题描述】:
我有一个项目需要执行快速图像渲染。
目前,我使用禁用拉伸的图像控制。通过设置 Source 属性由计时器进行更新。
WriteableBitmap frame = Player.Get().GetFrame();
if (frame != null)
image.Source = frame;
这部分成为性能瓶颈。更清楚 image.Source = frame 是一个瓶颈。
我查看了 MediaElement,但它不适用。
有什么方法可以更快地执行它吗?
也许像 GDI BitBlt 或类似的一些方法?
提前致谢。
【问题讨论】:
-
瓶颈是
Player.Get().GetFrame(),还是image.Source = frame? -
瓶颈真的在 image.Source = frame.它在 WinForms 中运行很快,但是当我移植到 WPF 时,性能大大下降。
-
也许writeablebitmapex.codeplex.com 项目有一些技巧?
-
如果你保留一个WriteableBitmap,并在每一帧设置它的像素,会有什么不同吗?
-
目前是这样实现的。它使用单个 WriteableBitmap,并且 Source = frame 用于重绘 Image 元素。我没有找到另一种重绘图像元素的方法。