GetBitmapRow example for Delphi
Procedure TForm1.Button1Click(Sender: TObject);
var
pBuf : pChar ; // Buffer to hold the row
hBuf : HGLOBAL ; // Handle to the buffer
nRow : integer ; // Row counter
uByte: Cardinal; // Byte counter
begin
// Load the bitmap, at 24 bits per pixel */
LeadImage.Load ( 'v:\images\0.bmp', 24, 0,1);
// Allocate and lock the buffer
hBuf := GlobalAlloc(GMEM_MOVEABLE, LeadImage.BitmapBytesPerLine);
pBuf := GlobalLock( hBuf );
// Process each row in the bitmap
for nRow := 0 to LeadImage.BitmapHeight -1 do
Begin
LeadImage.GetBitmapRow( pBuf, nRow, LeadImage.BitmapBytesPerLine);
for uByte := 0 to LeadImage.BitmapBytesPerLine do
(pBuf + uByte)^ := Char(Integer(((pBuf + uByte)^)) xor Integer($FF));
LeadImage.PutBitmapRow ( pBuf, nRow, LeadImage.BitmapBytesPerLine);
end;
// Free memory that we no longer need
GlobalUnlock(hBuf);
GlobalFree(hBuf);
end;