C++ Class Library

The LEADTOOLS C++ Class Library is a wrapper to the LEADTOOLS C API and provides only a subset of the features and functionality otherwise available in the LEADTOOLS C API. For more information about the full feature set of the LEADTOOLS C API, refer to LEADTOOLS C API Introduction.

Is this page helpful?

In this page

LAnnStamp::SetBitmap

Summary

Sets the bitmap of the annotation object.

Syntax

#include "ltwrappr.h"

virtual L_INT LAnnStamp::SetBitmap(pBitmap, uFlags=0)

virtual L_INT LAnnStamp::SetBitmap(pBitmap, uFlags=0)

Parameters

LBitmapBase * pBitmap

Pointer to the bitmap object referencing the bitmap object to assign to the specified object.

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to assign to the specified object.

L_UINT uFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

Value Meaning
0 Process only the specified object.
ANNFLAG_SELECTED [0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the LAnnotation::IsSelected and LAnnotation::SetSelected functions.
ANNFLAG_NOINVALIDATE [0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.

Returns

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

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This is an example for LAnnStamp::SetBitmap(pBitmap, uFlags=0), with pBitmap of type pBITMAPHANDLE:

Copied to clipboard
L_INT LAnnStamp_SetBitmapExample(HWND hWnd, pBITMAPHANDLE pBitmap, LAnnContainer  * pAnnContainer, LAnnStamp  * pAnnStamp) 
{ 
	L_INT nRet; 
 
   HDC hWindowDC;  /* Device context of the current window */ 
   ANNRECT ContainerRect; /* Root container's rectangle */ 
   ANNRECT MyStampRect; /* Rectangle for the stamp object */ 
   RECT rAnnBounds; /* Bounding rectangle used to draw the object */ 
    
   /* Get the device context of the current window */ 
   hWindowDC = GetDC (hWnd); 
    
   /* Get the container's rectangle */ 
   nRet = pAnnContainer->GetRect(&ContainerRect); 
	if(nRet != SUCCESS) 
		return nRet; 
    
   /* Size and position the stamp, adjusting the height to keep the bitmap's aspect ratio */ 
   MyStampRect.left = ContainerRect.right / 8; 
   MyStampRect.top = ContainerRect.bottom / 2; 
   MyStampRect.right = ContainerRect.right  / 2; 
   MyStampRect.bottom = MyStampRect.top + 
								(((MyStampRect.right - MyStampRect.left) * BITMAPHEIGHT(pBitmap)) / BITMAPWIDTH(pBitmap)); 
   nRet =  pAnnStamp->SetRect(&MyStampRect); 
   if(nRet != SUCCESS) 
	   return nRet; 
 
   /* Assign the bitmap to the stamp;*/ 
   nRet = pAnnStamp->SetBitmap(pBitmap,0); 
	if(nRet != SUCCESS) 
		return nRet; 
   /* Display the stamp */ 
   nRet = pAnnStamp->GetBoundingRect(&rAnnBounds); 
	if(nRet != SUCCESS) 
		return nRet; 
   nRet = pAnnStamp->Draw(hWindowDC, &rAnnBounds); 
	if(nRet != SUCCESS) 
		return nRet; 
   ReleaseDC(hWnd, hWindowDC); 
 
   /* Remove the queued paint message */ 
   ValidateRect(hWnd, &rAnnBounds);    
 
	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
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.