LBitmapBase::GetRowColCompressed

#include "ltwrappr.h"

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

LBuffer L_FAR * pLRunBuffer;

/* pointer to an LBuffer object */

L_INT nRow;

/* number of the row to retrieve */

L_INT nCol;

/* column offset within the row to retrieve */

L_UINT32 uWidth;

/* number of pixels to retrieve */

LBuffer L_FAR * pWorkBuffer;

/* pointer to an optional work buffer */

Retrieves a row (or part of a row) of 1-bit compressed data from a class objects bitmap. This function is available in the Document/Medical toolkits only.

Parameter

Description

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.

nRow

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

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.

uWidth

The number of pixels 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

> 0

The number of pixels processed.

< 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.

See Also

Elements:

LBitmapBase::PutRow, LBitmapBase::PutRowCol, LBitmapBase::PutRowCompressed, LBitmapBase::GetRow, LBitmapBase::PutRowColCompressed, LBitmapBase::GetRowCol, LBitmapBase::GetRowCompressed, 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
partial rows, and the ability to process partial rows in buffer-to-buffer 
processing. */
LBitmapBase LeadBitmap;   /* Bitmap handle for the image */
void TestLoad(L_TCHAR L_FAR * pszFilename, HWND hWnd)
{
   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);
   LeadBitmap.File()->LoadFile(1,0,LOADFILE_COMPRESSED | LOADFILE_ALLOCATE | LOADFILE_STORE);

   /* This example does not work with rotated view perspectives */
   if ( (LeadBitmap.GetViewPerspective() != TOP_LEFT) || (LeadBitmap.GetViewPerspective() != BOTTOM_LEFT) )
    LeadBitmap.ChangeViewPerspective ( TOP_LEFT );

   /* 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 */
   RunBuffer.Reallocate( (XSize + 3) * 2);
   WorkBuffer.Reallocate(LeadBitmap.GetBytesPerLine());
   LeadBitmap.Access();
   for(i=YOffset; i < (YOffset + YSize); i++)
   {
      LeadBitmap.GetRowColCompressed(&RunBuffer, i, XOffset, XSize, &WorkBuffer);
      LeadBitmap.PutRowColCompressed(RunBuffer, i, XOffset, XSize/ 2,&WorkBuffer);   
   }
   LeadBitmap.Release();
}