9 static unsigned int get_2(
const unsigned char **
q)
11 const unsigned char *p = *
q;
12 unsigned int n = (p[0] << 0) | (p[1] << 8);
18 static unsigned int get_4(
const unsigned char **q)
20 const unsigned char *p = *
q;
21 unsigned int n = (p[0] << 0) | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
27 static int read_bmp_header(
const unsigned char *p)
45 if (get_4(&p) !=
width)
47 if (get_4(&p) != -height)
56 if (get_4(&p) !=
width * height * 4)
81 if (fread(header,
sizeof(header), 1, input) != 1)
84 if (!read_bmp_header(header))
88 for (x = 0; x <
width; x++, p++) {
unsigned int get_color(int r, int g, int b, int a)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.