| 34 |
|
VIEW theirview = STDVIEW(512); /* input view */ |
| 35 |
|
int gotview; /* got input view? */ |
| 36 |
|
|
| 37 |
< |
int fill = F_FORE|F_BACK; /* fill level */ |
| 37 |
> |
int fill = F_FORE|F_BACK; /* selected fill algorithm */ |
| 38 |
> |
extern int backfill(); /* fill functions */ |
| 39 |
> |
int (*deffill)() = backfill; /* selected fill function */ |
| 40 |
|
COLR backcolr = BLKCOLR; /* background color */ |
| 41 |
|
|
| 42 |
|
double theirs2ours[4][4]; /* transformation matrix */ |
| 86 |
|
break; |
| 87 |
|
case 'c': /* color */ |
| 88 |
|
check(3,3); |
| 89 |
+ |
deffill = backfill; |
| 90 |
|
setcolr(backcolr, atof(argv[i+1]), |
| 91 |
|
atof(argv[i+2]), atof(argv[i+3])); |
| 92 |
|
i += 3; |
| 170 |
|
exit(1); |
| 171 |
|
} |
| 172 |
|
/* allocate frame */ |
| 173 |
< |
ourpict = (COLR *)calloc(ourview.hresolu*ourview.vresolu,sizeof(COLR)); |
| 173 |
> |
ourpict = (COLR *)malloc(ourview.hresolu*ourview.vresolu*sizeof(COLR)); |
| 174 |
|
ourzbuf = (float *)calloc(ourview.hresolu*ourview.vresolu,sizeof(float)); |
| 175 |
|
if (ourpict == NULL || ourzbuf == NULL) { |
| 176 |
|
perror(progname); |
| 181 |
|
addpicture(argv[i], argv[i+1]); |
| 182 |
|
/* fill in spaces */ |
| 183 |
|
if (fill&F_BACK) |
| 181 |
– |
fillpicture(); |
| 182 |
– |
else |
| 184 |
|
backpicture(); |
| 185 |
+ |
else |
| 186 |
+ |
fillpicture(); |
| 187 |
|
/* add to header */ |
| 188 |
|
printargs(argc, argv, stdout); |
| 189 |
|
if (gotvfile) { |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
|
| 422 |
< |
fillpicture() /* fill in empty spaces */ |
| 422 |
> |
backpicture() /* background fill algorithm */ |
| 423 |
|
{ |
| 424 |
|
int *yback, xback; |
| 425 |
|
int y; |
| 476 |
|
* this pixel. If not, use background color. |
| 477 |
|
*/ |
| 478 |
|
if (xback < 0 && yback[x] < 0) { |
| 479 |
< |
copycolr(pscan(y)[x], backcolr); |
| 479 |
> |
(*deffill)(x,y); |
| 480 |
|
continue; |
| 481 |
|
} |
| 482 |
|
/* |
| 500 |
|
} |
| 501 |
|
|
| 502 |
|
|
| 503 |
< |
backpicture() /* paint in empty pixels */ |
| 503 |
> |
fillpicture() /* paint in empty pixels with default */ |
| 504 |
|
{ |
| 505 |
|
register int x, y; |
| 506 |
|
|
| 507 |
|
for (y = 0; y < ourview.vresolu; y++) |
| 508 |
|
for (x = 0; x < ourview.hresolu; x++) |
| 509 |
|
if (zscan(y)[x] <= 0) |
| 510 |
< |
copycolr(pscan(y)[x], backcolr); |
| 510 |
> |
(*deffill)(x,y); |
| 511 |
|
} |
| 512 |
|
|
| 513 |
|
|
| 575 |
|
&& *s != 'e' && *s != 'E' && *s != '+') |
| 576 |
|
return(0); |
| 577 |
|
return(1); |
| 578 |
+ |
} |
| 579 |
+ |
|
| 580 |
+ |
|
| 581 |
+ |
backfill(x, y) /* fill pixel with background */ |
| 582 |
+ |
int x, y; |
| 583 |
+ |
{ |
| 584 |
+ |
register BYTE *dest = pscan(y)[x]; |
| 585 |
+ |
|
| 586 |
+ |
copycolr(dest, backcolr); |
| 587 |
|
} |