加快显示大位图的性能 [英] Speeding up the performance of displaying large bitmaps

查看:83
本文介绍了加快显示大位图的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个映射应用程序,该应用程序需要显示缩放到画布上的多个大型位图(最大7000像素平方).我将它们加载为BitmapSources并使用DrawImage将它们渲染到画布上.我正在使用变换"来缩放和平移.加载位图时,性能非常好,但是每个位图的加载过程可能需要几秒钟.显示屏平移时这不好.我不希望即时加载,但是问题是延迟发生在我无法控制的库代码中. LoadImage和DrawImage命令返回非常快,但是实际渲染稍后发生,并在发生UI时阻止UI.这给用户带来了非常生涩的体验.我尝试细分位图.这会导致暂停时间短得多,但暂停时间会更多.

所以我的问题是我是否可以做些什么(a)更快地渲染位图,或者(b)在线程中完成?不会阻止UI.

I'm developing a mapping application which needs to display multiple large bitmaps (up to 7000 pixels square) scaled onto a canvas.  I'm loading them as BitmapSources and rendering them to a canvas using DrawImage.  I'm using Transforms to zoom and pan.  The performance is excellent when the bitmaps are loaded, but the loading process can take several seconds for each bitmap.  This is no good while the display is panning.  I don't expect instant loading, but the problem is that the delay happens in library code over which I have no control.  The LoadImage and DrawImage commands return very quickly, but the actual rendering happens later, and blocks the UI while it is happening.  This gives a very jerky user experience.  I've tried subdividing the bitmaps.  This results in much shorter pauses, but more of them.

So my question is whether there is anything I can do to either (a) render the bitmaps faster or (b) do it in a thread which does not block the UI.

推荐答案

您是否尝试过使用WritableBitmap? ="http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx" title ="WritableBitmap class"> http://msdn.microsoft.com/en-us /library/system.windows.media.imaging.writeablebitmap.aspx
Have you tried using WritableBitmap?

http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx


这篇关于加快显示大位图的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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