是否可以直接从 GDI 进行 BitBlt?位图?
是否可以使用 BitBlt 直接从 GDI+ 位图中复制而不使用 GetHBitmap?
GetHBitmap 很慢,因为除了 BitBlt 副本之外,它还创建整个图像的新副本,并且比 BitBlt 副本慢,并且必须处理给定的 HBITMAP。图像很大。
有没有办法让BitBlt使用原始GDI+图像的像素数据?
编辑:我可以获得指向 GDI+ 位图像素数据在内存中的位置的指针。我可以创建一个指向 GDI+ 位图像素数据的 HBITMAP 以避免额外的复制,并从中创建 BitBlt 吗?
Is it possible to use BitBlt to copy directly out of a GDI+ bitmap without using GetHBitmap?
GetHBitmap is slow because it makes a new copy of the whole image, in addition to and slower than the BitBlt copy, and the given HBITMAP must be disposed. The image is large.
Is there a way to point BitBlt to use the pixel data of the original GDI+ image?
EDIT: I can get a pointer to where the GDI+ bitmap pixel data is in the memory. Can I create an HBITMAP that points to the GDI+ bitmap pixel data to avoid the extra copy, and BitBlt from that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过几天的寻找,我突然意识到答案一直就在我面前!我正在从指向字节数组的指针创建 GDI+ 位图。然后尝试使用相同的指针创建 HBITMAP。但我可以先轻松创建 HBITMAP,然后使用其中的指针来创建 GDI+ 位图。
它就像一个魅力!您可以随意混合 GDI 和 GDI+ 操作。该图像同时是普通 GDI 和 GDI+。您可以从完全相同的像素数据中进行 BitBlt,而不是使用 DrawImage!
这是代码:
After searching for days, it suddenly hit me that the answer had been staring me in the face all the time! I was creating a GDI+ bitmap from a pointer to a byte array. Then trying to create an HBITMAP using the same pointer. But I could just as easily create the HBITMAP first and use the pointer from that to create the GDI+ bitmap.
It works like a charm! You can mix GDI and GDI+ operations however you like. The image is both plain GDI and GDI+ at once. Instead of using DrawImage, you can BitBlt from the exact same pixel data!
Here's the code: