ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bmpfile.h
(Generate patch)

Comparing ray/src/common/bmpfile.h (file contents):
Revision 2.7 by greg, Tue Jan 10 18:24:53 2017 UTC vs.
Revision 2.8 by greg, Tue Sep 5 18:41:22 2017 UTC

# Line 31 | Line 31 | typedef struct {
31          int32           hRes;           /* horizontal resolution pixels/meter */
32          int32           vRes;           /* vertical resolution pixels/meter */
33          int             nColors;        /* total color palette size */
34 <        int             impColors;      /* number of colors actually used */
34 >        int             impColors;      /* number of colors actually used */
35          int             compr;          /* compression */
36          int32           width;          /* bitmap width (pixels) */
37          int32           height;         /* bitmap height (pixels) */
# Line 39 | Line 39 | typedef struct {
39          int             bpp;            /* bits per sample (1,4,8,16,24,32) */
40          uint32          infoSiz;        /* info buffer size (bytes) */
41          /* but the color table should be filled by writer before open call */
42 <        RGBquad         palette[3];     /* color palette (extends struct) */
42 >        RGBquad         palette[3];     /* color palette (extends struct) */
43   } BMPHeader;
44                                  
45                                          /* access to bit field triple */
46 < #define BMPbitField(h)  ((uint32 *)(h)->palette)
46 > #define BMPbitField(h)  ((uint32 *)(h)->palette)
47  
48                                          /* info buffer access */
49 < #define BMPinfo(h)      ((char *)((h)->palette + (h)->nColors))
49 > #define BMPinfo(h)      ((char *)((h)->palette + (h)->nColors))
50  
51                                          /* function return values */
52   #define BIR_OK                  0               /* all is well */
# Line 59 | Line 59 | typedef struct {
59   /* A BMP reader structure */
60   typedef struct BMPReader {
61          /* members in this structure should be considered read-only */
62 <        uint8           *scanline;      /* unpacked scanline data */
62 >        uint8           *scanline;      /* unpacked scanline data */
63          int             yscan;          /* last scanline read */
64 <        BMPHeader       *hdr;           /* pointer to allocated header */
64 >        BMPHeader       *hdr;           /* pointer to allocated header */
65          uint32          fpos;           /* current file position */
66                                          /* get character callback */
67          int             (*cget)(void *);
68                                          /* absolute seek callback (or NULL) */
69          int             (*seek)(uint32, void *);
70          void            *c_data;        /* client's opaque data */
71 <        uint32          scanpos[1];     /* recorded scanline position(s) */
71 >        uint32          scanpos[1];     /* recorded scanline position(s) */
72   } BMPReader;
73  
74   /* A BMP writer structure */
75   typedef struct {
76          /* the scanline data is filled in by caller before each write */
77 <        uint8           *scanline;      /* caller-prepared scanline data */
77 >        uint8           *scanline;      /* caller-prepared scanline data */
78          /* modify yscan only if seek is defined & data is uncompressed */
79          int             yscan;          /* scanline for next write */
80          /* the following fields should not be altered directly */
81 <        BMPHeader       *hdr;           /* allocated header */
81 >        BMPHeader       *hdr;           /* allocated header */
82          uint32          fbmp;           /* beginning of bitmap data */
83          uint32          fpos;           /* current file position */
84          uint32          flen;           /* last character written */
# Line 90 | Line 90 | typedef struct {
90   } BMPWriter;
91  
92                                          /* open BMP stream for reading */
93 < extern BMPReader       *BMPopenReader(int (*cget)(void *),
93 > extern BMPReader        *BMPopenReader(int (*cget)(void *),
94                                  int (*seek)(uint32, void *), void *c_data);
95  
96                                          /* determine if image is grayscale */
# Line 109 | Line 109 | extern RGBquad         BMPdecodePixel(int i, const BMPReader
109   extern void             BMPfreeReader(BMPReader *br);
110  
111                                          /* allocate uncompressed RGB header */
112 < extern BMPHeader       *BMPtruecolorHeader(int xr, int yr, int infolen);
112 > extern BMPHeader        *BMPtruecolorHeader(int xr, int yr, int infolen);
113  
114                                          /* allocate color-mapped header */
115 < extern BMPHeader       *BMPmappedHeader(int xr, int yr, int infolen, int ncolors);
115 > extern BMPHeader        *BMPmappedHeader(int xr, int yr, int infolen, int ncolors);
116  
117                                          /* open BMP stream for writing */
118   extern BMPWriter        *BMPopenWriter(void (*cput)(int, void *),
# Line 126 | Line 126 | extern int             BMPwriteScanline(BMPWriter *bw);
126   extern void             BMPfreeWriter(BMPWriter *bw);
127  
128                                          /* get corresponding error message */
129 < extern const char      *BMPerrorMessage(int ec);
129 > extern const char       *BMPerrorMessage(int ec);
130  
131                                          /* stdio callback functions */
132   extern int              stdio_getc(void *p);
# Line 134 | Line 134 | extern void            stdio_putc(int c, void *p);
134   extern int              stdio_fseek(uint32 pos, void *p);
135  
136                                          /* open stdio input stream */
137 < #define BMPopenInputStream(fp)  BMPopenReader(&stdio_getc, NULL, (void *)fp)
137 > #define BMPopenInputStream(fp)  BMPopenReader(&stdio_getc, NULL, (void *)fp)
138  
139                                          /* open input file */
140 < #define BMPopenInputFile(fn)    BMPopenReader(&stdio_getc, &stdio_fseek, \
140 > #define BMPopenInputFile(fn)    BMPopenReader(&stdio_getc, &stdio_fseek, \
141                                          (void *)fopen(fn, "rb"))
142  
143                                          /* close stdio input file or stream */
144 < #define BMPcloseInput(br)       ( fclose((FILE *)(br)->c_data), \
144 > #define BMPcloseInput(br)       ( fclose((FILE *)(br)->c_data), \
145                                          BMPfreeReader(br) )
146  
147                                          /* open stdio output stream */
# Line 154 | Line 154 | extern int             stdio_fseek(uint32 pos, void *p);
154                                          (void *)fopen(fn, "wb"), hdr)
155  
156                                          /* close stdio output file or stream */
157 < #define BMPcloseOutput(bw)      ( fclose((FILE *)(bw)->c_data), \
157 > #define BMPcloseOutput(bw)      ( fclose((FILE *)(bw)->c_data), \
158                                          BMPfreeWriter(bw) )
159  
160   #ifdef __cplusplus

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines