Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think!mintaka!bloom-beacon!EXPO.LCS.MIT.EDU!converse From: converse@EXPO.LCS.MIT.EDU (Donna Converse) Newsgroups: comp.windows.x Subject: Re: Help with colormaps. Message-ID: <9002261950.AA01703@expo.lcs.mit.edu> Date: 26 Feb 90 19:50:44 GMT References: <9002250842.AA02138@dogmatix.cs.uoregon.edu.cs.uoregon.edu> Sender: daemon@athena.mit.edu (Mr Background) Organization: X Consortium, MIT Laboratory for Computer Science Lines: 37 > Constructing the colormap is not a problem. I can't figure out how to > use it. I have tried two things: > > i) cmap=XCreateColormap(display,window,visual,AllocAll); > > Whenever I use AllocAll in this call it does something funky > to display. The side effect is that it bombs when it hits > XNextEvent(display,&e). Reason? Hmmm.... Does something funky to display.... bombs.... hmmm... my crystal ball suggests that perhaps you're specifying a visual type that doesn't allow read/write allocation. Try reading about visuals, try using the function XGetVisualInfo or XMatchVisualInfo, try looking for error messages and try using a debugger. > ii) cmap=XCreateColormap(display,window,visual,AllocNone); with the following (paraphrased by the answerer): XAllocColorCells(display, cmap, False, NULL, 0, pixels, ncolors); > It didn`t seem to work > for any value of ncolors (I put it in a loop from 256 down to 0). Maybe the colormap was created with a visual type that doesn't allow read/write allocation from the colormap. > Finally, when I actually do get around to building the virtual colormap > successfully, do I use XInstallColormap or XSetWindowColormap? XSetWindowColormap. Donna Converse converse@expo.lcs.mit.edu