L_AnnGetRgnHandle

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnGetRgnHandle(hObject, pXForm, phRgn)

HANNOBJECT hObject;

/* handle to the annotation object */

pRGNXFORM pXForm;

/* pointer to a coordinate translation structure */

HRGN *phRgn;

/* address of the variable to be updated */

Creates a region from the specified annotation object and retrieves a handle to that region. This function is available in the Document/Medical Toolkits.

Parameter

Description

hObject

Handle to the annotation object from which the region will be created.

pXForm

Pointer to an RGNXFORM structure that LEADTOOLS uses to translate between display coordinates and bitmap coordinates.

 

If you specify NULL in this parameter, the scalar fields default to 1, the offsets default to 0, and the view perspective defaults to TOP_LEFT.

phRgn

Address of the variable to be updated with the handle to the region, if the function is successful.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

You can create regions from the following annotation objects:

ANNOBJECT_FREEHAND

ANNOBJECT_POLYLINE

ANNOBJECT_POLYGON

ANNOBJECT_RECT

ANNOBJECT_ELLIPSE

ANNOBJECT_FREEHANDHOTSPOT

ANNOBJECT_HOTSPOT

ANNOBJECT_STAMP

ANNOBJECT_NOTE

ANNOBJECT_TEXT

ANNOBJECT_HILITE

ANNOBJECT_BUTTON

ANNOBJECT_REDACT

When working with the RGNXFORM structure in this function, consider the following:

image\sqrblit.gif the annotations are always TOP_LEFT.

image\sqrblit.gif the bitmap is missing, so the bitmap rectangle is replaced with the object rectangle.

image\sqrblit.gif it is easier to work with this function using TOP_LEFT as the ViewPerspective.

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

Topics:

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

 

Obtaining Annotation Object Information

 

Annotation Functions (Document/Medical only): Object Information

Example

L_INT EXT_CALLBACK AnnGetRgnHandleExample(HANNOBJECT  hObject,
                                          L_VOID*     pUserData)
{
   UNREFERENCED_PARAMETER(pUserData);
   HRGN        hRgn;
   RGNXFORM    XForm;
   L_INT       nRet;

   XForm.uViewPerspective  = BOTTOM_LEFT;
   XForm.nXScalarNum       = XForm.nXScalarDen = 1;
   XForm.nYScalarNum       = XForm.nYScalarDen = 1;
   XForm.nXOffset          = XForm.nYOffset = 0;

   nRet = L_AnnGetRgnHandle(hObject, &XForm, &hRgn);
   if (nRet == SUCCESS)
   {
      MessageBox(NULL, TEXT("Got region handle."), TEXT(""), MB_OK);

   }
   return SUCCESS;
}

L_VOID AnnGetRgnHandleExample_Call(HANNOBJECT hContainer)
{
   L_AnnEnumerate(hContainer, (ANNENUMCALLBACK)AnnGetRgnHandleExample, NULL, ANNFLAG_SELECTED | ANNFLAG_NOTTHIS, 0);
}