L_NITFGetGraphicHeader

#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.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

See Also

Functions:

L_NITFCreate, L_NITFGetGraphicHeaderCount, L_NITFSetGraphicHeader

Topics:

NITF Functions: Getting and Setting Header Information

 

Programming with LEADTOOLS NITF Functions

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_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 file 
   nRet =L_NITFCreate (&hNitf, MAKE_IMAGE_PATH(TEXT("test.ntf"))); 
   if(nRet !=SUCCESS) 
      return nRet; 
   // Check if the hNITF is empty or invalid 
   uFlags = 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 header 
   uCount = 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); 
      } 
      else 
         return nRet; 
   } 
   nRet =L_NITFDestroy(&hNitf); 
   if(nRet !=SUCCESS) 
      return nRet; 
   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