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

Comparing ray/src/px/ximage.c (file contents):
Revision 1.19 by greg, Sun Dec 10 12:12:55 1989 UTC vs.
Revision 1.24 by greg, Mon Mar 12 15:14:49 1990 UTC

# Line 58 | Line 58 | int  scale = 0;                                /* scalefactor; power of two */
58   int  xoff = 0;                          /* x image offset */
59   int  yoff = 0;                          /* y image offset */
60  
61 < VIEW  ourview = STDVIEW(0);             /* image view parameters */
61 > VIEW  ourview = STDVIEW;                /* image view parameters */
62   int  gotview = 0;                       /* got parameters from file */
63  
64   COLR  *scanline;                        /* scan line buffer */
# Line 146 | Line 146 | char  *argv[];
146          if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR))
147                  quiterr("bad picture size");
148                                  /* set view parameters */
149 <        if (gotview) {
150 <                ourview.hresolu = xmax;
151 <                ourview.vresolu = ymax;
152 <                if (setview(&ourview) != NULL)
153 <                        gotview = 0;
154 <        }
149 >        if (gotview && setview(&ourview) != NULL)
150 >                gotview = 0;
151          if ((scanline = (COLR *)malloc(xmax*sizeof(COLR))) == NULL)
152                  quiterr("out of memory");
153  
# Line 173 | Line 169 | char  *s;
169          static char  *altname[] = {"rview","rpict",VIEWSTR,NULL};
170          register char  **an;
171  
172 <        if (!strncmp(s, "EXPOSURE=", 9))
173 <                exposure *= atof(s+9);
172 >        if (isexpos(s))
173 >                exposure *= exposval(s);
174          else
175                  for (an = altname; *an != NULL; an++)
176                          if (!strncmp(*an, s, strlen(*an))) {
177 <                                if (sscanview(&ourview, s+strlen(*an)) == 0)
177 >                                if (sscanview(&ourview, s+strlen(*an)) > 0)
178                                          gotview++;
179                                  return;
180                          }
# Line 411 | Line 407 | XKeyEvent  *ekey;
407                          XFeep(0);
408                          return(-1);
409                  }
410 <                rayview(rorg, rdir, &ourview,
411 <                                ekey->x-xoff + .5, ymax-1-ekey->y+yoff + .5);
410 >                viewray(rorg, rdir, &ourview, (ekey->x-xoff+.5)/xmax,
411 >                                (ymax-1-ekey->y+yoff+.5)/ymax);
412                  printf("%e %e %e ", rorg[0], rorg[1], rorg[2]);
413                  printf("%e %e %e\n", rdir[0], rdir[1], rdir[2]);
414                  fflush(stdout);
# Line 546 | Line 542 | getmono()                      /* get monochrome data */
542          register unsigned short *dp;
543          register int    x, err;
544          int     y;
545 <        rgbpixel        *inline;
545 >        rgbpixel        *inl;
546          short   *cerr;
547  
548 <        if ((inline = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL
548 >        if ((inl = (rgbpixel *)malloc(xmax*sizeof(rgbpixel))) == NULL
549                          || (cerr = (short *)calloc(xmax,sizeof(short))) == NULL)
550                  quit("out of memory in getmono");
551          dp = ourras->data.m - 1;
552          for (y = 0; y < ymax; y++) {
553 <                picreadline3(y, inline);
553 >                picreadline3(y, inl);
554                  err = 0;
555                  for (x = 0; x < xmax; x++) {
556                          if (!(x&0xf))
557                                  *++dp = 0;
558 <                        err += rgb_bright(&inline[x]) + cerr[x];
558 >                        err += rgb_bright(&inl[x]) + cerr[x];
559                          if (err > 127)
560                                  err -= 255;
561                          else
# Line 567 | Line 563 | getmono()                      /* get monochrome data */
563                          cerr[x] = err >>= 1;
564                  }
565          }
566 <        free((char *)inline);
566 >        free((char *)inl);
567          free((char *)cerr);
568   }
569  
# Line 660 | Line 656 | register rgbpixel  *l3;
656          if (getscan(y) < 0)
657                  quiterr("cannot seek for picreadline");
658                                                          /* convert scanline */
659 <        if (scale)
664 <                for (i = 0; i < xmax; i++)
665 <                        if (scanline[i][EXP])
666 <                                scanline[i][EXP] += scale;
667 <        normcolrs(scanline, xmax);
659 >        normcolrs(scanline, xmax, scale);
660          for (i = 0; i < xmax; i++) {
661                  l3[i].r = scanline[i][RED];
662                  l3[i].g = scanline[i][GRN];
# Line 677 | Line 669 | picwriteline(y, l)             /* add 8-bit scanline to image */
669   int  y;
670   pixel  *l;
671   {
672 <        bcopy(l, ourras->data.bz+BZPixmapSize(xmax,y), BZPixmapSize(xmax,1));
672 >        bcopy((char *)l, (char *)ourras->data.bz+BZPixmapSize(xmax,y), BZPixmapSize(xmax,1));
673   }
674  
675  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines