请教:将TBitmap 中提取红绿色放到一个Buffer中
蓝色删除, 每个点占用两个bit
BOOL TransData(TBitmap *bmp,BYTE* buf);
[解决办法]
TBitmap是什么
[解决办法]
TBitmap *bmp;
BITMAP bm;
GetObject(bmp-> Handle,sizeof(BITMAP),&bm);
bm-> bmBits就是颜色数据指针
BITMAP 结构定义
The BITMAP structure defines the type, width, height, color format, and bit values of a bitmap.
typedef struct tagBITMAP { // bm
LONG bmType;
LONG bmWidth;
LONG bmHeight;
LONG bmWidthBytes;
WORD bmPlanes;
WORD bmBitsPixel;
LPVOID bmBits;
} BITMAP;
Members
bmType
Specifies the bitmap type. This member must be zero.
bmWidth
Specifies the width, in pixels, of the bitmap. The width must be greater than zero.
bmHeight
Specifies the height, in pixels, of the bitmap. The height must be greater than zero.
bmWidthBytes
Specifies the number of bytes in each scan line. This value must be divisible by 2, because the system assumes that the bit values of a bitmap form an array that is word aligned.
bmPlanes
Specifies the count of color planes.
bmBitsPixel
Specifies the number of bits required to indicate the color of a pixel.
bmBits
Pointer to the location of the bit values for the bitmap. The bmBits member must be a long pointer to an array of character (1-byte) values.
[解决办法]
GetBitmapBits
[解决办法]
如一楼所示
bmBits
Pointer to the location of the bit values for the bitmap. The bmBits member must be a long pointer to an array of character (1-byte) values.
测试bmBits 是否为红色了