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.8 by greg, Mon Jul 24 10:45:12 1989 UTC vs.
Revision 1.13 by greg, Mon Oct 23 09:10:22 1989 UTC

# Line 38 | Line 38 | static char SCCSid[] = "$SunId$ LBL";
38   #define  BORWIDTH       5               /* border width */
39   #define  BARHEIGHT      25              /* menu bar size */
40  
41 < double  gamcor = 2.0;                   /* gamma correction */
41 > double  gamcor = 2.2;                   /* gamma correction */
42  
43   XRASTER  *ourras = NULL;                /* our stored raster image */
44  
# Line 141 | Line 141 | char  *argv[];
141                                  /* get header */
142          getheader(fin, headline);
143                                  /* get picture dimensions */
144 <        if (fscanf(fin, "-Y %d +X %d\n", &ymax, &xmax) != 2)
144 >        if (fgetresolu(&xmax, &ymax, fin) != (YMAJOR|YDECR))
145                  quiterr("bad picture size");
146                                  /* set view parameters */
147          if (gotview) {
# Line 648 | Line 648 | picreadline3(y, l3)                    /* read in 3-byte scanline */
648   int  y;
649   register rgbpixel  *l3;
650   {
651 <        register BYTE   *l4;
652 <        register int    shift, c;
653 <        int     i;
654 <
651 >        register int    i;
652 >                                                        /* read scanline */
653          if (getscan(y) < 0)
654                  quiterr("cannot seek for picreadline");
655                                                          /* convert scanline */
656 <        for (l4=scanline[0], i=xmax; i--; l4+=4, l3++) {
657 <                shift = l4[EXP] - COLXS + scale;
658 <                if (shift >= 8) {
659 <                        l3->r = l3->g = l3->b = 255;
660 <                } else if (shift <= -8) {
663 <                        l3->r = l3->g = l3->b = 0;
664 <                } else if (shift > 0) {
665 <                        c = l4[RED] << shift;
666 <                        l3->r = c > 255 ? 255 : c;
667 <                        c = l4[GRN] << shift;
668 <                        l3->g = c > 255 ? 255 : c;
669 <                        c = l4[BLU] << shift;
670 <                        l3->b = c > 255 ? 255 : c;
671 <                } else if (shift < 0) {
672 <                        l3->r = l4[RED] >> -shift;
673 <                        l3->g = l4[GRN] >> -shift;
674 <                        l3->b = l4[BLU] >> -shift;
675 <                } else {
676 <                        l3->r = l4[RED];
677 <                        l3->g = l4[GRN];
678 <                        l3->b = l4[BLU];
679 <                }
656 >        normcolrs(scanline, xmax);
657 >        for (i = 0; i < xmax; i++) {
658 >                l3[i].r = scanline[i][RED];
659 >                l3[i].g = scanline[i][GRN];
660 >                l3[i].b = scanline[i][BLU];
661          }
662   }
663  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines