L_AnnSetBitmap

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetBitmap(hObject, pBitmap, uFlags)

Sets the bitmap of one or more annotation objects.

Parameters

HANNOBJECT hObject

Handle to the annotation 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 L_AnnGetSelected and L_AnnSetSelected functions.
ANNFLAG_NOTTHIS [0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.
ANNFLAG_RECURSE [0x0008] Process objects within a container, and within any subcontainers, down to any level.
ANNFLAG_NOTCONTAINER [0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.
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.

Comments

Sets the bitmap of one or more annotation objects.

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

The Stamp object (which includes the Rubber Stamp tools) 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 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_AnnGetBitmap function to get the bitmap for one or more annotation objects.

Only the Stamp object uses this property. The specified bitmap is a LEAD bitmap. For descriptions of the various types of objects and their properties, refer to Types of Annotations.

This function applies to multiple and selected objects based on values of the uFlags parameter.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example creates a stamp object containing a bitmap.

L_INT AnnSetBitmapExample(HWND        hWnd, 
                                          HANNOBJECT  hContainer, /* Container annotation object */ 
                                          HANNOBJECT  MyStamp)    /* Stamp annotation object */ 
{ 
   L_INT nRet; 
   HDC            hWindowDC;        /* Device context of the current window */ 
   ANNRECT        ContainerRect;    /* Root container's rectangle */ 
   ANNRECT        ContainerRectName; 
   ANNRECT        MyStampRect;      /* Rectangle for the stamp object */ 
   RECT           rAnnBounds;       /* Bounding rectangle used to draw the object */ 
   RECT           rAnnBoundsName; 
   BITMAPHANDLE   TmpBitmap;        /* Bitmap for the stamp */ 
 
   /* Get the device context of the current window */ 
   hWindowDC = GetDC (hWnd); 
 
   /* Load the LEAD bitmap, reduced to 8-bit, defaulting to fixed palette */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE2.CMP")), &TmpBitmap, sizeof(BITMAPHANDLE), 8, ORDER_BGR, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Get the container's rectangle */ 
   nRet = L_AnnGetRect(hContainer, &ContainerRect, &ContainerRectName); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Create the stamp annotation */ 
   nRet = L_AnnCreateItem(hContainer, ANNOBJECT_STAMP, TRUE, &MyStamp); 
   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(&TmpBitmap)) / BITMAPWIDTH(&TmpBitmap)); 
   nRet = L_AnnSetRect(MyStamp,&MyStampRect); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Assign the bitmap to the stamp; then free the temporary bitmap */ 
   nRet = L_AnnSetBitmap(MyStamp, &TmpBitmap, 0); 
   if(nRet != SUCCESS) 
      return nRet; 
   L_FreeBitmap(&TmpBitmap); 
 
   /* Display the stamp */ 
   nRet = L_AnnGetBoundingRect(MyStamp, &rAnnBounds, &rAnnBoundsName); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_AnnDraw(hWindowDC, &rAnnBounds, MyStamp); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Remove the queued paint message */ 
   ValidateRect(hWnd, &rAnnBounds); 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help