Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_AnnSetBitmap

Show in webframe

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetBitmap(hObject, pBitmap, uFlags)

HANNOBJECT hObject;

/* handle to the annotation object */

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UINT uFlags;

/* flags that determine which objects to process */

Sets the bitmap of one or more annotation objects.

Parameter

Description

hObject

Handle to the annotation object.

pBitmap

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

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

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:

Point

Pushpin

Stamp (including the Tubber Stamp tools)

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

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_AnnGetBitmap

Topics:

Annotation Functions: Object Properties

 

Annotation Objects - Default Values

 

Annotation Objects - Automated Features

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

 

Altering Annotation Object Settings

 

Using Annotation Bitmap Objects

 

Annotation Functions (Document/Medical only): Getting and Setting the Object Bitmap Property

Example

This example creates a stamp object containing a bitmap.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


 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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.