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.9 by greg, Sat May 30 09:33:01 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 241 | Line 240 | init()                 /* get data and open window */
240                          CWBackPixel|CWBorderPixel|CWColormap, &ourwinattr);
241          if (wind == 0)
242                  quiterr("cannot create window");
243 +        XFreeColormap(thedisplay, ourwinattr.colormap);
244          width = xmax;
245          height = ymax;
246          ourgc = XCreateGC(thedisplay, wind, 0, 0);
247 <        XSetState(thedisplay, ourgc, BlackPixel(thedisplay,ourscreen),
248 <                        WhitePixel(thedisplay,ourscreen), GXcopy, AllPlanes);
247 >        XSetState(thedisplay, ourgc, ourblack, ourwhite, GXcopy, AllPlanes);
248          revgc = XCreateGC(thedisplay, wind, 0, 0);
249          XSetFunction(thedisplay, revgc, GXinvert);
250          fontid = XLoadFont(thedisplay, FONTNAME);
# Line 416 | Line 415 | static char  vistype[][12] = {
415          fprintf(stderr, "Selected visual type %s, depth %d\n",
416                          vistype[ourvis.class], ourvis.depth);
417   #endif
418 +                                        /* make appropriate adjustments */
419          if (ourvis.class == GrayScale || ourvis.class == StaticGray)
420                  greyscale = 1;
421          if (ourvis.depth <= 8 && ourvis.colormap_size < maxcolors)
422                  maxcolors = ourvis.colormap_size;
423          if (maxcolors > 4)
424                  maxcolors -= 2;
425 +        if (ourvis.class == StaticGray) {
426 +                ourblack = 0;
427 +                ourwhite = 255;
428 +        } else if (ourvis.class == PseudoColor) {
429 +                ourblack = BlackPixel(thedisplay,ourscreen);
430 +                ourwhite = WhitePixel(thedisplay,ourscreen);
431 +                if ((ourblack|ourwhite) & ~255L) {
432 +                        ourblack = 0;
433 +                        ourwhite = 1;
434 +                }
435 +        } else {
436 +                ourblack = 0;
437 +                ourwhite = ourvis.red_mask|ourvis.green_mask|ourvis.blue_mask;
438 +        }
439          XFree((char *)xvi);
440   }
441  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines