home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / 20523 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.6 KB

  1. Path: sparky!uunet!news.larc.nasa.gov!mollusk.larc.nasa.gov!user
  2. From: judith@mermaid.larc.nasa.gov (Judith Moore)
  3. Newsgroups: comp.windows.x
  4. Subject: Re: Help with Colormaps
  5. Followup-To: comp.windows.x
  6. Date: 23 Dec 1992 14:59:32 GMT
  7. Organization: NASA/Langley Research Institute
  8. Lines: 34
  9. Distribution: world
  10. Message-ID: <judith-231292100556@mollusk.larc.nasa.gov>
  11. References: <1h5ac3INN11v@rave.larc.nasa.gov> <7320055@hpfcso.FC.HP.COM> <stefans.725095561@bauv106>
  12. NNTP-Posting-Host: mollusk.larc.nasa.gov
  13.  
  14. Thanks for the attention to my problem. Unfortunately,
  15. I must be misinterpreting the suggestions. This is what
  16. I do:
  17.     (misc setup)
  18.    winAttrib.colormap = DefaultColormap(theDisplay, theScreen);
  19.    mainWindow =    XCreateWindow (theDisplay, ...., &winAttrib);
  20.    XMapWindow (theDisplay, mainWindow);
  21.    anImage = XCreateImage (theDisplay, theVisual, 8, ZPixmap, ...); 
  22.    XPutImage (theDisplay, mainWindow, theGC, anImage, ...);
  23.    XFlush (theDisplay);
  24.    sleep (5);
  25.  
  26.     grayMap = XCreateColormap (theDisplay, mainWindow, theVisual, AllocAll);
  27.     for (i = 0; i < 255; i++) {
  28.         aColor.pixel = i;    
  29.         aColor.red = aColor.blue = aColor.green = i << 8;
  30.         XStoreColor (theDisplay, grayMap, &aColor);
  31.         }
  32.     
  33.     XSetWindowColormap (theDisplay, mainWindow, grayMap);
  34.     XFlush (theDisplay);
  35.     sleep (5);
  36.  
  37. What happens is, my image appears in the window with the default
  38. colormap, and just sits there.  The XSetWindowColormap() call
  39. appears to have no effect whatsoever.  
  40.  
  41. If I do the XSetWindowColormap() _before_ XMapWindow(), I get the
  42. grayscale I expect.  But then I can't change _that_ to anything 
  43. else.
  44.  
  45. Comedy is easy; color is hard.
  46.  
  47. Judith Moore
  48.