9 |
|
#include <ctype.h> |
10 |
|
|
11 |
|
#include "platform.h" |
12 |
– |
#include "paths.h" |
12 |
|
#include "rtio.h" |
13 |
|
#include "color.h" |
14 |
|
#include "resolu.h" |
50 |
|
int bradj = 0; /* brightness adjustment */ |
51 |
|
int ncopies = 1; /* number of copies */ |
52 |
|
|
54 |
– |
char *progname; |
53 |
|
int xmax, ymax; /* input image dimensions */ |
54 |
|
|
55 |
|
typedef void putprimf_t(COLR *scn, int pri); |
79 |
|
{ |
80 |
|
char fmt[MAXFMTLEN]; |
81 |
|
|
82 |
< |
if (isformat(s)) { |
83 |
< |
formatval(fmt, s); |
84 |
< |
wrongformat = strcmp(fmt, COLRFMT); |
87 |
< |
} else if (isaspect(s)) |
82 |
> |
if (formatval(fmt, s)) |
83 |
> |
wrongformat = strcmp(fmt, COLRFMT) && strcmp(fmt, SPECFMT); |
84 |
> |
else if (isaspect(s)) |
85 |
|
pixaspect *= aspectval(s); |
86 |
+ |
else if (isncomp(s)) |
87 |
+ |
NCSAMP = ncompval(s); |
88 |
+ |
else if (iswlsplit(s)) |
89 |
+ |
wlsplitval(WLPART, s); |
90 |
|
return(0); |
91 |
|
} |
92 |
|
|
96 |
|
int i; |
97 |
|
double d; |
98 |
|
|
99 |
< |
progname = fixargv0(argv[0]); |
99 |
> |
fixargv0(argv[0]); /* assigns progname */ |
100 |
|
|
101 |
|
for (i = 1; i < argc; i++) |
102 |
|
if (argv[i][0] == '-') |
474 |
|
quiterr("out of memory in ra2ps"); |
475 |
|
/* convert image */ |
476 |
|
for (y = ymax-1; y >= 0; y--) { |
477 |
< |
if (freadcolrs(scanin, xmax, stdin) < 0) |
477 |
> |
if (fread2colrs(scanin, xmax, stdin, NCSAMP, WLPART) < 0) |
478 |
|
quiterr("error reading Radiance picture"); |
479 |
< |
if (putprim == Cputprim || devgam != 1.) { |
479 |
> |
if ((putprim == Cputprim) | (devgam != 1.)) { |
480 |
|
if (bradj) /* adjust exposure */ |
481 |
|
shiftcolrs(scanin, xmax, bradj); |
482 |
|
colrs_gambs(scanin, xmax); /* gamma compression */ |