GetBitmapRow example for C++ Builder
void __fastcall TForm1::Button1Click(TObject *Sender)
{
unsigned char * pBuf ; // Buffer to hold the row
HGLOBAL hBuf ; // Handle to the buffer
int nRow ; // Row counter
unsigned uByte ; // Byte counter
// Load the bitmap, at 24 bits per pixel */
LEADImage->Load ( "v:\\images\\11.bmp", 24, 0,1);
// Allocate and lock the buffer
hBuf = GlobalAlloc(GMEM_MOVEABLE, LEADImage-> BitmapBytesPerLine);
pBuf =( unsigned char * ) GlobalLock( hBuf );
// Process each row in the bitmap
for ( nRow = 0; nRow < LEADImage->BitmapHeight; nRow ++ )
{
LEADImage->GetBitmapRow ( pBuf, nRow, LEADImage->BitmapBytesPerLine);
for ( uByte = 0; uByte <= ( unsigned )LEADImage->BitmapBytesPerLine; uByte ++ )
pBuf[uByte] = pBuf[uByte] ^ (0xFF);
LEADImage->PutBitmapRow(( void * )pBuf,
nRow,
LEADImage->BitmapBytesPerLine);
}
// Free memory that we no longer need
GlobalUnlock(hBuf);
GlobalFree(hBuf);
}