如何在没有设备上下文的情况下从DIB像素数据创建CImage [英] How to create CImage from DIB pixel data without a device context

查看:67
本文介绍了如何在没有设备上下文的情况下从DIB像素数据创建CImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有像素数据和其他信息(图像高度和宽度,bitcount)等,使用它我想创建一个MFC CImage对象。我找到了许多创建位图的解决方案(使用CreateDIBSection(),CreateDIBitmap()等函数)然后附加其句柄(HBITMAP)。我不能遵循这些方法,因为我没有设备句柄,这些函数使用句柄设备上下文作为参数。

他们建议使用CreateDIBSection函数和HDC参数为NULL的解决方案之一。它是一个经济实惠的解决方案吗?

请建议一种方法,从图像像素数据(DIB位值)和BITMAPHEADER信息创建MFCCImage对象,而无需设备上下文(HDC)信息。

I have pixel data and other information(image height & width, bitcount) etc, using it I would like to create a MFC CImage object. I found a number of solutions which create bitmaps (using functions like CreateDIBSection(), CreateDIBitmap() etc)then attaching its handle(HBITMAP). I can't follow these methods because but I don't have device handle, these functions uses handle to device context as parameter.
One of the solution them suggests to use "CreateDIBSection" function with HDC parameter as NULL. Is it an affordable solution?
APlease suggest a method to create MFC "CImage" object from image pixel data (DIB bit values) and BITMAPHEADER information without having device context(HDC) information.

推荐答案

您是否尝试过创建 [< a href =http://msdn.microsoft.com/de-de/library/k826sz5e.aspxtarget =_ blanktitle =新窗口> ^ ]功能?您可以发布一些代码,以便我们了解您的情况吗?
Have you tried the Create[^] function ? Can you maybe post a bit of your code, so that we can understand what you are at ?


这篇关于如何在没有设备上下文的情况下从DIB像素数据创建CImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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