6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
9 |
– |
|
10 |
– |
#ifdef MSDOS |
11 |
– |
#include <fcntl.h> |
12 |
– |
#endif |
13 |
– |
|
9 |
|
#include <math.h> |
15 |
– |
|
10 |
|
#include <ctype.h> |
17 |
– |
|
11 |
|
#include <time.h> |
12 |
|
|
13 |
+ |
#include "platform.h" |
14 |
|
#include "color.h" |
21 |
– |
|
15 |
|
#include "resolu.h" |
16 |
|
|
17 |
|
|
94 |
|
if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P') |
95 |
|
quiterr("input not a Poskanzer Pixmap"); |
96 |
|
ptype = inpbuf[1]; |
97 |
< |
#ifdef MSDOS |
97 |
> |
#ifdef _WIN32 |
98 |
|
if (ptype > 4) |
99 |
< |
setmode(fileno(stdin), O_BINARY); |
100 |
< |
setmode(fileno(stdout), O_BINARY); |
99 |
> |
SET_FILE_BINARY(stdin); |
100 |
> |
SET_FILE_BINARY(stdout); |
101 |
|
#endif |
102 |
|
xmax = scanint(stdin); |
103 |
|
ymax = scanint(stdin); |
144 |
|
quiterr("unsupported Pixmap type"); |
145 |
|
} |
146 |
|
} else { |
147 |
< |
#ifdef MSDOS |
148 |
< |
setmode(fileno(stdin), O_BINARY); |
147 |
> |
#ifdef _WIN32 |
148 |
> |
SET_FILE_BINARY(stdin); |
149 |
|
if (binflag) |
150 |
< |
setmode(fileno(stdout), O_BINARY); |
150 |
> |
SET_FILE_BINARY(stdout); |
151 |
|
#endif |
152 |
|
/* get header info. */ |
153 |
|
if (checkheader(stdin, COLRFMT, NULL) < 0 || |
269 |
|
for (y = ymax-1; y >= 0; y--) { |
270 |
|
if ((*getscan)(scanout, xmax, stdin) < 0) |
271 |
|
quiterr("error reading Pixmap"); |
272 |
< |
for (x = gamcor>1.01|gamcor<0.99?xmax:0; x--; ) { |
272 |
> |
for (x = (gamcor>1.01)|(gamcor<0.99)?xmax:0; x--; ) { |
273 |
|
colval(scanout[x],RED) = |
274 |
|
pow(colval(scanout[x],RED), gamcor); |
275 |
|
colval(scanout[x],GRN) = |
309 |
|
for (x = grey?xmax:0; x--; ) |
310 |
|
colval(scanin[x],GRN) = bright(scanin[x]); |
311 |
|
d = 1./gamcor; |
312 |
< |
for (x = d>1.01|d<0.99?xmax:0; x--; ) { |
312 |
> |
for (x = (d>1.01)|(d<0.99)?xmax:0; x--; ) { |
313 |
|
colval(scanin[x],GRN) = pow(colval(scanin[x],GRN), d); |
314 |
|
if (!grey) { |
315 |
|
colval(scanin[x],RED) = |