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: |
|
Topics: |
|
|
Example
// This example will create an empty NITF file and add image, graphic and text segments
L_LTNTFTEX_API L_INT NITFCreateExample(L_VOID) { BITMAPHANDLE Bitmap; HNITF hNitf; VECTORHANDLE Vector; L_INT nRet; L_UnlockSupport(L_SUPPORT_VECTOR, L_KEY_VECTOR); // Create hNitf Handle nRet =L_NITFCreate(&hNitf, NULL); if(nRet !=SUCCESS) return nRet; // Load and append Image segment nRet =L_LoadBitmap(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\parrots.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(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\1.dxf"), &Vector, NULL, NULL); if(nRet== SUCCESS) { nRet =L_NITFAppendGraphicSegment(hNitf, &Vector, &rcViewPort); if(nRet !=SUCCESS) return nRet; } // Append Text segment nRet =L_NITFAppendTextSegment(hNitf, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\2.txt")); if(nRet !=SUCCESS) return nRet; // Saving hNitf Handle nRet =L_NITFSaveFile(hNitf, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\test.ntf")); if(nRet !=SUCCESS) return nRet; nRet =L_NITFDestroy(&hNitf); if(nRet !=SUCCESS) return nRet; return SUCCESS; }