L_AnnLoadMemory

#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.

Parameters

L_UCHAR *pMem

Pointer to the file in memory to be loaded.

L_SIZE_T uMemSize

Size of the file in memory (in bytes).

pHANNOBJECT phObject

Address of the variable to be updated with the handle to the container object of the loaded annotations.

pLOADFILEOPTION pLoadOptions

Pointer to optional extended load options. Pass NULL to use the default load options.

Returns

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

Comments

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 multi-page 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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

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 Version 20.0.2019.12.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help