L_AnnCreate

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnCreate(uObjectType, phObject)

Creates an annotation object of the specified type.

Parameters

L_UINT uObjectType

The type of annotation object to create. For descriptions of object types, refer to Types of Annotations.

pHANNOBJECT phObject

Address of the variable to be updated with the handle to the new annotation object.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

(Document and Medical) Before calling this function, you must declare a variable of data type HANNOBJECT. Then, pass the address of the variable in the phObject parameter. This function will update the variable with the handle of the new annotation object.

You must use the L_AnnSet... functions to initialize the object after it is created.

You should not call this function during processing of WM_LTANNEVENT if wParam equals LTANNEVENT_REMOVE or LTANNEVENT_INSERT, or during the ANNENUMCALLBACK callback function.

This function must be called AFTER a container has been created (for example, after the TestCreateAnn step in Implementing a Non-automated Annotation Program).

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

For complete sample code, refer to the ANNOTATE example. This example creates a line object, inserts it into the existing container, and displays the line. This function must be called AFTER a container has been created.
For example, after TestCreateAnn in Implementing a Non-automated Annotation Program.

L_INT AnnCreateExample(HWND           hWnd, 
                                       HANNOBJECT     hContainer,/* Container annotation object */ 
                                       HANNOBJECT     MyLine)    /* Line annotation object */ 
{ 
   L_INT nRet; 
   HDC         hWindowDC;  /* Device context of the current window */ 
   ANNRECT     ContainerRect; 
   ANNRECT     ContainerRectName; 
   ANNPOINT    MyLinePts[2]; 
   pANNPOINT   pMyLinePts = MyLinePts; 
   RECT        rAnnBounds; 
   RECT        rAnnBoundsName; 
 
   /* Get the device context of the current window */ 
   hWindowDC = GetDC (hWnd); 
   /* Create the Line Annotation and insert it into the container */ 
   nRet = L_AnnCreate(ANNOBJECT_LINE, &MyLine); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_AnnInsert(hContainer, MyLine, FALSE); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_AnnSetVisible(MyLine, TRUE, 0, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Get the container rectangle to use for positioning the line */ 
   nRet = L_AnnGetRect(hContainer, &ContainerRect, &ContainerRectName); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Position the line */ 
   pMyLinePts[0].x = 0; 
   pMyLinePts[0].y = 0; 
   pMyLinePts[1].x = ContainerRect.right / 2; 
   pMyLinePts[1].y = ContainerRect.bottom / 2; 
   nRet = L_AnnSetPoints(MyLine, pMyLinePts, 2); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Display the line */ 
   nRet = L_AnnGetBoundingRect(MyLine, &rAnnBounds, &rAnnBoundsName); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_AnnDraw(hWindowDC, &rAnnBounds, MyLine); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Remove the queued paint message */ 
   ValidateRect(hWnd, &rAnnBounds); 
   ReleaseDC(hWnd, hWindowDC); 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help