L_NITFCreate

#include "ltntf.h"

L_LTNTF_API L_INT L_NITFCreate(phNitf, pszFileName)

pHNITF phNitf;

pointer to a NITF file handle

L_TCHAR * pszFileName;

file name

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

Parameter

Description

phNitf

Pointer to a NITF file handle.

pszFileName

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

Returns

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

LTNTF

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_NITFDestroy, L_NITFSaveFile

Topics:

NITF Functions: General Functionality

 

Programming with LEADTOOLS NITF Functions

Example

// This example will create an empty NITF file and add image, graphic and text segments 
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS NITF C API Help