#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnLoadMemory(pMem, uMemSize, phObject, pLoadOptions)
Loads an annotation from a file that is stored in memory.
Pointer to the file in memory to be loaded.
Size of the file in memory (in bytes).
Address of the variable to be updated with the handle to the container object of the loaded annotations.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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 to the container object of the loaded annotations.
You can load annotations from multipage TIF files using the pLoadOptions
parameter.
If you have saved a memory handle to a tag in TIF or WANG format, using L_AnnSaveMemory, you must write the memory handle to the tag into a file using L_SetTag and L_SaveBitmapMemory before you can load it using this function
For more information about loading and pasting automated annotations, refer to Loading and Pasting Automated Annotations.
If this function returns SUCCESS and phObject
is updated with NULL, there are no annotation objects to load.
Required DLLs and Libraries
Win32, x64.
This example loads temporary annotations from a file, saves the file in memory,
then loads the memory-resident file into the globally defined container.
L_INT AnnLoadMemoryExample(HWND hWnd,
HANNOBJECT hContainer)/* Container annotation object */
{
HANNOBJECT TmpContainer; /* Temporary container for the annotations */
HGLOBAL hFileInMemory; /* Memory handle */
L_SIZE_T zMemSize; /* Size of the data in memory */
L_UCHAR* pData; /* Pointer to the data in memory */
L_INT nRet;
HDC hdc;
RECT rAnnBounds;
RECT rAnnBoundsName;
/* Load the initial annotations */
nRet = L_AnnLoad(MAKE_IMAGE_PATH(TEXT("cannon.ann")), &TmpContainer, NULL);
if(nRet != SUCCESS)
return nRet;
hFileInMemory = 0;
/* Save the annotations as a file in memory */
nRet = L_AnnSaveMemory(TmpContainer, ANNFMT_TIFFTAG, FALSE, &hFileInMemory, &zMemSize, NULL);
if(nRet != SUCCESS)
return nRet;
L_AnnDestroy(TmpContainer, ANNFLAG_RECURSE);
TmpContainer = 0;
/* Get the pointer to the memory-resident file */
pData = (L_UCHAR*)GlobalLock (hFileInMemory);
/* Load the new file from memory */
nRet = L_AnnLoadMemory(pData, zMemSize, &TmpContainer, NULL);
if (nRet == SUCCESS)
{
nRet = L_AnnInsert(hContainer, TmpContainer, TRUE);
if(nRet != SUCCESS)
return nRet;
hdc = GetDC(hWnd);
nRet = L_AnnGetBoundingRect(hContainer, &rAnnBounds, &rAnnBoundsName);
if(nRet != SUCCESS)
return nRet;
nRet = L_AnnDraw(hdc, &rAnnBounds, hContainer);
if(nRet != SUCCESS)
return nRet;
}
else
return nRet;
/* Clean up */
GlobalUnlock (hFileInMemory);
GlobalFree (hFileInMemory);
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