3
如何使用VB6使用每像素1位制作* .bmp图像?有这样的例子存在一个示例项目吗?从二进制数据制作* .bmp图像
'# # Image Data Info : #
'# # Each black dot are represented as binary 1(high)#
'# # and white are represented as binary 0(low) in #
'# # form of hexadecimal character. #
'# # Example : (for this example assume the image width is 8)#
'# # Data : 7E817E #
'# # Binary data : 7=0111, E=1110, 8=1000, 1=0001 #
'# # 7=0111, E=1110 #
'# # Image data : px1 px2 px3 px4 px5 px6 px7 px8 #
'# # px1 w b b b b b b w #
'# # px2 b w w w w w w b #
'# # px3 w b b b b b b w #
'# # #
'# # w = white, b = black, px = pixel #
详情:
将文本十六进制数据拆分为每行的块(行),宽度/ 8个字符对。分配一个“Byte”数组''b',其中行和列的数量分别匹配件数和每件字符对的数量。对于每个片段中的每个字符对,将其val(“&h”&pair)“值存储在阵列中相应的位置。调用'CreateCompatibleDC(0)',选择一个'CreateBitmap(width,height,1,1,ByVal 0&)',声明一个'BITMAPINFO'结构'bi',用正确的尺寸填充它,调用'SetDIBits(hDC ,hBitmap,0,height,b(lbound(b)),bi,DIB_PAL_COLORS)。 – GSerg 2014-10-08 11:13:16
或者在窗体上调整一个'PictureBox',循环遍历字符对,循环遍历每个字符对内的各个像素(val(“&h”&pair)''中的八个幂),看看哪些是' 1'和'Picture1.Pset'分别用各自的颜色表示。 – GSerg 2014-10-08 11:19:18