1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
53 |
|
double inpaspect = 1.0; /* pixel aspect ratio of input */ |
54 |
|
int correctaspect = 0; /* aspect ratio correction? */ |
55 |
|
|
56 |
+ |
int wrongformat = 0; |
57 |
+ |
|
58 |
|
int xrad; /* x window size */ |
59 |
|
int yrad; /* y window size */ |
60 |
|
|
79 |
|
long fpos; |
80 |
|
double outaspect = 0.0; |
81 |
|
double d; |
82 |
< |
int i; |
82 |
> |
int i, j; |
83 |
|
|
84 |
|
if (signal(SIGINT, quit) == SIG_IGN) |
85 |
|
signal(SIGINT, SIG_IGN); |
196 |
|
fprintf(stderr, "%s: unknown lamp type\n", lamptype); |
197 |
|
quit(1); |
198 |
|
} |
199 |
< |
colval(exposure,RED) /= lampcolor[0]; |
200 |
< |
colval(exposure,GRN) /= lampcolor[1]; |
201 |
< |
colval(exposure,BLU) /= lampcolor[2]; |
199 |
> |
for (i = 0; i < 3; i++) |
200 |
> |
if (lampcolor[i] > 1e-4) |
201 |
> |
colval(exposure,i) /= lampcolor[i]; |
202 |
|
freelamps(); |
203 |
|
} |
204 |
|
/* open input file */ |
229 |
|
quit(1); |
230 |
|
} |
231 |
|
/* get header */ |
232 |
< |
getheader(fin, headline); |
232 |
> |
getheader(fin, headline, NULL); |
233 |
> |
if (wrongformat) { |
234 |
> |
fprintf(stderr, "%s: input must be a Radiance picture\n", |
235 |
> |
progname); |
236 |
> |
quit(1); |
237 |
> |
} |
238 |
|
/* add new header info. */ |
239 |
|
printargs(i, argv, stdout); |
240 |
|
/* get picture size */ |
280 |
|
headline(s) /* process line from header */ |
281 |
|
char *s; |
282 |
|
{ |
283 |
+ |
char fmt[32]; |
284 |
+ |
|
285 |
|
fputs(s, stdout); /* copy to output */ |
286 |
|
if (isaspect(s)) /* get aspect ratio */ |
287 |
|
inpaspect *= aspectval(s); |
288 |
+ |
else if (isformat(s)) { |
289 |
+ |
formatval(fmt, s); |
290 |
+ |
wrongformat = strcmp(fmt, COLRFMT); |
291 |
+ |
} |
292 |
|
} |
293 |
|
|
294 |
|
|
403 |
|
|
404 |
|
initmask(); /* initialize filter table */ |
405 |
|
} |
406 |
< |
barsize = 2 * yrad; |
406 |
> |
barsize = 2*yrad + 1; |
407 |
|
scanin = (COLOR **)malloc(barsize*sizeof(COLOR *)); |
408 |
|
for (i = 0; i < barsize; i++) { |
409 |
|
scanin[i] = (COLOR *)malloc(xres*sizeof(COLOR)); |