16.11.2011, 00:25
|
|
.
|
|
Регистрация: 18.05.2011
Адрес: Омск
Сообщения: 3,970
Версия Delphi: 3,5,7,10,12,XE2
Репутация: выкл
|
|
И что не получается?
Код:
var
Bitmap : TBitmap;
Bits : array of Byte;
...
var
bi : PBITMAPINFO;
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile('C:\000.bmp');
GetMem(bi, SizeOf(TBitmapInfo));
try
FillChar(bi^, SizeOf(TBITMAPINFO), 0);
with bi^.bmiHeader do
begin
biSize := SizeOf(TBITMAPINFOHEADER);
biWidth := Bitmap.Width;
biHeight := Bitmap.Height;
biPlanes := 1;
biBitCount := 24;
biCompression := BI_RGB;
end;
SetLength(Bits, Bitmap.Width * Bitmap.Height * (bi^.bmiHeader.biBitCount shr 3));
GetDIBits(Bitmap.Canvas.Handle, Bitmap.Handle, 0, Bitmap.Height, Bits, TBitmapInfo(bi^), DIB_RGB_COLORS);
finally
FreeMem(bi, SizeOf(TBitmapInfo));
end;
finally
Bitmap.Free;
end;
end;
всё работает.
__________________
Je venus de nulle part
55.026263 с.ш., 73.397636 в.д.
|