FormatCoreSDK.h

//-----------------------------------------------------------------------------

//$Id: FormatCoreSDK.h 267 2007-08-23 04:56:52Z robin $

//

// Copyright (c) 2006 Zanja Technologies, Inc

//

// TRADE SECRETS: PROPRIETARY AND CONFIDENTIAL

// Unpublished material - all rights reserved under the

// Copyright Laws of the United States.

//

// Distributed under license by ESRI, Inc.

// For additional information, contact:

// Environmental Systems Research Institute, Inc.

// 380 New York Street

// Redlands, California, USA 92373

//

/*! \file rasterbase_sdk.h

   \brief Public header for FormatCore Reader Developer Kit

   \author Robin Princeley

   \date $Date: 2007-08-23 08:56:52 +0400 (Thu, 23 Aug 2007) $

   \version $Revision: 267 $

*/

//-----------------------------------------------------------------------------

#if !defined( ESRI_IMAGESERVER_RASTERBASE_RASTERBASESDK_H )

#define ESRI_IMAGESERVER_RASTERBASE_RASTERBASESDK_H

#pragma pack( push, 8 )

#define FORMATCORE_SUCCESS             1 /*!< Successful execution */

#define FORMATCORE_FAILURE             0 /*!< Function call failed */

#define FORMATCORE_INVALID_HANDLE     -1 /*!< File / image handle is invalid */

#define FORMATCORE_INVALID_ARGUMENT   -1 /*!< Unexpected function argument ( null pointer, etc ) */

#define FORMATCORE_PLUGIN_MAX_STRING  256 /*!< Maximum length of static string buffers */

 

#define FC_ColorSpaceUnknown          0 /*!< Colorspace is unknown or undefined */

#define FC_ColorSpaceGray             1 /*!< Grayscale */

#define FC_ColorSpacePalette          2 /*!< Colormap */

#define FC_ColorSpaceRGB              3 /*!< RGB */

#define FC_ColorSpaceCMYK             4 /*!< CMYK */

#define FC_ColorSpaceYCbCr            5 /*!< YCbCr */

#define FC_ColorSpaceYUV              6 /*!< YUV */

#define FC_ColorSpaceLHS              7 /*!< LHS */

#define FC_ColorSpaceYCCK             8 /*!< YCCK */

#define FC_SubsetUnrelated            0 /*!< Unrelated subdataset */

#define FC_SubsetMask                 1 /*!< Image mask */

#define FC_SubsetReducedResolution    2 /*!< Internal overview */

#define FC_SubsetPage                 3 /*!< Next page */

#define FC_SubsetFrame                4 /*!< Next frame */

 

#define FC_LayoutUnknown              0 /*!< Pixel layout is unknown */

#define FC_LayoutBIP                  1 /*!< Band interleaved by pixel */

#define FC_LayoutBIL                  2 /*!< Band interleaved by line */

#define FC_LayoutBSQ                  3 /*!< Band sequential */

#define FC_LayoutTiledBIP             4 /*!< Band interleaved by pixel within tiles */

#define FC_LayoutTiledBIL             5 /*!< Band interleaved by line within tiles */

#define FC_LayoutTiledBSQ             6 /*!< Band sequential within tiles */

 

#define FC_ByteOrderUnknown           0 /*!< Byteorder is unknown */

#define FC_ByteOrderNative            1 /*!< Byteorder is native to the current platform ( no swap ) */

#define FC_ByteOrderForeign           2 /*!< Non native byteorder ( swap ) */

 

#define FC_DataTypeUnknown            0 /*!< Pixel data type is unknown */

#define FC_DataTypeByte               1 /*!< 8 bit unsigned integer */

#define FC_DataTypeSignedInt8         2 /*!< 8 bit signed integer */

#define FC_DataTypeInt16              3 /*!< 16 bit unsigned integer */

#define FC_DataTypeSignedInt16        4 /*!< 16 bit signed integer */

#define FC_DataTypeInt32              5 /*!< 32 bit unsigned integer */

#define FC_DataTypeSignedInt32        6 /*!< 32 bit signed integer */

#define FC_DataTypeInt64              7 /*!< 64 bit unsigned integer */

#define FC_DataTypeSignedInt64        8 /*!< 64 bit signed integer */

#define FC_DataTypeFloat16            9 /*!< 16 bit float ( half ) */

#define FC_DataTypeFloat32            10 /*!< 32 bit float */

#define FC_DataTypeDouble             11 /*!< double precision float ( double or long double ) */

#define FC_DataTypeComplexInt16       12 /*!< 16 bit complex */

#define FC_DataTypeComplexInt32       13 /*!< 32 bit complex */

#define FC_DataTypeComplexInt64       14 /*!< 64 bit complex */

#define FC_DataTypeComplexFloat32     15 /*!< single precision complex */

#define FC_DataTypeComplexDouble      16 /*!< double precision complex */

#define FC_PLUGIN_EXPORT __declspec( dllexport )

#define FC_PLUGIN_CALL __stdcall

 

#if !defined( double_t )

typedef double double_t;

#endif

#if !defined( uint16_t )

typedef unsigned short int uint16_t;

#endif

#if !defined( int16_t )

typedef signed short int int16_t;

#endif

#if !defined( uint32_t )

typedef unsigned long int uint32_t;

#endif

#if !defined( int32_t )

typedef signed long int int32_t;

#endif

#if !defined( byte_t )

typedef unsigned char byte_t;

#endif

 

typedef void* FC_ImageHandle;

 

typedef struct FC_ApplicationData                 /*!< */

{

uint32_t structVersion;                         /*!< Version of the structure, to allow future expansion */

uint32_t structSize;                            /*!< Size of FC_ApplicationData structure */

double formatcoreVersion;                       /*!< Version of FormatCore that's loading the plugin */

void *parent;                                   /*!< Parent object that owns the plugin instance */

} FC_ApplicationData;

typedef struct FC_PluginInformation               /*!< */

{

uint32_t structVersion;                         /*!< Version of the structure, to allow future expansion */

uint32_t structSize;                            /*!< Size of FC_ApplicationData structure */

double formatcoreVersion;                       /*!< Version of FormatCore the plugin was build against ( incase the plugin depends on FormatCore )*/

double pluginVersion;                           /*!< Plugin module's version number */

char name[FORMATCORE_PLUGIN_MAX_STRING];        /*!< Name of the plugin ( backend name ) */

char description[FORMATCORE_PLUGIN_MAX_STRING]; /*!< Plugin description */

char copyright[FORMATCORE_PLUGIN_MAX_STRING];   /*!< Copyright notice */

} FC_PluginInformation;

 

typedef struct FC_ImageInformation                /*!< */

{

uint32_t structVersion;                         /*!< Version of the structure, to allow future expansion */

uint32_t structSize;                            /*!< Size of FC_ApplicationData structure */

uint32_t width;                                 /*!< Image width */

uint32_t height;                                /*!< Image height */

uint32_t bands;                                 /*!< Number of bands */

uint32_t bits;                                  /*!< Bits per band */

uint32_t colorSpace;                            /*!< Image colorspace */

uint32_t dataType;                              /*!< Pixel data type */

uint32_t tileWidth;                             /*!< Tile width ( 0 if not tiled ) */

uint32_t tileHeight;                            /*!< Tile height ( 0 if not tiled ) */

uint32_t layerType;                             /*!< Type of image / dataset */

uint32_t layout;                                /*!< Pixel layout */

uint32_t byteorder;                             /*!< Byteorder */

} FC_ImageInformation;

 

typedef struct FC_ImageROI                        /*!< */

{

uint32_t structVersion;                         /*!< Version of the structure, to allow future expansion */

uint32_t structSize;                            /*!< Size of FC_ApplicationData structure */

uint32_t ulx;                                   /*!< Upper left column */

uint32_t uly;                                   /*!< Upper left row */

uint32_t lrx;                                   /*!< Lower right column */

uint32_t lry;                                   /*!< Lower right row */

} FC_ImageROI;

 

typedef struct FC_ImageColorMapEntry              /*!< */

{

uint16_t red;                                   /*!< Red value */

uint16_t green;                                 /*!< Green value */

uint16_t blue;                                  /*!< Blue value */

uint16_t alpha;                                 /*!< Alpha ( 255 ) */

} FC_ImageColorMapEntry;

 

typedef struct FC_ImageColorMap                   /*!< */

{

uint32_t structVersion;                         /*!< Version of the structure, to allow future expansion */

uint32_t structSize;                            /*!< Size of FC_ApplicationData structure */

FC_ImageColorMapEntry *entries;                 /*!< Colormap entries */

uint32_t length;                                /*!< Number of entries ( 2 ^ bits per band ) */

} FC_ImageColorMap;

 

typedef struct FC_Parameter                       /*!< */

{

const char *name;                               /*!< Parameter name */

const char *value;                              /*!< Parameter value */

} FC_Parameter;

#pragma pack( pop )

#if defined( RB_EXPORT_PLUGIN_FUNCTIONS )

 

/*! \brief Initialization function

   \param[out] info Plugin information to be filled by the plugin DLL

   \param[in] appdata Private application data ( ignore )

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_Initialize( FC_PluginInformation *info,

                                                    const FC_ApplicationData *appdata );

 

/*! \brief Cleanup function

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_Shutdown();

 

/*! \brief Function to create a reader handle

*/

FC_PLUGIN_EXPORT

FC_ImageHandle FC_PLUGIN_CALL FormatCorePlugin_CreateReader();

 

/*! \brief Function to close a reader handle

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_DestroyReader( FC_ImageHandle handle );

/*! \brief Get plugin properties

   \param[in] id Property ID

   \param[out] value Returned value

   \param[in,out] length Length of value buffer

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_GetPluginProperty( uint32_t id,

                                                           char *value,

                                                           uint32_t *length );

/*! \brief Get the number of images in a file

   \param[in] filename Filename

   \param[out] count Number of sub images in file

*/

FC_PLUGIN_EXPORT

uint32_t FC_PLUGIN_CALL FormatCorePlugin_GetImageCount( const char *filename,

                                                        uint32_t *count );

/*! \brief Open an image

   \param[in] filename

   \param[in] layer

   \param[in] slice

   \param[in] parameters

   \param[in] parameterCount

   \param[in] appdata

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_OpenImage( FC_ImageHandle handle,

                                                   const char *filename,

                                                   uint32_t layer,

                                                   uint32_t slice,

                                                   const FC_Parameter *parameters,

                                                   uint32_t parameterCount,

                                                   const FC_ApplicationData *appdata );

/*! \brief Close image

   \param[in] handle

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_CloseImage( FC_ImageHandle handle );

/*! \brief Read image information

   \param[in] handle

   \param[out] info

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_GetImageInformation( FC_ImageHandle handle,

                                                             FC_ImageInformation *info );

/*! \brief Select region of interest

   \param[in] handle,

   \param[in] roi,

   \param[in] rows,

   \param[in] cols,

   \param[in] parameters,

   \param[in] parameter_count

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_SelectImageROI( FC_ImageHandle handle,

                                                        const FC_ImageROI *roi,

                                                        uint32_t rows,

                                                        uint32_t cols,

                                                        FC_Parameter *parameters,

                                                        uint32_t parameter_count );

/*! \brief Get error message

   \param[in] handle

   \param[out] msg

   \param[in,out] length

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_GetErrorMessage( FC_ImageHandle handle,

                                                         char *msg,

                                                         uint32_t *length );

#if defined( RB_EXPORT_PLUGIN_ReadColorMap )

/*! \brief Read image color table

   \param[in] handle

   \param[out] colormap

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_ReadImageColorMap( FC_ImageHandle handle,

                                                           FC_ImageColorMap *colormap );

#endif

#if defined( RB_EXPORT_PLUGIN_ReadImageScanlines )

/*! \brief Read one or more rows of pixels

   \param[in] handle

   \param[in] buffer

   \param[in] startRow

   \param[in] rows

   \param[in] scanlineSize

   \param[in] plane

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_ReadImageScanlines( FC_ImageHandle handle,

                                                            byte_t **buffer,

                                                            uint32_t startRow,

                                                            uint32_t rows,

                                                            size_t scanlineSize,

                                                            uint32_t plane );

#endif

#if defined( RB_EXPORT_PLUGIN_ReadImageTile )

/*! \brief Read a tile

   \param[in] handle

   \param[in] buffer

   \param[in] x

   \param[in] y

   \param[in] plane

*/

FC_PLUGIN_EXPORT

int32_t FC_PLUGIN_CALL FormatCorePlugin_ReadImageTile( FC_ImageHandle handle,

                                                       byte_t *buffer,

                                                       uint32_t x,

                                                       uint32_t y,

                                                       uint32_t plane );

#endif

#endif