LPaint::PaintDCBuffer

#include "ltwrappr.h"

virtual L_INT LPaint::PaintDCBuffer(LBuff, nRow, nCount=1, uROP3=SRCCOPY)

LBuffer &LBuff;

/* an LBuffer object that contains the data to paint */

L_INT nRow;

/* first row to paint */

L_INT nCount;

/* number of rows to paint */

L_UINT32 uROP3;

/* windows ROP code for display */

Paints image data into a device context from a buffer.

Parameter

Description

LBuff

A LEAD buffer of type LBuffer that contains the image data to paint.

nRow

The first row to paint. The painted portion of any row may be limited by the bitmap object rectangles.

nCount

The number of rows to paint. The painted portion of any row may be limited by the bitmap object rectangles.. If the image data in LBuff is compressed 1-bit data, you can specify the number of lines as a negative value (-nLines), as explained in Speeding Up 1-Bit Documents.

uROP3

The Windows ROP code that determines how the destination rectangle is updated. This parameter takes the same codes as the Windows BitBlt() function. For ordinary painting, use SRCCOPY.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function references a LEAD bitmap object, which may or may not have a loaded bitmap. In either case, the following fields must be specified in the LEAD bitmap object:

The Width, Height, BitsPerPixel, Order, and ViewPerspective fields must all be set to the correct values for the image. (You can use the LBitmapBase::Initialize function to set the values.)

The Palette for the bitmap object must be a valid palette (an array of RGBQUAD values). You can create or update the palette using the LBitmapBase::PutColors() function.

Except for the buffer specifications, this function uses source and destination rectangles the same as LPaint::PaintDC. For a complete explanation, refer to LPaint::PaintDC.

You can call LPaint::PaintDCBuffer from a callback function to paint an image while a bitmap is being loaded. This technique is used through the LFile load callback functions.

The LBuff parameter is passed by reference, and is a required parameter.

Required DLLs and Libraries

LTDIS

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

Functions:

Class Members, LBitmapBase::RectToBitmap, LBitmapBase::RectFromBitmap

Topics:

Raster Image Functions: Displaying Images

 

Raster Image Functions: Palettes

 

Handling Palette Changes

Example

L_INT LPaint__PaintDCBufferExample(LBitmapBase& LeadBitmap,HDC hDC)
{
   L_INT nRet;
   LPaint   LeadPaint(&LeadBitmap,hDC);
   L_INT    i,nBytesPerLine;
   L_SIZE_T zRet;
   nBytesPerLine = LeadBitmap.GetBytesPerLine() ;
   LBuffer  LeadBuffer((DWORD)nBytesPerLine) ;
   for( i = 0 ; i < LeadBitmap.GetHeight() ; i++)
   {
      zRet = LeadBitmap.GetRow(&LeadBuffer,i) ;
      if(zRet < 1)
         return FAILURE;
      nRet = LeadPaint.PaintDCBuffer(LeadBuffer,i) ;
      if(nRet != SUCCESS)
         return nRet;
   }
   return SUCCESS;
}