开发者

System.Drawing.Graphics very large images

I'm creating a basic autocad viewer that has to deal with very large i开发者_StackOverflow社区mages.

I'm using System.Drawing.Graphics to render the images via:

Bitmap imageData;

public void Init(string filepath)
{
    imageData = new Bitmap(filepath);
}

public void Render(System.Drawing.Graphics ctx)
{
    ctx.DrawImage(imageData, x, y, w, h);
}

One specific file I'm dealing with has about ten 8000x8000 pixel .tif files. Needless to say the above falls pretty well on it's face with an OutOfMemory exception.

The files are compressed to a few megabytes each. Can anyone suggest a better strategy for rendering them?


Are you using .NET 4? If so, you can use Memory Mapped files to "load" the data into memory and only read the bits that you need to render on screen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜