To read a palette from an HDF file, the calling program must contain the following routines:
C: status = DFPgetpal(filename, palette); FORTRAN: status = dpgpal(filename,palette)
DFPgetpal retrieves the next palette from the HDF file specified by filename. The space allocated for the palette is specified by palette and must be at least 768 bytes. When DFPgetpal is first called, it returns the first palette in the file. Subsequent calls to DFPgetpal will return successive palettes in the order in which they are stored in the file, including those stored via the DFR8 interface.
TABLE 9D DFPgetpal Parameter List
C:
#include "hdf.h" main( ) { uint8 palette_data[768]; intn status; /* Read the palette data from a file. */ status = DFPgetpal("Example1.hdf", (VOIDP)palette_data); }
PROGRAM READ PALETTE integer dpgpal, status character palette_data(768) C Read the palette from the HDF file. status = dpgpal('Example1.hdf', palette_data) end
9.5.2 Reading a Palette with a Given Reference Number: DFPreadref
DFPreadref is used to access specific palettes stored in files containing multiple palettes. It is the optionally called before DFPgetpal to set the next palette to be accessed to be the specified palette. DFPreadref can be used in connection with vgroups, which identify their members by tag/reference number pair.
C: true_false = DFPreadref(filename, ref); status = DFPgetpal(filename, palette);
FORTRAN: true_false = dprref(filename, ref) status = dpgpal(filename, palette)
DFPreadref specifies the reference number for the next read operation performed on the HDF file filename to the reference number specified by ref.
TABLE 9E DFPreadref Parameter List
C: status = DFPrestart( ); FORTRAN: status = dprest( )