L_PaintDCOverlayCallback

#include "l_bitmap.h"

L_LTDIS_API L_INT L_PaintDCOverlayCallback(pCallbackData, pBitmap, nIndex, pSrc, pClipSrc, pDst, pClipDst, uROP3)

Paints the overlay at the specified index using custom callbacks. Use this function to paint overlays that are not automatically painted.

Parameters

pPAINTCALLBACKDATA pCallbackData

Pointer to a structure containing the device context (DC) and the paint callbacks. The mapping mode of the device context must be MM_TEXT.

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the main bitmap.

L_INT nIndex

The index of the overlay used for painting. The overlay should have a bitmap. If the overlay is embedded into a bitmap bitplane, make sure you create an overlay bitmap prior to calling this function. This index is zero-based.

L_RECT * pSrc

Pointer to the Windows RECT structure that specifies the part of the bitmap to use as the display source.

The coordinates in the RECT structure are relative to the main bitmap. You can pass NULL to use the default, which matches the main bitmap.

L_RECT * pClipSrc

Pointer to the Windows RECT structure that specifies the portion of the display source to paint. Generally, this is used for updating the display when part of the source bitmap has changed.

The coordinates in the RECT structure are relative to the main bitmap. You can pass NULL to use the default, which matches the main bitmap.

L_RECT * pDst

Pointer to the Windows RECT structure that determines how the source rectangle is scaled and how the image is positioned in the device context.

The coordinates in the RECT structure are relative to the device context. There is no default for this parameter. You must specify the RECT structure.

L_RECT * pClipDst

Pointer to the Windows RECT structure that specifies the portion of the display rectangle to paint. Generally, this is used for updating changes in the display surface, such as when a user moves another window, uncovering a part of the image that had been covered up.

The coordinates in the RECT structure are relative to the device context. You can pass NULL to use the default, which matches the device context. In most cases, however, you should use the rectangle returned by the Windows WM_PAINT message.

L_UINT32 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

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

Comments

The HDC you are painting to should stored in the PAINTCALLBACKDATA structure. Please refer to its documentation for details on which GDI functions you can override.

This function will paint an overlay bitmap. For more information on the paint rectangles, see L_PaintDC. L_PaintDC will paint all the overlays that have OVERLAY_AUTOPAINT set in the uFlags member of the OVERLAYATTRIBUTES structure. The overlays are painted in ascending index order: overlay 0 is painted first, then overlay 1, etc.

Use this function to manually paint an overlay. For example, to change the order in which the overlays are painted, clear the OVERLAY_AUTOPAINT flag from the uFlags member of the overlay's OVERLAYATTRIBUTES structure and call L_PaintDCOverlayCallback directly.

To temporarily make an overlay top-most, call L_PaintDCOverlayCallback after L_PaintDC. To permanently make an overlay top-most, change its index and give it the highest defined index.

The overlay bitmap's 1 pixels are painted with the color set in the crColor member of the OVERLAYATTRIBUTES structure. The overlay bitmap's 0 pixels are considered transparent.

For more information on the overlay attributes, including the OVERLAY_AUTOPAINT flag and crColor, refer to OVERLAYATTRIBUTES.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Structures

Topics

Example

This example assumes pBitmap contains overlays. It will make it look as if overlay 0 is topmost The example also assumes hDC and pDest have been initialized elsewhere.

L_INT PaintDCCallbackOverlayExample(HDC hDC, pBITMAPHANDLE pBitmap, LPRECT pDest) 
{ 
   L_INT nRet; 
   PAINTCALLBACKDATA PaintCallbackData; 
 
   /* Initialize the paint callback data structure */ 
   memset(&PaintCallbackData, 0, sizeof(PaintCallbackData)); 
   PaintCallbackData.uStructSize = sizeof(PAINTCALLBACKDATA); 
   PaintCallbackData.pDisplay = hDC; 
 
   /* set the paint callbacks for the GDI functions you are overriding here 
 
        PaintCallbackData.pIsCompatibleDC = MyIsCompatibleDC; 
        PaintCallbackData.pStretchDIBits = MyStretchDIBits; 
        etc 
   */ 
 
   nRet = L_PaintDCCallback(&PaintCallbackData, pBitmap, NULL, NULL, pDest, NULL, SRCCOPY);  
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_PaintDCOverlayCallback(&PaintCallbackData, pBitmap, 0, NULL, NULL, pDest, NULL, SRCCOPY);  
   if(nRet != SUCCESS) 
      return nRet; 
   /* Now overlay 0 is topmost (it covers all the other overlays) */ 
   return SUCCESS; 
} 

Help Version 21.0.2023.2.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.