38getmbi (
int (*getin) (
void *in),
void *in)
48 mbi = (mbi << 7) | (i & 0x7f);
73 accu += i & 0x7f << 7 * cnt++;
76 for (l = cnt - 1; l > 0; l--)
77 putout (0x80 | (i & 0x7f << 7 * l) >> 7 * l,
out);
79 putout (i & 0x7f,
out);
124 if (
overflow2(
sizeof (
int) * width, height)) {
138 for (i = 0; i < width * height; wbmp->
bitmap[i++] =
color);
154 int row, col, byte, pel,
pos;
160 wbmp->
type = getin (in);
175 if (wbmp->
width == -1)
206 printf (
"DATA CONSTRUCTED\n");
210 for (row = 0; row < wbmp->
height; row++)
212 for (col = 0; col < wbmp->
width;)
216 for (pel = 7; pel >= 0; pel--)
218 if (col++ < wbmp->
width)
269 for (row = 0; row < wbmp->
height; row++)
273 for (col = 0; col < wbmp->
width; col++)
314 for (row = 0; row < wbmp->
height; row++)
316 for (col = 0; col < wbmp->
width; col++)
337putout (
int c,
void *
out)
339 return (putc (c, (FILE *)
out));
348 return (getc ((FILE *) in));
357main (
int argc,
char *argv[])
362 wbmp_file =
fopen (argv[1],
"rb");
365 readwbmp (&getin, wbmp_file, &wbmp);
370 printf (
"\nVIEWING IMAGE\n");
379 printf (
"\nDUMPING WBMP to STDOUT\n");
printf(string $format, mixed ... $values)
fopen(string $filename, string $mode, bool $use_include_path=false, $context=null)
int overflow2(int a, int b)
unsigned const char * pos
Wbmp * createwbmp(int width, int height, int color)
int getmbi(int(*getin)(void *in), void *in)
int skipheader(int(*getin)(void *in), void *in)
int writewbmp(Wbmp *wbmp, void(*putout)(int c, void *out), void *out)
void printwbmp(Wbmp *wbmp)
int readwbmp(int(*getin)(void *in), void *in, Wbmp **return_wbmp)
void putmbi(int i, void(*putout)(int c, void *out), void *out)
void freewbmp(Wbmp *wbmp)
#define safe_emalloc(nmemb, size, offset)