home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / fj / maillis / xwindow / 18884 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.8 KB

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