Image.Source设置慢 [英] Image.Source set slow

查看:77
本文介绍了Image.Source设置慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序实时生成图像数据.创建新图像(BitmapSource)时,我将它们设置为Image.Source.但是,这需要渲染线程的大量处理能力,我不确定为什么.更多信息:

My program generates image data in real time.  As the new images are created (BitmapSource), I set them to Image.Source.  However, this takes a lot of processing power from the rendering thread and I am not sure why.  More info:

1.源位图大于Image控件,因此正在发生缩放.但是,这种缩放应该是硬件加速的(我使用了线性位图缩放渲染选项),但是似乎仍在涉及CPU!

1. The source bitmap is larger than the Image control, so scaling is happening.  However, this scaling should be hardware accelerated (I use Linear bitmap scaling render option), but it seems the CPU is still being involved!

2.如果使源位图与Image控件的大小匹配,则速度会更快.

2. If I make the source bitmap match the Image control size, it is much faster. 

用新图像更新Image.Source的最快方法是什么?

What is the fastest way to update Image.Source with new images?

推荐答案

尝试这种方式.它可以产生非常快速的图像而无需复制位图.

Try this way. It can produce very fast image without copying bitmap.

http://blogs.microsoft.co.il/blogs/tomershamam/archive/2007/10/14/wpf-official-image-interop.aspx

http://blogs.microsoft.co.il/blogs/tomershamam/archive/2007/10/14/wpf-official-image-interop.aspx

http://social.msdn.microsoft.com/Forums/en/wpf/thread/69a21a24-1971-4fe2-8e76-05158a255c84

http://social.msdn.microsoft.com/Forums/en/wpf/thread/69a21a24-1971-4fe2-8e76-05158a255c84


这篇关于Image.Source设置慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆