1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Combine picture files according to calcomp functions. |
6 |
|
* |
8 |
|
*/ |
9 |
|
|
10 |
|
#include "standard.h" |
14 |
– |
|
11 |
|
#include "color.h" |
16 |
– |
|
17 |
– |
#include "resolu.h" |
18 |
– |
|
12 |
|
#include "calcomp.h" |
20 |
– |
|
13 |
|
#include "view.h" |
14 |
|
|
15 |
|
#define MAXINP 32 /* maximum number of input files */ |
16 |
< |
#define WINSIZ 17 /* scanline window size */ |
16 |
> |
#define WINSIZ 64 /* scanline window size */ |
17 |
|
#define MIDSCN ((WINSIZ-1)/2+1) |
18 |
|
|
19 |
|
struct { |
80 |
|
int original; |
81 |
|
double f; |
82 |
|
int a, i; |
83 |
< |
#ifdef MSDOS |
84 |
< |
extern int _fmode; |
85 |
< |
_fmode = O_BINARY; |
94 |
< |
setmode(fileno(stdin), O_BINARY); |
95 |
< |
setmode(fileno(stdout), O_BINARY); |
96 |
< |
#endif |
83 |
> |
SET_DEFAULT_BINARY(); |
84 |
> |
SET_FILE_BINARY(stdin); |
85 |
> |
SET_FILE_BINARY(stdout); |
86 |
|
progname = argv[0]; |
87 |
|
/* scan options */ |
88 |
|
for (a = 1; a < argc; a++) { |
103 |
|
break; |
104 |
|
} |
105 |
|
newheader("RADIANCE", stdout); /* start header */ |
106 |
+ |
fputnow(stdout); |
107 |
|
/* process files */ |
108 |
|
for (nfiles = 0; nfiles < MAXINP; nfiles++) { |
109 |
|
setcolor(input[nfiles].coef, 1.0, 1.0, 1.0); |
161 |
|
colval(input[nfiles].expos,GRN); |
162 |
|
colval(input[nfiles].coef,BLU) /= |
163 |
|
colval(input[nfiles].expos,BLU); |
164 |
+ |
setcolor(input[nfiles].expos, 1.0, 1.0, 1.0); |
165 |
|
} |
166 |
|
nfiles++; |
167 |
|
original = 0; |
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
< |
tputs(s) /* put out string preceded by a tab */ |
221 |
> |
tabputs(s) /* put out string preceded by a tab */ |
222 |
|
char *s; |
223 |
|
{ |
224 |
|
char fmt[32]; |
232 |
|
wrongformat = 0; |
233 |
|
strcpy(ourfmt, fmt); |
234 |
|
} else |
235 |
< |
wrongformat = 1; |
235 |
> |
wrongformat = globmatch(PICFMT, fmt) ? 1 : -1; |
236 |
|
return(0); /* don't echo */ |
237 |
|
} |
238 |
|
if (isexpos(s)) { /* exposure */ |
258 |
|
gotview = 0; |
259 |
|
fputs(input[nfiles].name, stdout); |
260 |
|
fputs(":\n", stdout); |
261 |
< |
getheader(input[nfiles].fp, tputs, NULL); |
262 |
< |
if (wrongformat) { |
261 |
> |
getheader(input[nfiles].fp, tabputs, NULL); |
262 |
> |
if (wrongformat < 0) { |
263 |
|
eputs(input[nfiles].name); |
264 |
< |
eputs(": not in Radiance picture format\n"); |
264 |
> |
eputs(": not a Radiance picture\n"); |
265 |
|
quit(1); |
266 |
|
} |
267 |
+ |
if (wrongformat > 0) { |
268 |
+ |
wputs(input[nfiles].name); |
269 |
+ |
wputs(": warning -- incompatible picture format\n"); |
270 |
+ |
} |
271 |
|
if (!gotview || setview(&input[nfiles].vw) != NULL) |
272 |
|
input[nfiles].vw.type = 0; |
273 |
|
if (!fgetsresolu(&input[nfiles].rs, input[nfiles].fp)) { |
392 |
|
quit(1); |
393 |
|
} |
394 |
|
} |
395 |
< |
efree(scanout); |
395 |
> |
efree((char *)scanout); |
396 |
|
} |
397 |
|
|
398 |
|
|
526 |
|
errno = EDOM; |
527 |
|
return(0.0); |
528 |
|
} |
529 |
< |
if (ltick[fn] < eclock) { /* need to compute? */ |
529 |
> |
if (ltick[fn] != eclock) { /* need to compute? */ |
530 |
|
lorg[fn][0] = lorg[fn][1] = lorg[fn][2] = 0.0; |
531 |
|
ldir[fn][0] = ldir[fn][1] = ldir[fn][2] = 0.0; |
532 |
|
ldist[fn] = -1.0; |
566 |
|
return(0.0); |
567 |
|
} |
568 |
|
fn = d - .5; |
569 |
< |
if (ltick[fn] < eclock) { /* need to compute? */ |
569 |
> |
if (ltick[fn] != eclock) { /* need to compute? */ |
570 |
|
psize[fn] = 0.0; |
571 |
|
if (input[fn].vw.type == 0) |
572 |
|
errno = EDOM; |
586 |
|
diry[i] -= dir0[i]; |
587 |
|
} |
588 |
|
fcross(dir0, dirx, diry); |
589 |
< |
psize[fn] = 0.5 * sqrt(DOT(dir0,dir0)); |
589 |
> |
psize[fn] = sqrt(DOT(dir0,dir0)); |
590 |
|
} |
591 |
|
} |
592 |
|
ltick[fn] = eclock; |
595 |
|
} |
596 |
|
|
597 |
|
|
598 |
+ |
void |
599 |
|
wputs(msg) |
600 |
|
char *msg; |
601 |
|
{ |
604 |
|
} |
605 |
|
|
606 |
|
|
607 |
+ |
void |
608 |
|
eputs(msg) |
609 |
|
char *msg; |
610 |
|
{ |
612 |
|
} |
613 |
|
|
614 |
|
|
615 |
+ |
void |
616 |
|
quit(code) /* exit gracefully */ |
617 |
|
int code; |
618 |
|
{ |