A Portable Floating-Point-Based Image Format  1.0
Defines | Enumerations | Functions
pfi.h File Reference
#include <stdio.h>
#include <limits.h>
Include dependency graph for debian/tmp/usr/include/pfi.h:

Go to the source code of this file.

Defines

#define PFI_VERSION   "1.2"
#define PFI_EPSILON   (3 * DBL_EPSILON)
#define DLL_EXPORT
#define pfi_htof32(x)   (x)
#define pfi_ftoh32(x)   (x)
#define pfi_htof16(x)   (x)
#define pfi_ftoh16(x)   (x)

Enumerations

enum  { pfi_grey = 0, pfi_rgb, pfi_yuv, pfi_unknown }

Functions

int pfi_getv (FILE *stream, double *valp)
int pfi_putv (FILE *stream, double val)
int pfi_properties (FILE *stream, int *rows, int *cols, int *colors, int *colormodel)
double * pfi_read (FILE *stream, int *rows, int *cols, int *colors, int *colormodel)
int pfi_write (FILE *stream, double *buf, int rows, int cols, int colors, int colormodel, char *fname)
DLL_EXPORT int pfi_read_name (char *name, int rows, int cols, int colors, double *result)
DLL_EXPORT int pfi_write_name (char *name, double *buf, int rows, int cols, int colors, int colormodel)
DLL_EXPORT int pfi_properties_name (char *name, int *rows, int *cols, int *colors, int *colormodel)

Define Documentation

#define DLL_EXPORT

Definition at line 36 of file debian/tmp/usr/include/pfi.h.

#define PFI_EPSILON   (3 * DBL_EPSILON)

Definition at line 28 of file debian/tmp/usr/include/pfi.h.

#define pfi_ftoh16 (   x)    (x)

Definition at line 131 of file debian/tmp/usr/include/pfi.h.

Referenced by pfi_getv().

#define pfi_ftoh32 (   x)    (x)

Definition at line 129 of file debian/tmp/usr/include/pfi.h.

Referenced by pfi_getv().

#define pfi_htof16 (   x)    (x)

Definition at line 130 of file debian/tmp/usr/include/pfi.h.

Referenced by pfi_putv().

#define pfi_htof32 (   x)    (x)

Definition at line 128 of file debian/tmp/usr/include/pfi.h.

Referenced by pfi_putv().

#define PFI_VERSION   "1.2"

Definition at line 26 of file debian/tmp/usr/include/pfi.h.


Enumeration Type Documentation

anonymous enum

Colormodel specifier. Either greyscale, rgb or yuv.

Enumerator:
pfi_grey 
pfi_rgb 
pfi_yuv 
pfi_unknown 

Definition at line 136 of file debian/tmp/usr/include/pfi.h.


Function Documentation

int pfi_getv ( FILE *  stream,
double *  valp 
)

Reads a double value from an open pfi file

Parameters:
streamThe open file.
valpA reference to the value to be read.
Returns:
0 on success, else -1.

Definition at line 380 of file pfi.c.

Referenced by pfi_read_internal().

int pfi_properties ( FILE *  stream,
int *  rows,
int *  cols,
int *  colors,
int *  colormodel 
)

Gets the pfi image properties from an open file.

Parameters:
streamThe open file.
rowsA reference to the number of rows to be determined from the image header.
colsA reference to the number of cols to be determined from the image header.
colorsA reference to the number of colors to be determined from the image header.
colormodelA reference to an integer to represent the colormodel used in this image to be determined from the image header. We use 0 for none (greyscale), 1 for RGB etc.
Returns:
success: 0, else -1.

Definition at line 489 of file pfi.c.

Referenced by pfi_properties_name(), and pfi_read().

DLL_EXPORT int pfi_properties_name ( char *  name,
int *  rows,
int *  cols,
int *  colors,
int *  colormodel 
)

Gets the pfi image properties from an image file.

Parameters:
nameThe file name.
rowsA reference to the number of rows to be determined from the image header.
colsA reference to the number of cols to be determined from the image header.
colorsA reference to the number of colors to be determined from the image header.
colormodelA reference to an integer to represent the colormodel used in this image to be determined from the image header. We use 0 for none (greyscale), 1 for RGB etc.
Returns:
success: 0, else -1.

Definition at line 888 of file pfi.c.

int pfi_putv ( FILE *  stream,
double  val 
)

Writes a double value into an open pfi file.

Parameters:
streamThe open file.
valThe value to be written.
Returns:
0 on success, else -1.

Definition at line 428 of file pfi.c.

Referenced by pfi_write().

double* pfi_read ( FILE *  stream,
int *  rows,
int *  cols,
int *  colors,
int *  colormodel 
)

Reads a pfi image from an open file.

Parameters:
streamThe open file.
rowsA reference to the number of rows to be determined from the image header.
colsA reference to the number of cols to be determined from the image header.
colorsA reference to the number of colors to be determined from the image header.
colormodelA reference to an integer to represent the colormodel used in this image to be determined from the image header. We use 0 for none (greyscale), 1 for RGB etc.
Returns:
A new double array containing the image. The colors are stored one after another, so we've got pixel one with all colors first, then pixel two etc. In case of error, NULL is returned

Definition at line 654 of file pfi.c.

DLL_EXPORT int pfi_read_name ( char *  name,
int  rows,
int  cols,
int  colors,
double *  result 
)

Reads a pfi image.

Parameters:
nameThe file name.
rowsthe number of rows
colsthe number of cols
colorsthe number of colors
resultA double array containing the image. The colors are stored one after another, so we've got pixel one with all colors first, then pixel two etc.
Returns:
0 if successful, else -1

Definition at line 770 of file pfi.c.

int pfi_write ( FILE *  stream,
double *  buf,
int  rows,
int  cols,
int  colors,
int  colormodel,
char *  fname 
)

Writes a pfi image to an open file.

Parameters:
streamThe open file.
bufA reference to the buffer containing the image. The colors are stored one after another, so we've got pixel one with all colors first, then pixel two etc.
rowsA reference to the number of rows to be determined from the image header.
colsA reference to the number of cols to be determined from the image header.
colorsA reference to the number of colors to be determined from the image header.
colorsA reference to the number of colors to be determined from the image header.
colormodelAn integer to represent the colormodel used in this image. We use 0 for none (greyscale), 1 for RGB etc.
fnameThe name which will be written to the file header.
Returns:
0 on success, else -1.

Definition at line 715 of file pfi.c.

Referenced by pfi_write_name().

DLL_EXPORT int pfi_write_name ( char *  name,
double *  buf,
int  rows,
int  cols,
int  colors,
int  colormodel 
)

Opens and writes a pfi image.

Parameters:
nameThe file name.
bufA reference to the buffer containing the image. The colors are stored one after another, so we've got pixel one with all colors first, then pixel two etc.
rowsA reference to the number of rows to be determined from the image header.
colsA reference to the number of cols to be determined from the image header.
colorsA reference to the number of colors to be determined from the image header.
colorsA reference to the number of colors to be determined from the image header.
colormodelAn integer to represent the colormodel used in this image. We use 0 for none (greyscale), 1 for RGB etc.
Returns:
0 on success, else -1.

Definition at line 833 of file pfi.c.