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.34 by greg, Mon Nov 15 10:55:33 1993 UTC vs.
Revision 2.35 by greg, Mon Nov 22 11:33:18 1993 UTC

# Line 56 | Line 56 | static char SCCSid[] = "$SunId$ LBL";
56   #define  redraw(x,y,w,h) patch_raster(wind,(x)-xoff,(y)-yoff,x,y,w,h,ourras)
57  
58   double  gamcor = 2.2;                   /* gamma correction */
59 + char  *gamstr = NULL;                   /* gamma value override */
60  
61   int  dither = 1;                        /* dither colors? */
62   int  fast = 0;                          /* keep picture in Pixmap? */
# Line 116 | Line 117 | extern BYTE  clrtab[256][3];           /* global color map */
117  
118   extern long  ftell();
119  
120 + extern char  *getenv();
121 +
122   Display  *thedisplay;
123   Atom  closedownAtom, wmProtocolsAtom;
124  
# Line 128 | Line 131 | main(argc, argv)
131   int  argc;
132   char  *argv[];
133   {
131        extern char  *getenv();
132        char  *gv;
134          int  headline();
135          int  i;
136          int  pid;
137          
138          progname = argv[0];
138        if ((gv = getenv("GAMMA")) != NULL)
139                gamcor = atof(gv);
139  
140          for (i = 1; i < argc; i++)
141                  if (argv[i][0] == '-')
# Line 168 | Line 167 | char  *argv[];
167                                  if (argv[i][2] == 'e')
168                                          geometry = argv[++i];
169                                  else
170 <                                        gamcor = atof(argv[++i]);
170 >                                        gamstr = argv[++i];
171                                  break;
172                          default:
173                                  goto userr;
# Line 223 | Line 222 | char  *argv[];
222                  getevent();             /* main loop */
223   userr:
224          fprintf(stderr,
225 < "Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e +/-stops] pic ..\n",
225 > "Usage: %s [-di disp][[-ge] spec][-b][-m][-d][-f][-c nclrs][-e +/-stops][-g gamcor] pic ..\n",
226                          progname);
227          exit(1);
228   }
# Line 273 | Line 272 | char **argv;
272          name += i+1;
273          if ((thedisplay = XOpenDisplay(dispname)) == NULL)
274                  quiterr("cannot open display");
275 +                                /* set gamma value */
276 +        if (gamstr == NULL)             /* get it from the X server */
277 +                gamstr = XGetDefault(thedisplay, "radiance", "gamma");
278 +        if (gamstr == NULL)             /* get it from the environment */
279 +                gamstr = getenv("GAMMA");
280 +        if (gamstr != NULL)
281 +                gamcor = atof(gamstr);
282                                  /* get best visual for default screen */
283          getbestvis();
284                                  /* store image */
# Line 942 | Line 948 | getfull()                      /* get full (24-bit) data */
948                  colrs_gambs(scanline, xmax);
949                  if (ourras->image->blue_mask & 1)
950                          for (x = 0; x < xmax; x++)
951 <                                *dp++ = scanline[x][RED] << 16 |
952 <                                        scanline[x][GRN] << 8 |
953 <                                        scanline[x][BLU] ;
951 >                                *dp++ = (unsigned int4)scanline[x][RED] << 16 |
952 >                                        (unsigned int4)scanline[x][GRN] << 8 |
953 >                                        (unsigned int4)scanline[x][BLU] ;
954                  else
955                          for (x = 0; x < xmax; x++)
956 <                                *dp++ = scanline[x][RED] |
957 <                                        scanline[x][GRN] << 8 |
958 <                                        scanline[x][BLU] << 16 ;
956 >                                *dp++ = (unsigned int4)scanline[x][RED] |
957 >                                        (unsigned int4)scanline[x][GRN] << 8 |
958 >                                        (unsigned int4)scanline[x][BLU] << 16 ;
959          }
960   }
961  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines