When updates are sent to the rendering thread, the rendering thread copies the changed rectangles from the back buffer to the front buffer. The rendering system controls this exchange to avoid deadlocks and redraw artifacts, such as "tearing".
I process my images on a background thread, then use Dispatcher.BeginInvoke()
to call WritePixels()
, to ensure that WritePixels()
is called on the UI thread.
I'm finding that tearing still occurs with WriteableBitmap
, and in the application I'm working on, it looks awful (its a medical imaging application). Is there anything I can do?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
为了避免撕裂,WriteableBitmap 投入了大量工作,但在某些系统配置上这是不可避免的。 这主要发生在关闭了 Aero (DWM) 的 Windows XP 或 Vista 上。
There was a lot of work put into WriteableBitmap to avoid tearing, but on some system configurations this is unavoidable. This mostly will happen on Windows XP or Vista w/ Aero (DWM) turned off.
当您调用 WritePixels() 时,您可能会覆盖位图。 使用 Dispatcher.Invoke() 而不是 BeginInvoke() 可能会有所帮助。
While you are calling WritePixels() you may be overwriting your bitmap. Using Dispatcher.Invoke() rather then BeginInvoke() might help.
我知道这是一个旧线程,但我们遇到了完全相同的问题,在我们的例子中,它是由使用 Dispatcher.BeginInvoke 调用我们的更新显示方法引起的 - 当我们更改为 Dispatcher.Invoke 时,它立即消失了。
I know this is an old thread but we had exactly the same issue and in our case it was caused by calling our update display method using Dispatcher.BeginInvoke - the moment we changed to Dispatcher.Invoke it cleared up instantly.