Retrieves a row (or part of a row) of 1-bit compressed data from a class objects bitmap.


#include "ltwrappr.h"

virtual L_SSIZE_T LBitmapBase::GetRowColCompressed(pLRunBuffer, nRow, nCol, uWidth, pWorkBuffer=NULL)


LBuffer * pLRunBuffer

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.

L_INT nRow

The number of the row to retrieve. The first row is 0 and the last row is 1 less than the bitmap height.

L_INT nCol

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.

L_UINT32 uWidth

The number of pixels to retrieve.

LBuffer * pWorkBuffer

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.

Required DLLs and Libraries


Win32, x64.

See Also




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

L_INT LBitmapBase__GetRowColCompressedExample(L_TCHAR  * pszFilename, HWND hWnd, 
                                                               LBitmapBase LeadBitmap/* Bitmap handle for the image */) 
   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 */ 
   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 Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help