5 |
|
* program to convert between RADIANCE and Poskanzer Pixmaps |
6 |
|
*/ |
7 |
|
|
8 |
– |
#include <stdio.h> |
8 |
|
#include <math.h> |
9 |
|
#include <ctype.h> |
11 |
– |
#include <time.h> |
10 |
|
|
11 |
|
#include "platform.h" |
12 |
+ |
#include "rtio.h" |
13 |
|
#include "color.h" |
14 |
|
#include "resolu.h" |
15 |
|
|
102 |
|
if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P') |
103 |
|
quiterr("input not a Poskanzer Pixmap"); |
104 |
|
ptype = inpbuf[1]; |
105 |
< |
#ifdef _WIN32 |
105 |
> |
#if defined(_WIN32) || defined(_WIN64) |
106 |
|
if (ptype > 4) |
107 |
|
SET_FILE_BINARY(stdin); |
108 |
|
SET_FILE_BINARY(stdout); |
152 |
|
quiterr("unsupported Pixmap type"); |
153 |
|
} |
154 |
|
} else { |
155 |
< |
#ifdef _WIN32 |
155 |
> |
#if defined(_WIN32) || defined(_WIN64) |
156 |
|
SET_FILE_BINARY(stdin); |
157 |
|
if (binflag) |
158 |
|
SET_FILE_BINARY(stdout); |
219 |
|
|
220 |
|
|
221 |
|
static void |
222 |
< |
ra2ppm( /* convert Radiance picture to Pixmap */ |
222 |
> |
ra2ppm( /* convert Radiance picture to 1-byte/sample Pixmap */ |
223 |
|
int binary, |
224 |
|
int grey |
225 |
|
) |
584 |
|
{ |
585 |
|
register int lowerb, upperb; |
586 |
|
|
588 |
– |
lowerb = getc(fp); |
587 |
|
upperb = getc(fp); |
588 |
< |
if (upperb == EOF) |
588 |
> |
lowerb = getc(fp); |
589 |
> |
if (lowerb == EOF) |
590 |
|
return(EOF); |
591 |
|
return(upperb<<8 | lowerb); |
592 |
|
} |
598 |
|
register FILE *fp |
599 |
|
) |
600 |
|
{ |
602 |
– |
putc(w & 0xff, fp); |
601 |
|
putc(w>>8 & 0xff, fp); |
602 |
+ |
putc(w & 0xff, fp); |
603 |
|
if (ferror(fp)) { |
604 |
|
fprintf(stderr, "%s: write error on PPM output\n", progname); |
605 |
|
exit(1); |