home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!sun-barr!sh.wide!wnoc-tyo-news!scslwide!wsgw!wsservra!onoe
- From: judith@mermaid.larc.nasa.gov (Judith Moore)
- Newsgroups: fj.mail-lists.x-window
- Subject: Re: Help with Colormaps
- Message-ID: <1992Dec23.171640.25648@sm.sony.co.jp>
- Date: 23 Dec 92 17:16:40 GMT
- Sender: onoe@sm.sony.co.jp (Atsushi Onoe)
- Distribution: fj
- Organization: NASA/Langley Research Institute
- Lines: 40
- Approved: michael@sm.sony.co.jp
-
- Date: 23 Dec 1992 14:59:32 GMT
- Message-Id: <judith-231292100556@mollusk.larc.nasa.gov>
- Newsgroups: comp.windows.x
- References: <1h5ac3INN11v@rave.larc.nasa.gov>, <7320055@hpfcso.FC.HP.COM>, <stefans.725095561@bauv106>
- Sender: xpert-request@expo.lcs.mit.edu
-
- Thanks for the attention to my problem. Unfortunately,
- I must be misinterpreting the suggestions. This is what
- I do:
- (misc setup)
- winAttrib.colormap = DefaultColormap(theDisplay, theScreen);
- mainWindow = XCreateWindow (theDisplay, ...., &winAttrib);
- XMapWindow (theDisplay, mainWindow);
- anImage = XCreateImage (theDisplay, theVisual, 8, ZPixmap, ...);
- XPutImage (theDisplay, mainWindow, theGC, anImage, ...);
- XFlush (theDisplay);
- sleep (5);
-
- grayMap = XCreateColormap (theDisplay, mainWindow, theVisual, AllocAll);
- for (i = 0; i < 255; i++) {
- aColor.pixel = i;
- aColor.red = aColor.blue = aColor.green = i << 8;
- XStoreColor (theDisplay, grayMap, &aColor);
- }
-
- XSetWindowColormap (theDisplay, mainWindow, grayMap);
- XFlush (theDisplay);
- sleep (5);
-
- What happens is, my image appears in the window with the default
- colormap, and just sits there. The XSetWindowColormap() call
- appears to have no effect whatsoever.
-
- If I do the XSetWindowColormap() _before_ XMapWindow(), I get the
- grayscale I expect. But then I can't change _that_ to anything
- else.
-
- Comedy is easy; color is hard.
-
- Judith Moore
-