我正在尝试将hBitmap转换为字节数组,但是我不想使用来自Graphics单元的TBitmap。 我的输入图像大小为128x64x32位。
var TheBits: array of array of Cardinal;
begin
with info.bmiHeader do begin
biWidth:=131;
biHeight:=64;
biSize:=SizeOf(TBITMAPINFOHEADER);
biCompression:=BI_RGB;
biBitCount:=32;
biPlanes:=1;
biSizeImage:=0;
end;
DC := CreateCompatibleDC(0);
SetLength(TheBits, 128, 64);
GetDIBits(DC, BmpHandle, 0, 64,@TheBits[0][0],Info,DIB_RGB_COLORS);
这给我一个不错的图像(当然是上下颠倒的),但我不得不将131放入biWidth中,这对我来说并没有太多意义。为什么不能是128呢?
array [0..127] of array [0..63] of Cardinal
。 - David Heffernan