Paints image data into a device context from a buffer.


#include "ltwrappr.h"

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


LBuffer& LBuff

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

L_INT nRow

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

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


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.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


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


Win32, x64.

See Also




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; 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help