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.27 by greg, Wed Nov 7 13:10:39 1990 UTC vs.
Revision 1.31 by greg, Mon May 6 15:19:03 1991 UTC

# Line 72 | Line 72 | int  cury = 0;                         /* current scan location */
72  
73   double  exposure = 1.0;                 /* exposure compensation used */
74  
75 + int  wrongformat = 0;                   /* input in another format */
76 +
77   struct {
78          int  xmin, ymin, xsiz, ysiz;
79   }  box = {0, 0, 0, 0};                  /* current box */
# Line 141 | Line 143 | char  *argv[];
143                  }
144          }
145                                  /* get header */
146 <        getheader(fin, headline);
146 >        getheader(fin, headline, NULL);
147                                  /* get picture dimensions */
148 <        if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR))
148 >        if (wrongformat || fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR))
149                  quiterr("bad picture size");
150                                  /* set view parameters */
151          if (gotview && setview(&ourview) != NULL)
# Line 168 | Line 170 | char  *s;
170   {
171          static char  *altname[] = {"rview","rpict",VIEWSTR,NULL};
172          register char  **an;
173 +        char  fmt[32];
174  
175          if (isexpos(s))
176                  exposure *= exposval(s);
177 <        else
177 >        else if (isformat(s)) {
178 >                formatval(fmt, s);
179 >                wrongformat = strcmp(fmt, COLRFMT);
180 >        } else
181                  for (an = altname; *an != NULL; an++)
182                          if (!strncmp(*an, s, strlen(*an))) {
183                                  if (sscanview(&ourview, s+strlen(*an)) > 0)
# Line 373 | Line 379 | XKeyEvent  *ekey;
379                          sprintf(buf, "%.3f", intens(cval)/exposure);
380                          break;
381                  case 'l':                               /* luminance */
382 <                        sprintf(buf, "%.0fn", bright(cval)*683.0/exposure);
382 >                        sprintf(buf, "%.0fL", luminance(cval)/exposure);
383                          break;
384                  case 'c':                               /* color */
385                          comp = pow(2.0, (double)scale);
# Line 542 | Line 548 | getmono()                      /* get monochrome data */
548   {
549          register unsigned short *dp;
550          register int    x, err;
551 <        int     y;
551 >        int     y, errp;
552          rgbpixel        *inl;
553          short   *cerr;
554  
# Line 556 | Line 562 | getmono()                      /* get monochrome data */
562                  for (x = 0; x < xmax; x++) {
563                          if (!(x&0xf))
564                                  *++dp = 0;
565 +                        errp = err;
566                          err += rgb_bright(&inl[x]) + cerr[x];
567                          if (err > 127)
568                                  err -= 255;
569                          else
570                                  *dp |= 1<<(x&0xf);
571 <                        cerr[x] = err >>= 1;
571 >                        err /= 3;
572 >                        cerr[x] = err + errp;
573                  }
574          }
575          free((char *)inl);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines