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.7 by greg, Thu May 28 09:43:09 1992 UTC vs.
Revision 2.12 by greg, Tue Sep 15 12:15:48 1992 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 41 | Line 41 | static char SCCSid[] = "$SunId$ LBL";
41   #define  ICONSIZ        (8*10)          /* maximum icon dimension (even 8) */
42  
43   #define  ourscreen      DefaultScreen(thedisplay)
44 #define  ourblack       BlackPixel(thedisplay,ourscreen)
45 #define  ourwhite       WhitePixel(thedisplay,ourscreen)
44   #define  ourroot        RootWindow(thedisplay,ourscreen)
45  
46   #define  revline(x0,y0,x1,y1)   XDrawLine(thedisplay,wind,revgc,x0,y0,x1,y1)
# Line 57 | Line 55 | int  fast = 0;                         /* keep picture in Pixmap? */
55   char    *dispname = NULL;               /* our display name */
56  
57   Window  wind = 0;                       /* our output window */
58 + unsigned long  ourblack=0, ourwhite=1;  /* black and white for this visual */
59   Font  fontid;                           /* our font */
60  
61   int  maxcolors = 0;                     /* maximum colors */
# Line 117 | Line 116 | main(argc, argv)
116   int  argc;
117   char  *argv[];
118   {
119 +        extern char  *getenv();
120 +        char  *gv;
121          int  headline();
122          int  i;
123          
124          progname = argv[0];
125 +        if ((gv = getenv("GAMMA")) != NULL)
126 +                gamcor = atof(gv);
127  
128          for (i = 1; i < argc; i++)
129                  if (argv[i][0] == '-')
# Line 241 | Line 244 | init()                 /* get data and open window */
244                          CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr);
245          if (wind == 0)
246                  quiterr("cannot create window");
247 +        XFreeColormap(thedisplay, ourwinattr.colormap);
248          width = xmax;
249          height = ymax;
250          ourgc = XCreateGC(thedisplay, wind, 0, 0);
251 <        XSetState(thedisplay, ourgc, BlackPixel(thedisplay,ourscreen),
248 <                        WhitePixel(thedisplay,ourscreen), GXcopy, AllPlanes);
251 >        XSetState(thedisplay, ourgc, ourblack, ourwhite, GXcopy, AllPlanes);
252          revgc = XCreateGC(thedisplay, wind, 0, 0);
253          XSetFunction(thedisplay, revgc, GXinvert);
254          fontid = XLoadFont(thedisplay, FONTNAME);
# Line 416 | Line 419 | static char  vistype[][12] = {
419          fprintf(stderr, "Selected visual type %s, depth %d\n",
420                          vistype[ourvis.class], ourvis.depth);
421   #endif
422 +                                        /* make appropriate adjustments */
423          if (ourvis.class == GrayScale || ourvis.class == StaticGray)
424                  greyscale = 1;
425          if (ourvis.depth <= 8 && ourvis.colormap_size < maxcolors)
426                  maxcolors = ourvis.colormap_size;
427          if (maxcolors > 4)
428                  maxcolors -= 2;
429 +        if (ourvis.class == StaticGray) {
430 +                ourblack = 0;
431 +                ourwhite = 255;
432 +        } else if (ourvis.class == PseudoColor) {
433 +                ourblack = BlackPixel(thedisplay,ourscreen);
434 +                ourwhite = WhitePixel(thedisplay,ourscreen);
435 +                if ((ourblack|ourwhite) & ~255L) {
436 +                        ourblack = 0;
437 +                        ourwhite = 1;
438 +                }
439 +        } else {
440 +                ourblack = 0;
441 +                ourwhite = ourvis.red_mask|ourvis.green_mask|ourvis.blue_mask;
442 +        }
443          XFree((char *)xvi);
444   }
445  
# Line 613 | Line 631 | XKeyPressedEvent  *ekey;
631                  XClearWindow(thedisplay, wind);
632                  map_rcolors(ourras, wind);
633                  if (fast)
634 <                        make_rpixmap(ourras);
634 >                        make_rpixmap(ourras, wind);
635                  redraw(0, 0, width, height);
636                  return(0);
637          case ' ':                               /* clear */
# Line 921 | Line 939 | int  y;
939                  if (fseek(fin, scanpos[y], 0) == -1)
940                          quiterr("fseek error");
941                  cury = y;
942 <        } else if (scanpos != NULL)
942 >        } else if (scanpos != NULL && scanpos[y] == -1)
943                  scanpos[y] = ftell(fin);
944  
945          if (freadcolrs(scanline, xmax, fin) < 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines