Copies image data from the class object's bitmap to the specified buffer.
#include "ltwrappr.h"
virtual L_SSIZE_T LBitmapBase::GetRow(pLBuffer, nRow)
Pointer to an LBuffer object that will receive the retrieved row. You must allocate enough space in the buffer to hold the data. To get a full row, use the value returned by LBitmapBase::GetBitsPerPixel to allocate the buffer. Or, use an empty buffer to retrieve the full row.
NOTE: The data in the buffer will be padded to Bitmap.BytesPerLine.
When getting less than full row, you must consider the bits per pixel. For a 1-bit bitmap, each byte represents 8 pixels. For a 4-bit bitmap, each byte represents 2 pixels. For an 8-bit bitmap, each byte represents 1 pixel. For a 16-bit bitmap, every 2 bytes represents one pixel. For 24-bit images, every three bytes represents one pixel. For a 32-bit bitmap, every four bytes represents one pixel. For 48-bit images, every six bytes represents one pixel. For 64-bit images, every eight bytes represents one pixel.
You can use the value returned by LBitmapBase::GetBitsPerPixel with integer math to calculate the number of bytes needed for a particular number of pixels. For example:
NumberOfBytes = (Bitmap.GetBitsPerPixel() * NumberOfPixels) / 8;
if ((Bitmap.GetBitsPerPixel() * NumberOfPixels) % 8)
++NumberOfBytes; /* Round up if necessary for a 1- or 4-bit image */
The number of the row to retrieve. The first row is 0 and the last row is 1 less than the bitmap height.
Value | Meaning |
---|---|
>=1 | The number of bytes retrieved. |
< 1 | An error occurred. Refer to Return Codes. |
This function copies image data from the class object's bitmap to a buffer that you specify. The data is copied exactly as it is stored in the image. The bitmap memory must be locked when you use this function. Normally, you can call LBitmapBase::Access to lock the memory before starting an operation that uses this function, then call LBitmapBase::Release when the operation is finished.
Use the LBitmapBase::GetBytesPerLine() to determine the byte count of each line. Color order is determined by the LBitmapBase::GetColorOrder() function. ORDER_GRAY is only valid for 12, 16 and 32-bit grayscale images. Locking the bitmap memory will speed up the processing. If you do not lock the bitmap memory it will be locked automatically and released automatically after getting the row data, but this will slow down the processing.
Support for 12, 16 and 32-bit grayscale images is only available in the Document/Medical Imaging editions.
Win32, x64.
/* Load the bitmap, at 24 bits per pixel */
L_INT LBitmapBase__GetRowExample()
{
L_INT nRet;
LBitmapBase LeadBitmap;
LBuffer Buffer;
L_CHAR * pBuff;
LeadBitmap.Load (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")));
/* get row number 5 of the bitmap */
nRet =LeadBitmap.Access();
if(nRet !=SUCCESS)
return nRet;
nRet =(L_INT)LeadBitmap.GetRow(&Buffer,5) ;
if(nRet < 1)
return nRet;
/*process the row data*/
if(Buffer.GetSize())
{
pBuff=(L_CHAR *)Buffer.Lock();
for(L_INT uByte = 0; uByte < LeadBitmap.GetBytesPerLine(); uByte++)
pBuff[uByte] ^= 0xFF;
Buffer.Unlock();
/*restore the row*/
nRet =(L_INT)LeadBitmap.PutRow(Buffer, 5);
if(nRet <1 )
return nRet;
nRet =LeadBitmap.Release();
if(nRet !=SUCCESS)
return nRet;
}
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document