本文介绍了WriteableBitmap WritePixels不更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试流式传输我从另一台计算机通过网络接收的一系列图像,并使用WriteableBitmap在一个简单的WPF应用程序中显示它们.我基本上是从Kinect DepthBasics-WPF示例中剥离出来的.奇怪的是 前两个左右的图像加载就很好,但是对于任何随后的图像,尝试调用WritePixels方法似乎都失败了,因为画布上的Image不再更改.已在此处 在某些集成的Intel图形卡上,似乎存在一个错误,即硬件加速会导致在单个锁定/解锁周期后无法访问WriteableBitmap实例.我尝试按照建议关闭硬件加速 我什至用NVidia卡在另一台机器上测试了代码.问题仍然存在.我确定要发送的图像正在更改,我已经将它们作为文件转储以进行调试,并且在这一点上我已经没有足够的想法了 尝试什么.那么,有人遇到过这个问题吗?有解决方法吗?

顺便说一句,出于绝望,我试图借助Direct2D应用程序有效地完成相同的工作,并遇到相同的问题,前两个左右尝试渲染新的图像".起作用,之后图像仍然停留在第二个图像上 图像.令人困惑的是,当我入侵代码以将图像从磁盘加载而不是通过网络加载时,它会在图像之间进行切换.

解决方案


I am attempting to stream a series of images that I receive over the network from another computer and display them in a simple WPF application using WriteableBitmap. I'm basically ripping off of the Kinect DepthBasics-WPF example. The strange thing is the first two or so image loads just fine, but for any images afterward attempting to call the WritePixels method seems to fail as the Image on the canvas no longer changes. It's been brought up here that on some integrated Intel graphics cards that there seems to be a bug where hardware acceleration causes an instance of the WriteableBitmap to become inaccessible after a single cycle of lock/unlock. I tried turning off hardware acceleration as suggested and I even tested the code on a separate machine with an NVidia card. The problem still remained. I know for certain that the images being sent are changing, I have them dumped as files for debugging purposes, and at this point I'm running out of ideas for what to try. So, anyone run into this problem before? And have a workaround?

As an aside, out of desperation I tried resorting to a Direct2D application to do effectively the same thing, and ran into the same problem, the first two or so attempts to render a new "image" works, afterwards the image remains stuck on the second image. Confusingly, when I hacked the code to load the image off of disk instead of over network, it would switch between the images just fine.

解决方案


这篇关于WriteableBitmap WritePixels不更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 07:48