从头开始创建DIB [英] Creating a DIB from scratch
问题描述
尝试通过对数据大小执行GlobalAlloc,锁定数据并使用GlobalLock并返回数据的句柄(强制转换为BITMAPINFO类型)来创建简单的DIB.
Trying to create a simple DIB from performing a GlobalAlloc on a size of data, locking the data sing GlobalLock and returning a handle to the data, casted to a BITMAPINFO type.
使用循环填充位数据.
Using a loop to fill the bit data.
这样做的目的是为从ActiveX控件捕获图像的应用程序创建测试.我需要一个测试应用程序,该应用程序可以创建可以用作占位符的虚拟图像".因此,我试图提出一种可以从头开始创建图像的简单方法
The purpose of this is to create a test for an app that captures images from an ActiveX control. I need a test app that can create a "dummy image" that can be used as a place holder. So I was trying to come up with a simple method that can create an image from scratch
这可行吗?
推荐答案
我将创建一个DIBSection并从那里复制数据,假设您要说的是要复制的数据.如果不这样做,这有什么意义?
I''d create a DIBSection and copy the data in from there, assuming you''re saying you have the data to copy in. If you don''t, what is the point of this ?
您想要手动重新创建字节级位图的声音.这是可行的;我曾经在高中时与QuickBasic一起工作.您只需要检查文件格式(这非常简单)并进行编码即可: http://en.wikipedia.org/wiki /BMP_file_format
Sounds like you want to manually recreate a bitmap at the byte level. It''s feasible; I once did that in high school when working with QuickBasic. You just need to review the file format (which is really simple) and get to coding: http://en.wikipedia.org/wiki/BMP_file_format
这篇关于从头开始创建DIB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!