| 160 |
|
|
| 161 |
|
combine() /* combine pictures */ |
| 162 |
|
{ |
| 163 |
< |
int coldef[3]; |
| 163 |
> |
EPNODE *coldef[3]; |
| 164 |
|
COLOR *scanout; |
| 165 |
|
register int i, j; |
| 166 |
|
/* check defined variables */ |
| 167 |
< |
for (j = 0; j < 3; j++) |
| 168 |
< |
coldef[j] = vardefined(vcolout[j]); |
| 167 |
> |
for (j = 0; j < 3; j++) { |
| 168 |
> |
if (vardefined(vcolout[j])) |
| 169 |
> |
coldef[j] = eparse(vcolout[j]); |
| 170 |
> |
else |
| 171 |
> |
coldef[j] = NULL; |
| 172 |
> |
} |
| 173 |
|
/* allocate scanline */ |
| 174 |
|
scanout = (COLOR *)emalloc(xres*sizeof(COLOR)); |
| 175 |
|
/* combine files */ |
| 184 |
|
for (xpos = 0; xpos < xres; xpos++) { |
| 185 |
|
varset(vxpos, (double)xpos); |
| 186 |
|
eclock++; |
| 187 |
< |
for (j = 0; j < 3; j++) |
| 188 |
< |
if (coldef[j]) { |
| 187 |
> |
for (j = 0; j < 3; j++) { |
| 188 |
> |
if (coldef[j] != NULL) { |
| 189 |
|
colval(scanout[xpos],j) = |
| 190 |
< |
varvalue(vcolout[j]); |
| 187 |
< |
if (colval(scanout[xpos],j) < 0.0) |
| 188 |
< |
colval(scanout[xpos],j) = 0.0; |
| 190 |
> |
evalue(coldef[j]); |
| 191 |
|
} else { |
| 192 |
|
colval(scanout[xpos],j) = 0.0; |
| 193 |
|
for (i = 0; i < nfiles; i++) |
| 195 |
|
colval(input[i].coef,j) * |
| 196 |
|
colval(input[i].scan[xpos],j); |
| 197 |
|
} |
| 198 |
+ |
if (colval(scanout[xpos],j) < 0.0) |
| 199 |
+ |
colval(scanout[xpos],j) = 0.0; |
| 200 |
+ |
} |
| 201 |
|
} |
| 202 |
|
if (fwritescan(scanout, xres, stdout) < 0) { |
| 203 |
|
eputs("write error\n"); |