要不断地吸取大量位图的WPF的最好方法? [英] Best way to constantly draw large numbers of bitmaps in WPF?

查看:127
本文介绍了要不断地吸取大量位图的WPF的最好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这个很简单的问题难住了。我想提出一个基于瓦片的游戏引擎和需要能够以允许用户编辑使用WPF用户界面的图。天真,我曾以为,使用Graphics.FromImage我可以简单地不断更新的好老土缓冲System.Drawing.Graphics.Bitmap。我会画上的位图构成的地图瓦片,然后的blit缓冲位图到屏幕上。但是,从我深入研究我现在相信,这是不容易的。

I am stumped by this very simple problem. I am making a tile-based game engine and need to be able to allow a user to edit the map using a WPF User Interface. Naively, I had assumed that I could simply constantly update a good old fashioned "buffered" System.Drawing.Graphics.Bitmap using Graphics.FromImage. I would draw onto the bitmap the tiles that make up the map, and then blit the buffer Bitmap to the screen. However, from my thorough research I now believe that it isn't that easy at all.

而不是烦你什么我发现了迄今为止(要么不工作,或者是令人难以置信的慢),请问很简单,什么是不断通过有效的位图绘制大量的最好办法一个WPF UI?

Rather than bore you with what I've found out so far (that either doesn't work, or is incredibly slow), may I ask very simply, what is the best way for continuously drawing large numbers of bitmaps efficiently via a WPF UI?

我会接受这样的建议,回到Windows窗体。如果是这样的话,那么我会非常失望与WPF!

I will accept such suggestions as "go back to Windows Forms". If that's the case, then I am going to be very dissapointed with WPF!

推荐答案

在WriteableBitmap的类是一款高性能WPF兼容的位图,它可以直接访问其位。 此MSDN文档页面含有相当使用它的详尽的例子。

The WriteableBitmap class is a high-performance WPF-compatible bitmap that allows direct access to its bits. This MSDN documentation page contains a fairly thorough example of using it.

这篇关于要不断地吸取大量位图的WPF的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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