#include "ltntf.h"
L_LTNTF_API L_INT L_NITFGetGraphicHeader(hNitf, uIndex, pGraphicHeader)
HNITF hNitf; |
handle to an existing NITF file |
L_UINT uIndex; |
index of the graphics data |
pGRAPHICHEADER pGraphicHeader; |
pointer to a GRAPHICHEADER structure |
Retrieves the graphic header information of a specific graphic segment.
Parameter |
Description |
hNitf |
Handle to an existing NITF file, created by calling the L_NITFCreate function. |
uIndex |
A zero-based index of the graphic segment in the hNitf handle. |
pGraphicHeader |
Pointer to a GRAPHICHEADER structure to be updated with the graphic header information of the specified graphic segment at the index uIndex. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
To retrieve the number of the graphic segments available in the hNitf handle, call the L_NITFGetGraphicHeaderCount function.
To change the graphic header information for a specific graphic segment, call the L_NITFSetGraphicHeader function.
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. |
Functions: |
L_NITFCreate, L_NITFGetGraphicHeaderCount, L_NITFSetGraphicHeader |
Topics: |
|
|
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileNameL_INT NITFGetGraphicHeaderExample(L_VOID){HNITF hNitf;L_UINT uFlags = 0;GRAPHICHEADER GraphicHeader;L_UINT uCount;L_UINT i = 0;L_INT nRet;memset(&GraphicHeader, 0, sizeof(GRAPHICHEADER));// Create hNitf handle and parse the NITF filenRet =L_NITFCreate (&hNitf, MAKE_IMAGE_PATH(TEXT("test.ntf")));if(nRet !=SUCCESS)return nRet;// Check if the hNITF is empty or invaliduFlags = L_NITFGetStatus(hNitf);if((uFlags & NITF_FILE_EMPTY) == NITF_FILE_EMPTY){MessageBox(NULL,TEXT("NITF file is empty"),NULL,MB_OK);return FAILURE;}if((uFlags & NITF_FILE_VALID) != NITF_FILE_VALID){MessageBox(NULL,TEXT("NITF file is invalid"),NULL,MB_OK);return FAILURE;}// Update the graphic headeruCount = L_NITFGetGraphicHeaderCount(hNitf);for( i = 0; i < uCount; ++i){memset(&GraphicHeader, 0, sizeof(GraphicHeader));nRet = L_NITFGetGraphicHeader(hNitf, i, &GraphicHeader) ;if(nRet == SUCCESS){GraphicHeader.nSBND1Row = 20;GraphicHeader.nSBND1Col = 50;GraphicHeader.nSBND2Row = 200;GraphicHeader.nSBND2Col = 400;nRet =L_NITFSetGraphicHeader(hNitf, i, &GraphicHeader);if(nRet !=SUCCESS)return nRet;L_NITFFreeGraphicHeader(&GraphicHeader);}elsereturn nRet;}nRet =L_NITFDestroy(&hNitf);if(nRet !=SUCCESS)return nRet;return SUCCESS;}