LAnnStamp::SetBitmap

#include "ltwrappr.h"

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

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

LBitmapBase * pBitmap;

/* pointer to an LBitmapBase object */

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_UINT uFlags;

/* flags that determine the object to process */

Sets the bitmap of the annotation object. This function is available in the Document/Medical Toolkits.

Parameter

Description

pBitmap

Pointer to the bitmap object referencing the bitmap object to assign to the specified 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 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

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

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.

See Also

Functions:

LAnnStamp::SetBitmap, Class Members

Topics:

Annotation Functions: Object Properties

 

Using Annotation Bitmap Objects

Example

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

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;
}