什么是调整在Windows位图的最佳方式? [英] What is the best way to resize a Bitmap in Windows?

查看:137
本文介绍了什么是调整在Windows位图的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我工作的一个文本编辑器。我使用双缓冲画到屏幕上。所以基本上我有一个屏幕外的位图,这是我画上,然后将其复制到屏幕上。现在,当文本编辑器中调整窗口大小,我需要调整屏幕外的位图,以及。那么,什么将是调整位图的好办法?我在想,也许要删除旧的对象,并使用创建一个新的位图 CreateCompatibleBitmap ,但我不知道,如果是这样做的正确方法。

So, I am working on a text editor. I use double buffering to paint on to the screen. So basically I have an offscreen bitmap, which I paint on, and then copy it to the screen. Now, when the window for the text editor resizes, I need to resize the offscreen bitmap as well. So what would be a good way to resize the bitmap? I was thinking to maybe delete the old object and create a new bitmap using CreateCompatibleBitmap, but I'm wondering if it's the correct way to do it.

语言:C ++使用Win32 API的

Language : C++ using Win32 API

推荐答案

使用CreateCompatibleBitmap将工作,然后你要拨打的 BitBlt的在它现有的后备缓冲区的内容复制到缓冲区大小。我不认为这是一个更有效的方式使用GDI做到这一点。

Using CreateCompatibleBitmap will work, and then you'll want to call BitBlt on it to copy the contents of your existing backbuffer to the resized buffer. I don't think there is a more efficient way to do it using GDI.

这篇关于什么是调整在Windows位图的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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