129 |
|
fputs(input[nfiles].name, stdout); |
130 |
|
fputs(":\n", stdout); |
131 |
|
getheader(input[nfiles].fp, tputs); |
132 |
< |
if (fscanf(input[nfiles].fp, "-Y %d +X %d\n", &ypos, &xpos) != 2) { |
132 |
> |
if (fgetresolu(&xpos, &ypos, input[nfiles].fp) != |
133 |
> |
(YMAJOR|YDECR)) { |
134 |
|
eputs(input[nfiles].name); |
135 |
|
eputs(": bad picture size\n"); |
136 |
|
quit(1); |
148 |
|
} |
149 |
|
printargs(argc, argv, stdout); |
150 |
|
putchar('\n'); |
151 |
< |
printf("-Y %d +X %d\n", yres, xres); |
151 |
> |
fputresolu(YMAJOR|YDECR, xres, yres, stdout); |
152 |
|
combine(); |
153 |
|
quit(0); |
154 |
|
usage: |
161 |
|
|
162 |
|
combine() /* combine pictures */ |
163 |
|
{ |
164 |
< |
int coldef[3]; |
164 |
> |
EPNODE *coldef[3]; |
165 |
|
COLOR *scanout; |
166 |
|
register int i, j; |
167 |
|
/* check defined variables */ |
168 |
< |
for (j = 0; j < 3; j++) |
169 |
< |
coldef[j] = vardefined(vcolout[j]); |
168 |
> |
for (j = 0; j < 3; j++) { |
169 |
> |
if (vardefined(vcolout[j])) |
170 |
> |
coldef[j] = eparse(vcolout[j]); |
171 |
> |
else |
172 |
> |
coldef[j] = NULL; |
173 |
> |
} |
174 |
|
/* allocate scanline */ |
175 |
|
scanout = (COLOR *)emalloc(xres*sizeof(COLOR)); |
176 |
|
/* combine files */ |
185 |
|
for (xpos = 0; xpos < xres; xpos++) { |
186 |
|
varset(vxpos, (double)xpos); |
187 |
|
eclock++; |
188 |
< |
for (j = 0; j < 3; j++) |
189 |
< |
if (coldef[j]) { |
188 |
> |
for (j = 0; j < 3; j++) { |
189 |
> |
if (coldef[j] != NULL) { |
190 |
|
colval(scanout[xpos],j) = |
191 |
< |
varvalue(vcolout[j]); |
187 |
< |
if (colval(scanout[xpos],j) < 0.0) |
188 |
< |
colval(scanout[xpos],j) = 0.0; |
191 |
> |
evalue(coldef[j]); |
192 |
|
} else { |
193 |
|
colval(scanout[xpos],j) = 0.0; |
194 |
|
for (i = 0; i < nfiles; i++) |
196 |
|
colval(input[i].coef,j) * |
197 |
|
colval(input[i].scan[xpos],j); |
198 |
|
} |
199 |
+ |
if (colval(scanout[xpos],j) < 0.0) |
200 |
+ |
colval(scanout[xpos],j) = 0.0; |
201 |
+ |
} |
202 |
|
} |
203 |
|
if (fwritescan(scanout, xres, stdout) < 0) { |
204 |
|
eputs("write error\n"); |