Gets the bitmap handle of the specified annotation object.


#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnGetBitmap(hObject, pBitmap, uStructSize)



Handle to the annotation object.


Address of the variable to be updated with the handle to the annotation object's bitmap.

L_UINT uStructSize

Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE).


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


The L_AnnGetBitmap function is valid only for the following object types:

Only the Stamp object uses this property. The specified bitmap is a LEAD bitmap. For a description of the Stamp object, refer to Stamp Annotation Object.

Before calling this function, you must declare a variable of data type BITMAPHANDLE. Then, pass the address of the variable in the pBitmap parameter. This function will update the variable with the handle to the annotation object's bitmap.

The ANNOBJECT_STAMP objects (which include the Rubber Stamp tools which are available in Automation) can display text, a bitmap or a metafile. Only one of these three can be displayed at any timesetting the object to one of these destroys any settings for the other two.

Initially, the ANNOBJECT_STAMP object displays text. The difference between the Stamp and the Rubber Stamp is that initially whereas the Stamp does not display an image, the Rubber Stamp tools are set to display different metafiles (one for each rubber stamp selection).

Call the L_AnnGetPredefinedBitmap function to retrieve the bitmap displayed by the ANNOBJECT_POINT object, and the L_AnnSetPredefinedBitmap function to set the bitmap displayed by the ANNOBJECT_POINT object.

Call the L_AnnSetBitmap function to set the bitmap for one or more annotation objects.

For descriptions of the various types of objects and their properties, refer to Types of Annotations.

Required DLLs and Libraries


Win32, x64.

See Also




Create a stamp object using the example for L_AnnSetBitmap,
then call this function to retrieve the bitmap from the global stamp object
and assign it to a local stamp object.

L_INT AnnGetBitmapExample(L_HWND hWnd, 
   HANNOBJECT hContainer /* Container annotation object */, 
   L_INT          nRet = SUCCESS; 
   L_HDC          hWindowDC;        /* Device context of the current window */ 
   HANNOBJECT     MyLocalStamp;     /* Stamp annotation object */ 
   ANNRECT        ContainerRect;    /* Root container's rectangle */ 
   ANNRECT        ContainerRectName; 
   ANNRECT        MyLocalStampRect; /* Rectangle for the stamp object */ 
   L_RECT         rAnnBounds;       /* Bounding rectangle used to draw the object */ 
   L_RECT         rAnnBoundsName; 
   BITMAPHANDLE   TmpBitmap;        /* Bitmap for the stamp */ 
   /* Get the device context of the current window */ 
   hWindowDC = GetDC(hWnd); 
   TmpBitmap.uStructSize = sizeof(BITMAPHANDLE); 
   /* Get the bitmap for the global MyStamp object. */ 
   nRet = L_AnnGetBitmap(MyStamp, &TmpBitmap, sizeof(BITMAPHANDLE)); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Get the container's rectangle */ 
   nRet = L_AnnGetRect(hContainer, &ContainerRect, &ContainerRectName); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Create a local stamp annotation */ 
   nRet = L_AnnCreateItem(hContainer, ANNOBJECT_STAMP, L_TRUE, &MyLocalStamp); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Size and position the stamp, adjusting the height to keep the bitmap's aspect ratio */ 
   MyLocalStampRect.left = ContainerRect.right * 3 / 5; 
   MyLocalStampRect.top = ContainerRect.bottom / 2; 
   MyLocalStampRect.right = ContainerRect.right; 
   MyLocalStampRect.bottom = MyLocalStampRect.top + 
      (((MyLocalStampRect.right - MyLocalStampRect.left) * BITMAPHEIGHT(&TmpBitmap)) / BITMAPWIDTH(&TmpBitmap)); 
   nRet = L_AnnSetRect(MyLocalStamp, &MyLocalStampRect); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Assign the bitmap retrieved from the global stamp object to the local stamp object. */ 
   nRet = L_AnnSetBitmap(MyLocalStamp, &TmpBitmap, 0); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Display the stamp */ 
   nRet = L_AnnGetBoundingRect(MyLocalStamp, &rAnnBounds, &rAnnBoundsName); 
   if (nRet != SUCCESS) 
      return nRet; 
   nRet = L_AnnDraw(hWindowDC, &rAnnBounds, MyLocalStamp); 
   if (nRet != SUCCESS) 
      return nRet; 
   /* Remove the queued paint message */ 
   ValidateRect(hWnd, &rAnnBounds); 
   return SUCCESS; 

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

LEADTOOLS Raster Imaging C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.