L_AnnSetBitmap
#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. This function is available in the Document/Medical Toolkits.
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
Windows 2000 / XP/Vista.
See Also
Functions: |
|
Topics: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Annotation Functions (Document/Medical only): Getting and Setting the Object Bitmap Property |
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 (TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 15\\Images\\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; }