Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_AnnFileInfoMemory

Show in webframe

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnFileInfoMemory(pMem, uMemSize, pAnnFileInfo, uStructSize)

L_UCHAR *pMem;

/* pointer to the file location in memory */

L_SIZE_T uMemSize;

/* file size, in bytes */

pANNFILEINFO pAnnFileInfo;

/* pointer to an ANNFILEINFO structure */

L_UINT uStructSize;

/* size in bytes, of the structure pointed to by pAnnFileInfo */

Loads information about the annotation file located in memory into the specified ANNFILEINFO structure.

Parameter

Description

pMem

Pointer to the location in memory of the image file.

uMemSize

The size, in bytes, of the file referenced by pMem.

pAnnFileInfo

Pointer to the ANNFILEINFO structure to be filled with data from the image file.

uStructSize

Size in bytes, of the structure pointed to by pAnnFileInfo, for versioning. Use sizeof(ANNFILEINFO).

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function can be used to get information about a LEAD annotation file that is stored in memory.

To use this function, do the following:

1.

Load the file into memory and assign variables for the file's location in memory and for the file size.

2.

Declare a variable with the datatype of ANNFILEINFO.

3.

Fill in the nSize and nOffset fields of the ANNFILEINFO variable. The field nSize should contain the size of the ANNFILEINFO structure in bytes. The nOffset field should contain the byte location of the first byte of the annotation file.

4.

Call the L_AnnFileInfoMemory function, passing the pointer to the file in memory, the address of the ANNFILEINFO variable, and the file size as parameters.

5.

Get the image information from the fields described in ANNFILEINFO structure.

Required DLLs and Libraries

LTDIS

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

Win32, x64.

See Also

Functions:

L_AnnFileInfo, L_AnnFileInfoOffset, L_AnnLoad, L_AnnLoadOffset, L_AnnLoadMemory, L_AnnSave, L_AnnSaveOffset, L_AnnSaveMemory

Topics:

Annotation Files

 

Annotation Functions: Input and Output

 

Implementing Annotations

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

Example

This example saves the annotation container as the first page of a multi-page annotation file in memory. The format is specified by the 'uFormat' parameter. The container is flipped, and saved as the second page. The container is rotated, and saved as the third page. Information is displayed about the annotation file. The second page is deleted, and information is again displayed about the annotation file.

L_INT AnnFileInfoMemoryExample(L_TCHAR*   pszFileName,
                                              L_INT32    uFormat,
                                              HANNOBJECT hContainer)
{
   L_INT          nRet;
   SAVEFILEOPTION SaveFileOption;
   ANNFILEINFO    AnnFileInfo;
   L_TCHAR        szMsg[200];
   L_TCHAR*       pszFormat;
   HGLOBAL        hMem;
   L_SIZE_T       zMemSize;
   L_UCHAR*       pMem;

   hMem = NULL;

   //Save as the first page of the annotation file in memory
   nRet = L_AnnSaveMemory(hContainer, uFormat, FALSE, &hMem, &zMemSize, NULL);
   if (nRet != SUCCESS)
      return nRet;

   //Flip the container, and save as the second page (insert before page 2)
   SaveFileOption.uStructSize = sizeof(SAVEFILEOPTION);
   SaveFileOption.Flags = ESO_INSERTPAGE;
   SaveFileOption.PageNumber = 2;
   
   nRet = L_AnnFlip(hContainer, NULL, ANNFLAG_RECURSE);
   if (nRet != SUCCESS)
      return nRet;

   nRet = L_AnnSaveMemory(hContainer, uFormat, FALSE, &hMem, &zMemSize, &SaveFileOption);
   if (nRet != SUCCESS)
      return nRet;

   //Rotate the container, and save as the third page
   nRet = L_AnnRotate(hContainer, 45.0, NULL, ANNFLAG_RECURSE);
   if (nRet != SUCCESS)
      return nRet;
   SaveFileOption.PageNumber = 3;
   nRet = L_AnnSaveMemory(hContainer, uFormat, FALSE, &hMem, &zMemSize, &SaveFileOption);
   if (nRet != SUCCESS)
      return nRet;

   //Verify contents of file
   AnnFileInfo.uStructSize = sizeof(ANNFILEINFO);
   AnnFileInfo.nOffset = 0;
   AnnFileInfo.nReserved = 0;
   pMem = (L_UCHAR *)GlobalLock(hMem);
   nRet = L_AnnFileInfoMemory(pMem, zMemSize, &AnnFileInfo, sizeof(ANNFILEINFO));
   if (nRet != SUCCESS)
      return nRet;

   GlobalUnlock(hMem);

   switch(AnnFileInfo.uFormat)
   {
   case ANNFMT_NATIVE:
      pszFormat = TEXT("ANNFMT_NATIVE");
      break;
      
   case ANNFMT_WMF:
      pszFormat = TEXT("ANNFMT_WMF");
      break;
      
   case ANNFMT_ENCODED:
      pszFormat = TEXT("ANNFMT_ENCODED");
      break;

   case ANNFMT_XML:
      pszFormat = TEXT("ANNFMT_XML");
      break;

   default:
      pszFormat = TEXT("Unknown");
      break;
   }

   wsprintf(szMsg,
      TEXT("File[%s]\nVersion[%d]\nFormat[%s]\nTotal Pages[%d]\n"),
      pszFileName, 
      AnnFileInfo.nVersion,
      pszFormat,
      AnnFileInfo.nTotalPages);

   MessageBox(NULL, szMsg, TEXT("Information"), MB_OK);

   //Now delete the second page, and display informtion
   nRet = L_AnnDeletePageMemory(hMem, &zMemSize, 2);
   if (nRet != SUCCESS)
      return nRet;
   
   AnnFileInfo.uStructSize = sizeof(ANNFILEINFO);
   AnnFileInfo.nOffset = 0;
   AnnFileInfo.nReserved = 0;
   pMem = (L_UCHAR *)GlobalLock(hMem);
   nRet = L_AnnFileInfoMemory(pMem, zMemSize, &AnnFileInfo, sizeof(ANNFILEINFO));
   if (nRet != SUCCESS)
      return nRet;
   GlobalUnlock(hMem);

   switch(AnnFileInfo.uFormat)
   {
   case ANNFMT_NATIVE:
      pszFormat = TEXT("ANNFMT_NATIVE");
      break;
      
   case ANNFMT_WMF:
      pszFormat = TEXT("ANNFMT_WMF");
      break;
      
   case ANNFMT_ENCODED:
      pszFormat = TEXT("ANNFMT_ENCODED");
      break;

   case ANNFMT_XML:
      pszFormat = TEXT("ANNFMT_XML");
      break;

   default:
      pszFormat = TEXT("Unknown");
      break;
   }

   wsprintf(szMsg,
      TEXT("File[%s]\nVersion[%d]\nFormat[%s]\nTotal Pages[%d]\n"),
      pszFileName, 
      AnnFileInfo.nVersion,
      pszFormat,
      AnnFileInfo.nTotalPages);
   
   MessageBox(NULL, szMsg, TEXT("Information"), MB_OK);

   GlobalFree(hMem);

   return nRet;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.