L_NITFCreate

#include "ltntf.h"

L_LTNTF_API L_INT L_NITFCreate(phNitf, pszFileName)

Creates an empty NITF file or parses an existing NITF file.

Parameters

pHNITF phNitf

Pointer to a NITF file handle.

L_TCHAR * pszFileName

Character string that contains the name of the NITF file to be parsed.

Returns

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

Comments

L_NITFCreate must be called before calling any other L_NITFXXX functions.

To create an empty NITF file, pass the pszFileName parameter as NULL.

To parse an existing NITF file, pass a valid file name to the pszFileName parameter.

To save the created NITF file, call the L_NITFSaveFile function.

When the NITF file handle is no longer needed, it should be freed by calling L_NITFDestroy function. For every call to L_NITFCreate there must be a call to L_NITFDestroy.

Required DLLs and Libraries

See Also

Functions

Topics

Example

// This example will create an empty NITF file and add image, graphic and text segments

L_INT NITFCreateExample(L_VOID) 
{ 
    
   BITMAPHANDLE Bitmap; 
   HNITF hNitf; 
   VECTORHANDLE Vector; 
   L_INT nRet; 
 
   // Create hNitf Handle 
   nRet =L_NITFCreate(&hNitf, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   // Load and append Image segment 
   nRet =L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("cannon.jpg")), &Bitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet =L_NITFAppendImageSegment(hNitf, &Bitmap, FILE_JPEG, 24, 2); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   // Load and append graphic segment 
   RECT rcViewPort; 
 
   SetRect(&rcViewPort, 0, 0, 640, 480); 
   nRet = L_VecLoadFile(MAKE_IMAGE_PATH(TEXT("random.dxf")), &Vector, NULL, NULL);  
   if(nRet== SUCCESS) 
   { 
      nRet =L_NITFAppendGraphicSegment(hNitf, &Vector, &rcViewPort); 
      if(nRet !=SUCCESS) 
         return nRet; 
   } 
    
   // Free vector handle 
   L_VecFree(&Vector); 
 
   // Append Text segment 
   nRet =L_NITFAppendTextSegment(hNitf, MAKE_IMAGE_PATH(TEXT("2.txt"))); 
   if(nRet !=SUCCESS) 
      return nRet; 
   // Saving hNitf Handle 
   nRet =L_NITFSaveFile(hNitf, MAKE_IMAGE_PATH(TEXT("test.ntf"))); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =L_NITFDestroy(&hNitf); 
   if(nRet !=SUCCESS) 
      return nRet; 
    
   // Free bitmap handle 
   L_FreeBitmap(&Bitmap); 
 
   return SUCCESS; 
} 

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