virtual L_SSIZE_T LBitmapBase::GetRowColCompressed(pLRunBuffer, nRow, nCol, uWidth, pWorkBuffer=NULL)
Retrieves a row (or part of a row) of 1-bit compressed data from a class objects bitmap.
Pointer to an LBuffer object that will receive the retrieved data. Calculate the required size of this buffer as follows: bytes required = (nWidth + 3) * 2.
The number of the row to retrieve. The first row is 0 and the last row is 1 less than the bitmap height.
The number of column from which to get the data. The first column offset is 0, and the last column offset is 1 less than the bitmap width.
The number of pixels to retrieve.
A pointer to an optional work buffer. You can also pass NULL. Allocating the work buffer speeds processing if you call this function more than once, because if you do not allocate a work buffer, the function allocates and frees a temporary buffer each time it is called. The size of this buffer should be the same as the value returned by LBitmapBase::GetBytesPerLine
Value | Meaning |
---|---|
> 0 | The number of pixels processed. |
< 1 | An error occurred. Refer to Return Codes. |
Retrieves a row (or part of a row) of 1-bit compressed data from a class objects bitmap that has been loaded in its compressed format.
This function is useful for working with 1-bit images that are loaded in their compressed formats for faster loading and display. For more information, refer to Speeding Up 1-Bit Documents.
Win32, x64.
This example demonstrates the low-level functions for accessing
1-bit compressed bitmap data. It demonstrates the ability to get and put
partial rows, and the ability to process partial rows in buffer-to-buffer
processing.
L_INT LBitmapBase__GetRowColCompressedExample(L_TCHAR * pszFilename, HWND hWnd,
LBitmapBase LeadBitmap/* Bitmap handle for the image */)
{
UNREFERENCED_PARAMETER(hWnd);
L_INT nRet;
L_INT XOffset; /* Column offset of the rectangle to process */
L_INT XSize; /* Pixel width of the rectangle to process */
L_INT YOffset; /* Row offset of the rectangle to process */
L_INT YSize; /* Pixel height of the rectangle to process */
LBuffer RunBuffer; /* Handle to the pRunBuffer */
LBuffer WorkBuffer; /* Handle to the pWorkBuffer */
L_INT i; /* Counters */
/* Load the bitmap, at 1 bit per pixel */
LeadBitmap.File()->SetFileName(pszFilename);
nRet =LeadBitmap.File()->LoadFile(1,0,LOADFILE_COMPRESSED | LOADFILE_ALLOCATE | LOADFILE_STORE);
if(nRet !=SUCCESS)
return nRet;
/* This example does not work with rotated view perspectives */
if ( (LeadBitmap.GetViewPerspective() != TOP_LEFT) || (LeadBitmap.GetViewPerspective() != BOTTOM_LEFT) )
{
nRet =LeadBitmap.ChangeViewPerspective ( TOP_LEFT );
if(nRet !=SUCCESS)
return nRet;
}
/* Specify a rectangle in the middle right part of the displayed image */
XOffset = LeadBitmap.GetWidth() / 3;
XSize = LeadBitmap.GetWidth() * 2 / 3;
YOffset = LeadBitmap.GetHeight() / 3;
YSize = LeadBitmap.GetHeight() / 3;
/* Adjust the YOffset if the view perspective is bottom left */
if (LeadBitmap.GetViewPerspective() == BOTTOM_LEFT)
{
YOffset = LeadBitmap.GetHeight() - YOffset - YSize;
}
/* Allocate the buffers */
nRet =RunBuffer.Reallocate( (XSize + 3) * 2);
if(nRet !=SUCCESS)
return nRet;
nRet =WorkBuffer.Reallocate(LeadBitmap.GetBytesPerLine());
if(nRet !=SUCCESS)
return nRet;
nRet =LeadBitmap.Access();
if(nRet !=SUCCESS)
return nRet;
for(i=YOffset; i < (YOffset + YSize); i++)
{
nRet =(L_INT)LeadBitmap.GetRowColCompressed(&RunBuffer, i, XOffset, XSize, &WorkBuffer);
if(nRet !=SUCCESS)
return nRet;
nRet =(L_INT)LeadBitmap.PutRowColCompressed(RunBuffer, i, XOffset, XSize/ 2,&WorkBuffer);
if(nRet !=SUCCESS)
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