ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pinterp.c
(Generate patch)

Comparing ray/src/px/pinterp.c (file contents):
Revision 1.11 by greg, Thu Jan 4 10:12:49 1990 UTC vs.
Revision 1.12 by greg, Thu Jan 4 14:25:56 1990 UTC

# Line 34 | Line 34 | char   *progname;
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 */
# Line 84 | Line 86 | char   *argv[];
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;
# Line 167 | Line 170 | char   *argv[];
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);
# Line 178 | Line 181 | char   *argv[];
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) {
# Line 416 | Line 419 | double z;
419   }
420  
421  
422 < fillpicture()                           /* fill in empty spaces */
422 > backpicture()                           /* background fill algorithm */
423   {
424          int     *yback, xback;
425          int     y;
# Line 473 | Line 476 | fillpicture()                          /* fill in empty spaces */
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                                  /*
# Line 497 | Line 500 | fillpicture()                          /* fill in empty spaces */
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  
# Line 572 | Line 575 | register char  *s;
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines