-
Notifications
You must be signed in to change notification settings - Fork 0
/
fileio.h
58 lines (49 loc) · 2.29 KB
/
fileio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* fileio.h
*
* HISTORY:
* quick and dirty hack Linas Vepstas October 1989
* more hacks ever since -- Linas
*/
#ifdef __cplusplus
extern "C" {
#endif
/*-------------------------------------------------------------------*/
// Read a *.flo greyscale floating-point pixmap.
// The file format is width, height in ascii, then newline
// then floating point data in machine-native byte order.
// One float per pixel, a total of width*height floats.
float* read_flo_file(const char *fname,
unsigned int* data_width, unsigned int* data_height);
/*-------------------------------------------------------------------*/
// Read a *.pfm greyscale floating-point pixmap.
// This reads the PFM file format as described in various places.
float* read_pfm_file(const char *fname,
unsigned int* data_width, unsigned int* data_height);
/*-------------------------------------------------------------------*/
// Auto-handle above types
float* read_floats(const char *fname, const char** suff,
unsigned int* data_width, unsigned int* data_height);
/*-------------------------------------------------------------------*/
// Write a *.flo greyscale floating-point pixmap.
// The file format is width, height in ascii, then newline
// then floating point data in machine-native byte order.
// One float per pixel, a total of width*height floats.
void write_flo_file(const char *fname, float* data,
unsigned int data_width, unsigned int data_height);
/*-------------------------------------------------------------------*/
// Write a *.pfm greyscale floating-point pixmap.
// The file format is width, height in ascii, then newline
// then floating point data in machine-native byte order.
// One float per pixel, a total of width*height floats.
void write_pfm_file(const char *fname, float* data,
unsigned int data_width, unsigned int data_height);
/*-------------------------------------------------------------------*/
// Auto-handle above types
void write_floats(const char *fname, const char* suff, float* data,
unsigned int data_width, unsigned int data_height);
/*-------------------------------------------------------------------*/
#ifdef __cplusplus
};
#endif
/* --------------- END OF FILE ------------------------- */