7 |
|
* 4/23/86 |
8 |
|
*/ |
9 |
|
|
10 |
– |
#include "standard.h" |
11 |
– |
|
12 |
– |
#include "color.h" |
13 |
– |
|
10 |
|
#include <time.h> |
11 |
|
|
12 |
+ |
#include "standard.h" |
13 |
+ |
#include "color.h" |
14 |
|
#include "resolu.h" |
15 |
|
|
16 |
|
typedef unsigned short uint16; /* sizeof (uint16) must == 2 */ |
21 |
|
#define ALL 3 |
22 |
|
#define BRIGHT 4 |
23 |
|
|
26 |
– |
#define brightonly (putprim==BRIGHT) |
27 |
– |
|
24 |
|
RESOLU picres; /* resolution of picture */ |
25 |
|
|
26 |
|
int uniq = 0; /* print only unique values? */ |
215 |
|
break; |
216 |
|
/* recognize special formats */ |
217 |
|
if (dataonly && format == 'b') |
218 |
< |
if (brightonly) |
223 |
< |
fmtid = "8-bit_grey"; |
224 |
< |
else |
218 |
> |
if (putprim == ALL) |
219 |
|
fmtid = "24-bit_rgb"; |
226 |
– |
if (dataonly && format == 'w') |
227 |
– |
if (brightonly) |
228 |
– |
fmtid = "16-bit_grey"; |
220 |
|
else |
221 |
+ |
fmtid = "8-bit_grey"; |
222 |
+ |
if (dataonly && format == 'w') |
223 |
+ |
if (putprim == ALL) |
224 |
|
fmtid = "48-bit_rgb"; |
225 |
+ |
else |
226 |
+ |
fmtid = "16-bit_grey"; |
227 |
|
/* assign reverse ordering */ |
228 |
|
rord[ord[0]] = 0; |
229 |
|
rord[ord[1]] = 1; |
237 |
|
progname, argv[i]); |
238 |
|
quit(1); |
239 |
|
} |
240 |
< |
if (reverse && !brightonly && i == argc-3) { |
240 |
> |
if (reverse && putprim != BRIGHT && i == argc-3) { |
241 |
|
if ((fin2 = fopen(argv[i+1], "r")) == NULL) { |
242 |
|
fprintf(stderr, "%s: can't open file \"%s\"\n", |
243 |
|
progname, argv[i+1]); |
251 |
|
interleave = -1; |
252 |
|
} else if (i != argc-1) |
253 |
|
fin = NULL; |
254 |
< |
if (reverse && !brightonly && !interleave) { |
254 |
> |
if (reverse && putprim != BRIGHT && !interleave) { |
255 |
|
fin2 = fopen(argv[i], "r"); |
256 |
|
fin3 = fopen(argv[i], "r"); |
257 |
|
} |
269 |
|
} |
270 |
|
|
271 |
|
if (reverse) { |
272 |
< |
#ifdef MSDOS |
273 |
< |
setmode(fileno(stdout), O_BINARY); |
272 |
> |
#ifdef _WIN32 |
273 |
> |
SET_FILE_BINARY(stdout); |
274 |
|
if (format != 'a' && format != 'i') |
275 |
< |
setmode(fileno(fin), O_BINARY); |
275 |
> |
SET_FILE_BINARY(fin); |
276 |
|
#endif |
277 |
|
/* get header */ |
278 |
|
if (header) { |
317 |
|
fputsresolu(&picres, stdout); /* always put resolution */ |
318 |
|
valtopix(); |
319 |
|
} else { |
320 |
< |
#ifdef MSDOS |
321 |
< |
setmode(fileno(fin), O_BINARY); |
320 |
> |
#ifdef _WIN32 |
321 |
> |
SET_FILE_BINARY(fin); |
322 |
|
if (format != 'a' && format != 'i') |
323 |
< |
setmode(fileno(stdout), O_BINARY); |
323 |
> |
SET_FILE_BINARY(stdout); |
324 |
|
#endif |
325 |
|
/* get header */ |
326 |
|
getheader(fin, checkhead, NULL); |