26 |
|
|
27 |
|
/* Allocated BMP header data */ |
28 |
|
typedef struct { |
29 |
< |
/* the following fields may be altered before open call */ |
29 |
> |
/* the following fields may be altered before the open call */ |
30 |
|
int yIsDown; /* scanlines proceed downward? */ |
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 */ |
35 |
< |
/* the following fields should not be altered after allocation */ |
35 |
> |
int compr; /* compression */ |
36 |
|
int32 width; /* bitmap width (pixels) */ |
37 |
|
int32 height; /* bitmap height (pixels) */ |
38 |
+ |
/* the following fields must not be altered after allocation */ |
39 |
|
int bpp; /* bits per sample (1,4,8,16,24,32) */ |
39 |
– |
int compr; /* compression */ |
40 |
|
uint32 infoSiz; /* info buffer size (bytes) */ |
41 |
< |
/* the color table should be filled by writer before open call */ |
41 |
> |
/* but the color table should be filled by writer before open call */ |
42 |
|
RGBquad palette[3]; /* color palette (extends struct) */ |
43 |
|
} BMPHeader; |
44 |
– |
|
45 |
– |
/* color palette length */ |
46 |
– |
#define BMPpalLen(h) ((h)->bpp <= 8 ? 1<<(h)->bpp : 0) |
44 |
|
|
45 |
|
/* access to bit field triple */ |
46 |
|
#define BMPbitField(h) ((uint32 *)(h)->palette) |
47 |
|
|
48 |
|
/* info buffer access */ |
49 |
< |
#define BMPinfo(h) ((char *)((h)->palette + BMPpalLen(h))) |
49 |
> |
#define BMPinfo(h) ((char *)((h)->palette + (h)->nColors)) |
50 |
|
|
51 |
|
/* function return values */ |
52 |
|
#define BIR_OK 0 /* all is well */ |
75 |
|
typedef struct { |
76 |
|
/* the scanline data is filled in by caller before each write */ |
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 by the caller */ |
80 |
> |
/* the following fields should not be altered directly */ |
81 |
|
BMPHeader *hdr; /* allocated header */ |
82 |
|
uint32 fbmp; /* beginning of bitmap data */ |
83 |
|
uint32 fpos; /* current file position */ |