Creates an annotation object of the specified type.
#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnCreate(uObjectType, phObject)
The type of annotation object to create. For descriptions of object types, refer to Types of Annotations.
Address of the variable to be updated with the handle to the new annotation object.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
(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).
Win32, x64.
For a complete sample code, refer to the \Examples\Annotation\C\Annotate demo.
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(L_HWND hWnd,
HANNOBJECT hContainer /* Container annotation object */,
HANNOBJECT MyLine /* Line annotation object */)
{
L_INT nRet;
L_HDC hWindowDC; /* Device context of the current window */
ANNRECT ContainerRect;
ANNRECT ContainerRectName;
ANNPOINT MyLinePts[2];
pANNPOINT pMyLinePts = MyLinePts;
L_RECT rAnnBounds;
L_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, L_FALSE);
if (nRet != SUCCESS)
return nRet;
nRet = L_AnnSetVisible(MyLine, L_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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document