| 39 |
|
int compr; /* compression */ |
| 40 |
|
uint32 infoSiz; /* info buffer size (bytes) */ |
| 41 |
|
/* the color table should be filled by writer before open call */ |
| 42 |
< |
RGBquad palette[2]; /* color palette (extends struct) */ |
| 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) |
| 47 |
+ |
|
| 48 |
+ |
/* access to bit field triple */ |
| 49 |
+ |
#define BMPbitField(h) ((uint32 *)(h)->palette) |
| 50 |
|
|
| 51 |
|
/* info buffer access */ |
| 52 |
|
#define BMPinfo(h) ((char *)((h)->palette + BMPpalLen(h))) |
| 56 |
|
#define BIR_EOF (-1) /* reached end of file */ |
| 57 |
|
#define BIR_TRUNCATED 1 /* unexpected EOF */ |
| 58 |
|
#define BIR_UNSUPPORTED 2 /* unsupported encoding */ |
| 59 |
< |
#define BIR_SEEKERR 3 /* could not seek */ |
| 59 |
> |
#define BIR_RLERROR 3 /* RLE error */ |
| 60 |
> |
#define BIR_SEEKERR 4 /* could not seek */ |
| 61 |
|
|
| 62 |
|
/* A BMP reader structure */ |
| 63 |
|
typedef struct BMPReader { |
| 105 |
|
int BMPseekScanline(int y, BMPReader *br); |
| 106 |
|
|
| 107 |
|
/* get ith pixel from last scanline */ |
| 108 |
< |
RGBquad BMPdecodePixel(int i, BMPReader *br); |
| 108 |
> |
RGBquad BMPdecodePixel(int i, const BMPReader *br); |
| 109 |
|
|
| 110 |
|
/* free BMP reader resources */ |
| 111 |
|
void BMPfreeReader(BMPReader *br); |