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.15 by greg, Wed Nov 29 16:50:39 1989 UTC vs.
Revision 1.20 by greg, Fri Jan 5 17:52:57 1990 UTC

# Line 173 | Line 173 | char  *s;
173          static char  *altname[] = {"rview","rpict",VIEWSTR,NULL};
174          register char  **an;
175  
176 <        if (!strncmp(s, "EXPOSURE=", 9))
177 <                exposure *= atof(s+9);
176 >        if (isexpos(s))
177 >                exposure *= exposval(s);
178          else
179                  for (an = altname; *an != NULL; an++)
180                          if (!strncmp(*an, s, strlen(*an))) {
# Line 185 | Line 185 | char  *s;
185   }
186  
187  
188 char *
189 sskip(s)                /* skip a word */
190 register char  *s;
191 {
192        while (isspace(*s)) s++;
193        while (*s && !isspace(*s)) s++;
194        return(s);
195 }
196
197
188   init()                  /* get data and open window */
189   {
190          register int  i;
# Line 384 | Line 374 | XKeyEvent  *ekey;
374                  switch (*cp) {
375                  case '\n':
376                  case '\r':                              /* radiance */
377 <                        sprintf(buf, "%-3g", intens(cval)/exposure);
377 >                        sprintf(buf, "%.3f", intens(cval)/exposure);
378                          break;
379                  case 'l':                               /* luminance */
380 <                        sprintf(buf, "%-3gL", bright(cval)*683.0/exposure);
380 >                        sprintf(buf, "%.0fn", bright(cval)*683.0/exposure);
381                          break;
382                  case 'c':                               /* color */
383                          comp = pow(2.0, (double)scale);
# Line 401 | Line 391 | XKeyEvent  *ekey;
391                                  fontid, BlackPixel, WhitePixel);
392                  return(0);
393          case 'i':                               /* identify (contour) */
394 <                if (ourras->ncolors == 0)
394 >                if (ourras->pixels == NULL)
395                          return(-1);
396                  n = ourras->data.bz[ekey->x-xoff+BZPixmapSize(xmax,ekey->y-yoff)];
397                  n = ourras->pmap[n];
# Line 444 | Line 434 | XKeyEvent  *ekey;
434          /* fall through */
435          case CTRL(R):                           /* redraw */
436          case CTRL(L):
437 +                unmap_rcolors(ourras);
438                  XClear(wind);
448                XStoreColors(ourras->ncolors, ourras->cdefs);
439                  return(redraw(0, 0, width, height));
440          case ' ':                               /* clear */
441                  return(redraw(box.xmin, box.ymin, box.xsiz, box.ysiz));
# Line 618 | Line 608 | register XRASTER       *xr;
608   double  sf;
609   {
610          register int    i;
611 <        int     maxv;
611 >        long    maxv;
612  
613 +        if (xr->pixels == NULL)
614 +                return;
615 +
616          sf = pow(sf, 1.0/gamcor);
617 <        maxv = (1<<16) / sf;
617 >        maxv = 65535/sf;
618  
619          for (i = xr->ncolors; i--; ) {
620 <                xr->cdefs[i].red = xr->cdefs[i].red >= maxv ?
621 <                                (1<<16)-1 :
620 >                xr->cdefs[i].red = xr->cdefs[i].red > maxv ?
621 >                                65535 :
622                                  xr->cdefs[i].red * sf;
623 <                xr->cdefs[i].green = xr->cdefs[i].green >= maxv ?
624 <                                (1<<16)-1 :
623 >                xr->cdefs[i].green = xr->cdefs[i].green > maxv ?
624 >                                65535 :
625                                  xr->cdefs[i].green * sf;
626 <                xr->cdefs[i].blue = xr->cdefs[i].blue >= maxv ?
627 <                                (1<<16)-1 :
626 >                xr->cdefs[i].blue = xr->cdefs[i].blue > maxv ?
627 >                                65535 :
628                                  xr->cdefs[i].blue * sf;
629          }
630 <        if (xr->pixels != NULL)
638 <                XStoreColors(xr->ncolors, xr->cdefs);
630 >        XStoreColors(xr->ncolors, xr->cdefs);
631   }
632  
633  
# Line 668 | Line 660 | register rgbpixel  *l3;
660          if (getscan(y) < 0)
661                  quiterr("cannot seek for picreadline");
662                                                          /* convert scanline */
663 <        if (scale != 0)
663 >        if (scale)
664                  for (i = 0; i < xmax; i++)
665 <                        if (scanline[i][EXP]+scale >= 0)
665 >                        if (scanline[i][EXP])
666                                  scanline[i][EXP] += scale;
667          normcolrs(scanline, xmax);
668          for (i = 0; i < xmax; i++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines