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

Comparing ray/src/px/x11image.c (file contents):
Revision 2.24 by greg, Tue Mar 30 14:39:29 1993 UTC vs.
Revision 2.28 by greg, Mon Jul 19 15:18:05 1993 UTC

# Line 32 | Line 32 | static char SCCSid[] = "$SunId$ LBL";
32   #include  "random.h"
33   #include  "resolu.h"
34  
35 + #ifdef  __alpha
36 + #define  int4           int
37 + #endif
38 + #ifndef  int4
39 + #define  int4           long
40 + #endif
41 +
42   #define  FONTNAME       "8x13"          /* text font we'll use */
43  
44   #define  CTRL(c)        ((c)-'@')
# Line 466 | Line 473 | getras()                               /* get raster file */
473                          goto fail;
474                  getmono();
475          } else if (ourvis.class == TrueColor | ourvis.class == DirectColor) {
476 <                ourdata = (unsigned char *)malloc(4*xmax*ymax);
476 >                ourdata = (unsigned char *)malloc(sizeof(int4)*xmax*ymax);
477                  if (ourdata == NULL)
478                          goto fail;
479 <                ourras = make_raster(thedisplay, &ourvis, 32,
479 >                ourras = make_raster(thedisplay, &ourvis, sizeof(int4)*8,
480                                  ourdata, xmax, ymax, 32);
481                  if (ourras == NULL)
482                          goto fail;
# Line 624 | Line 631 | XKeyPressedEvent  *ekey;
631          case 't':                               /* trace */
632                  return(traceray(ekey->x, ekey->y));
633          case '=':                               /* adjust exposure */
634 +        case '@':                               /* adaptation level */
635                  if (avgbox(cval) == -1)
636                          return(-1);
637 <                n = log(.5/bright(cval))/.69315 - scale;        /* truncate */
637 >                comp = com=='@'
638 >                ? 106./pow(1.219+pow(luminance(cval)/exposure,.4),2.5)/exposure
639 >                : .5/bright(cval) ;
640 >                comp = log(comp)/.69315 - scale;
641 >                n = comp < 0 ? comp-.5 : comp+.5 ;      /* round */
642                  if (n == 0)
643                          return(0);
644                  scale_rcolors(ourras, pow(2.0, (double)n));
# Line 648 | Line 660 | XKeyPressedEvent  *ekey;
660                          make_rpixmap(ourras, wind);
661                  redraw(0, 0, width, height);
662                  return(0);
663 +        case 'f':                               /* turn on fast redraw */
664 +                fast = 1;
665 +                make_rpixmap(ourras, wind);
666 +                return(0);
667 +        case 'F':                               /* turn off fast redraw */
668 +                fast = 0;
669 +                free_rpixmap(ourras);
670 +                return(0);
671          case '0':                               /* recenter origin */
672                  if (xoff == 0 & yoff == 0)
673                          return(0);
# Line 863 | Line 883 | COLR  *scan;
883   getfull()                       /* get full (24-bit) data */
884   {
885          int     y;
886 <        register unsigned long  *dp;
886 >        register unsigned int4  *dp;
887          register int    x;
888                                          /* set gamma correction */
889          setcolrgam(gamcor);
890                                          /* read and convert file */
891 <        dp = (unsigned long *)ourdata;
891 >        dp = (unsigned int4 *)ourdata;
892          for (y = 0; y < ymax; y++) {
893                  getscan(y);
894                  add2icon(y, scanline);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines