LBitmapBase::GetRowCompressed

#include "ltwrappr.h"

virtual L_INT LBitmapBase::GetRowCompressed(pLRunBuffer, nRow, nLines=1, pWorkBuffer=NULL)

LBuffer * pLRunBuffer;

pointer to an LBuffer object

L_INT nRow;

number of the first row to retrieve

L_INT nLines;

the number of rows to retrieve

LBuffer * pWorkBuffer;

pointer to an optional work buffer

Retrieves one or more rows of 1-bit compressed data from a class objects bitmap that has been loaded in its compressed format.

Parameter

Description

pLRunBuffer

Pointer to an LBuffer object that will receive the retrieved row(s).

nRow

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

nLines

The number of lines to retrieve.

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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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

LTDIS
LTFIL

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

LBitmapBase::PutRow, LBitmapBase::PutRowCol, LBitmapBase::PutRowCompressed, LBitmapBase::GetRow, LBitmapBase::PutRowColCompressed, LBitmapBase::GetRowCol, LBitmapBase::GetRowColCompressed, Class Members

Topics:

Speeding Up 1-Bit Documents

Example

This example demonstrates the low-level functions for accessing 1-bit compressed bitmap data. It demonstrates the ability to get and put rows, and the ability to process rows in buffer-to-buffer processing. The result of the function is the first 50 lines are inverted.

L_INT LBitmapBase__GetRowCompressedExample(L_TCHAR  * pszFilename, HWND hWnd) 
{ 
   UNREFERENCED_PARAMETER(hWnd); 
   L_INT nRet; 
   LBitmapBase LeadBitmap;   /* Bitmap handle for the image */ 
   LBuffer Buffer; 
   LBuffer RunBuffer; 
   L_INT nRow = 0;            /* first row to get */ 
   L_INT nYSize = 50;         /* # of rows to get */ 
   /* Load the bitmap, as compressed */ 
   LeadBitmap.File()->SetFileName(pszFilename); 
   nRet =LeadBitmap.File()->LoadFile(1,0,LOADFILE_COMPRESSED | LOADFILE_ALLOCATE | LOADFILE_STORE); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* if the ViewPerspective is not TOP_LEFT or BOTTOM_LEFT, make it TOP_LEFT */ 
   /* Get/PutRow functions only work with TOP_LEFT or BOTTOM_LEFT */ 
   if ( (LeadBitmap. GetViewPerspective() != TOP_LEFT)|| (LeadBitmap.GetViewPerspective() != BOTTOM_LEFT) ) 
   { 
      nRet =LeadBitmap.ChangeViewPerspective (TOP_LEFT ); 
      if(nRet !=SUCCESS) 
         return nRet; 
   } 
   if (LeadBitmap.GetViewPerspective()== BOTTOM_LEFT) 
      nRow = LeadBitmap.GetHeight() - nRow - nYSize; 
   /* Allocate the buffers */ 
   nRet =Buffer.Reallocate((((LeadBitmap.GetWidth() + 31) &~31)/ 8) * nYSize); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =RunBuffer.Reallocate((L_UINT32)((LeadBitmap.GetWidth() + 3) * 2) * nYSize); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Access the bitmap */ 
   nRet =LeadBitmap.Access(); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /* Get the top nRow lines */ 
   nRet =LeadBitmap.GetRowCompressed (&RunBuffer, nRow, nYSize,0); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =LeadBitmap.PutRowCompressed (RunBuffer, nRow, nYSize,0); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =LeadBitmap.Release(); 
   if(nRet !=SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help