#ifndef ndspy_h
#define ndspy_h
#include <stdio.h>
#include <stdlib.h>
#include <uparam.h>
#ifdef _WIN32
# define ALWAYS_IMPORT __declspec(dllimport)
# define ALWAYS_EXPORT __declspec(dllexport)
#else
# define ALWAYS_IMPORT
# if __GNUC__ >= 4
# define ALWAYS_EXPORT __attribute__ ((visibility("default")))
# else
# define ALWAYS_EXPORT
# endif
#endif
#define INTERFACE ALWAYS_IMPORT
#ifdef __cplusplus
# define EXTERN_C extern "C"
#else
# define EXTERN_C
#endif
#define PkDspyMaxMsgSize 32760
#define PkDspyServerMsgOpen (65 + 1)
#define PkDspyServerMsgImage (65 + 2)
#define PkDspyServerMsgData (65 + 3)
#define PkDspyServerMsgQuery (65 + 4)
#define PkDspyServerMsgClose (65 + 5)
typedef double PtDspyFloat64;
typedef float PtDspyFloat32;
#if defined(__mips)
#define PkDspyByteOrderNative PkDspyByteOrderHiLo
#elif defined(__mips64)
#define PkDspyByteOrderNative PkDspyByteOrderHiLo
#elif defined(__sparc)
#define PkDspyByteOrderNative PkDspyByteOrderHiLo
#elif defined(__alpha)
#define PkDspyByteOrderNative PkDspyByteOrderLoHi
#else
#define PkDspyByteOrderNative PkDspyByteOrderLoHi
#endif
#if defined(__mips64) || defined(__alpha)
typedef unsigned int PtDspyUnsigned32;
typedef int PtDspySigned32;
#else
typedef unsigned long PtDspyUnsigned32;
typedef long PtDspySigned32;
#endif
typedef unsigned short PtDspyUnsigned16;
typedef short PtDspySigned16;
typedef unsigned char PtDspyUnsigned8;
typedef char PtDspySigned8;
typedef PtDspyUnsigned32 PtDspyMsgLen;
typedef PtDspyUnsigned32 PtDspyServerMessage;
#define PkDspyClassFloat 1
#define PkDspyClassInt 2
#define PkDspyNone 0
#define PkDspyFloat32 1
#define PkDspyFloat16 12
#define PkDspyUnsigned32 2
#define PkDspySigned32 3
#define PkDspyUnsigned16 4
#define PkDspySigned16 5
#define PkDspyUnsigned8 6
#define PkDspySigned8 7
#define PkDspyString 8
#define PkDspyMatrix 9
#define PkDspyArrayBegin 10
#define PkDspyArrayEnd 11
#define PkDspyMaskType 8191
#define PkDspyMaskOrder (PkDspyByteOrderHiLo | PkDspyByteOrderLoHi)
#define PkDspyShiftOrder 13
#define PkDspyByteOrderHiLo 8192
#define PkDspyByteOrderLoHi 16384
struct PtDspyDeepSample
{
float Z, ZBack;
float A[3];
float U[1];
#ifdef __cplusplus
private:
PtDspyDeepSample();
PtDspyDeepSample( const PtDspyDeepSample& );
void operator=( const PtDspyDeepSample& );
#endif
};
typedef struct
{
char ID[8];
int xSPP, ySPP;
int xBegin, yBegin;
int xEnd, yEnd;
int xFilterExtraPixels, yFilterExtraPixels;
float *xFilterCoefficients, *yFilterCoefficients;
unsigned numChannels;
unsigned numDeepPixels;
unsigned *deepPixelOffsets;
float *deepData;
} PtDspyDeepData;
typedef struct
{
const char *name;
unsigned type;
} PtDspyDevFormat;
typedef struct
{
PtDspyUnsigned32 width;
PtDspyUnsigned32 height;
PtDspyFloat32 aspectRatio;
} PtDspySizeInfo;
typedef struct
{
PtDspyUnsigned8 overwrite;
PtDspyUnsigned8 unused;
} PtDspyOverwriteInfo;
typedef struct
{
PtDspyUnsigned8 redraw;
} PtDspyRedrawInfo;
typedef struct
{
PtDspyUnsigned8 cooked;
} PtDspyCookedInfo;
typedef enum
{
PkDspyCQDefault = 1,
PkDspyCQDeep = 3
} PtDspyCookedQueryValue;
typedef struct
{
PtDspyUnsigned8 multithread;
} PtDspyThreadInfo;
typedef struct
{
PtDspyUnsigned8 acceptProgressive;
} PtDspyProgressiveInfo;
typedef enum
{
PkSizeQuery,
PkOverwriteQuery,
PkNextDataQuery,
PkRedrawQuery,
PkCookedQuery = 100,
PkThreadQuery,
PkProgressiveQuery,
PkStopQuery,
PkPreBucketFunctionQuery,
PkRenderStatistics,
PkRenderProgress,
PkBucketVersion,
PkPreRenderProgress,
PkPreRenderAutoProgress
} PtDspyQueryType;
typedef enum
{
PkDspyErrorNone = 0,
PkDspyErrorNoMemory,
PkDspyErrorUnsupported,
PkDspyErrorBadParams,
PkDspyErrorNoResource,
PkDspyErrorUndefined,
PkDspyErrorStop
} PtDspyError;
#define PkDspyFlagsWantsScanLineOrder 1
#define PkDspyFlagsWantsEmptyBuckets 2
#define PkDspyFlagsWantsNullEmptyBuckets 4
typedef struct
{
int flags;
} PtFlagStuff;
typedef void * PtDspyImageHandle;
typedef void * PtDspyChannel;
typedef void * PtDspyOutput;
EXTERN_C ALWAYS_EXPORT PtDspyError
DspyImageOpen(PtDspyImageHandle * image,
const char *drivername,
const char *filename,
int width,
int height,
int paramCount,
const UserParameter *parameters,
int iFormatCount,
PtDspyDevFormat *format,
PtFlagStuff *flagstuff);
EXTERN_C ALWAYS_EXPORT PtDspyError
DspyImageData(PtDspyImageHandle image,
int xmin,
int xmax,
int ymin,
int ymax,
int entrysize,
const unsigned char *data);
EXTERN_C ALWAYS_EXPORT PtDspyError
DspyImageClose(PtDspyImageHandle);
EXTERN_C ALWAYS_EXPORT PtDspyError
DspyImageReopen(PtDspyImageHandle image,
const char *drivername,
const char *filename,
int width,
int height,
int paramCount,
const UserParameter *parameters,
int iFormatCount,
PtDspyDevFormat *format,
PtFlagStuff *flagstuff);
EXTERN_C ALWAYS_EXPORT PtDspyError
DspyImageDelayClose(PtDspyImageHandle);
EXTERN_C ALWAYS_EXPORT PtDspyError
DspyImageQuery(PtDspyImageHandle,
PtDspyQueryType,
int,
void *);
typedef PtDspyError
(*PtDspyOpenFuncPtr)(
PtDspyImageHandle * image,
const char *drivername,
const char *filename,
int width,
int height,
int paramCount,
const UserParameter *parameters,
int iFormatCount,
PtDspyDevFormat *format,
PtFlagStuff *flagstuff);
typedef PtDspyError
(*PtDspyWriteFuncPtr)(
PtDspyImageHandle image,
int xmin,
int xmax_plus_one,
int ymin,
int ymax_plus_one,
int entrysize,
const unsigned char *data);
typedef PtDspyError
(*PtDspyCloseFuncPtr)(PtDspyImageHandle);
typedef PtDspyError
(*PtDspyFlushFuncPtr)(PtDspyImageHandle);
typedef PtDspyError
(*PtDspyReopenFuncPtr)(
PtDspyImageHandle image,
const char *drivername,
const char *filename,
int width,
int height,
int paramCount,
const UserParameter *parameters,
int iFormatCount,
PtDspyDevFormat *format,
PtFlagStuff *flagstuff);
typedef PtDspyError
(*PtDspyDelayCloseFuncPtr)(PtDspyImageHandle);
typedef PtDspyError
(*PtDspyQueryFuncPtr)(
PtDspyImageHandle,
PtDspyQueryType,
int ,
void * );
typedef PtDspyError
(*PtDspyActiveRegionFuncPtr)(PtDspyImageHandle image,
int xmin,
int xmax_plus_one,
int ymin,
int ymax_plus_one );
typedef PtDspyError
(*PtDspyPreBucketFuncPtr)(PtDspyImageHandle image,
int xmin,
int xmax_plus_one,
int ymin,
int ymax_plus_one,
int pass,
int flags );
typedef PtDspyError (*PtDspyVersionFuncPtr)(PtDspyImageHandle, int);
typedef PtDspyError
(*PtDspyRenderStatisticsFuncPtr)(PtDspyImageHandle image, void * );
typedef PtDspyError
(*PtDspyRenderProgressFuncPtr)(PtDspyImageHandle image, float progress);
typedef PtDspyError
(*PtDspyRenderAutoProgressFuncPtr)(
PtDspyImageHandle image,
float progress_from,
float progress_to,
float duration,
const char* step);
typedef enum
{
k_PtDriverUnknownVersion = 0,
k_PtDriverCurrentVersion = 1
} PtDriverVersion;
typedef struct
{
int Version;
PtDspyOpenFuncPtr pOpen;
PtDspyWriteFuncPtr pWrite;
PtDspyCloseFuncPtr pClose;
PtDspyQueryFuncPtr pQuery;
PtDspyActiveRegionFuncPtr pActiveRegion;
} PtDspyDriverFunctionTable;
EXTERN_C INTERFACE void
DspyMemReverseCopy(
unsigned char *t,
const unsigned char *s,
int len );
EXTERN_C INTERFACE void
DspyMemReverse(
unsigned char *t,
int len );
EXTERN_C INTERFACE PtDspyError
DspyFindStringInParamList(
const char *name,
char **result,
int paramCount,
const UserParameter *parameters );
EXTERN_C INTERFACE PtDspyError
DspyFindMatrixInParamList(
const char *name,
float *result,
int paramCount,
const UserParameter *parameters );
EXTERN_C INTERFACE PtDspyError
DspyFindFloatInParamList(
const char *name,
float *result,
int paramCount,
const UserParameter *parameters );
EXTERN_C INTERFACE PtDspyError
DspyFindFloatsInParamList(
const char *name,
int *resultCount,
float *result,
int paramCount,
const UserParameter *parameters );
EXTERN_C INTERFACE PtDspyError
DspyFindIntInParamList(
const char *name,
int *result,
int paramCount,
const UserParameter *parameters );
EXTERN_C INTERFACE PtDspyError
DspyFindIntsInParamList(
const char *name,
int *resultCount,
int *result,
int paramCount,
const UserParameter *parameters );
EXTERN_C INTERFACE PtDspyError
DspyReorderFormatting(
int formatCount,
PtDspyDevFormat *format,
int outFormatCount,
const PtDspyDevFormat *outFormat );
EXTERN_C INTERFACE void
DspyError(
const char *module,
const char *fmt,
... );
EXTERN_C INTERFACE PtDspyError
DspyRegisterDriver(
const char *driver_name,
const PtDspyOpenFuncPtr pOpen,
const PtDspyWriteFuncPtr pWrite,
const PtDspyCloseFuncPtr pClose,
const PtDspyQueryFuncPtr pQuery );
EXTERN_C INTERFACE PtDspyError
DspyRegisterDriverTable(
const char *driver_name,
const PtDspyDriverFunctionTable *pTable );
#endif