1
/* pvn.h by Jacob (Jack) Gryn
3
PVN (PVB/PVG/PVP) Library
5
* the PVN (PVB/PVG/PVP) file format, and this code
6
is (c) 2003,2004 Jacob (Jack) Gryn
8
* the author grants full rights to all who wish to use
9
and distribute this code and the corresponding file
10
formats on the assumption that credit is given to
15
#include "pvnglobals.h"
20
// we need a floating point number that will very rarely get used in the framerate field
21
#define UNDEF_FRAMERATE -0.99098765123
27
{ // or extern "C++" {
30
typedef struct _pvnparam { char magic[5]; unsigned int width; unsigned int height; unsigned int depth; double maxcolour; double framerate; } PVNParam;
32
/* calculates the size of raster data in a PVN file based on a PVNParam
35
returns # of bytes if PV4/PV5/PV6 (a/f/d);
37
long calcPVNSize(PVNParam p);
39
/* calculates the size of raster data of a single image within a PVN file
40
based on a PVNParam header
42
returns # of bytes if PV4/PV5/PV6 (a/f/d);
44
long calcPVNPageSize(PVNParam p);
46
/* Compare two parameter sets; return EQUAL if they are equal,
47
or NOTEQUAL if they are not */
48
int PVNParamCompare(PVNParam first, PVNParam second);
50
/* Copy src parameters to dest
51
returns VALID or ERROR */
52
int PVNParamCopy(PVNParam *dest, PVNParam *src);
54
/* Just retrieve the header
55
returns INVALID if it is not a PNM header
56
VALID if everything is ok */
57
int readPVNHeader(FILE *fp, PVNParam *p);
59
/* write PVN Header to file *fp */
60
int writePVNHeader(FILE *fp, PVNParam p);
62
/* display the pvnparam header to stdout */
63
void showPVNHeader(PVNParam p);
65
/* converts a PVN to another format of PVN
67
infile / outfile = in/output filenames
68
framerate = new framerate; if framerate = NAN, use input framerate
70
maxcolour = new maxcolour / range value (for floats/doubles)
72
int pvnconvert(const char *infile, const char *outfile, double framerate, unsigned int format, double maxcolour);