Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!ucbvax!bloom-beacon!ZIA.AOC.NRAO.EDU!cflatter From: cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) Newsgroups: comp.windows.x Subject: Re: Help on X colormap Message-ID: <9008221650.AA22257@zia.aoc.nrao.edu> Date: 22 Aug 90 16:50:55 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 49 Brian Ho writes: > I have some problems which are concerning colors display in X-window system. > I am trying to display more than 256 different colors, however, everytime > when I used up the available color cells (256), I will obtain some (junky) > color. I am wondering if there is a way that I can create another color > map to display 256+ colors. > > I used XAllocColor to allocate the color cells. > > I have tried to use XCopyColormapAndFree() function (Xlib). But it does not > seem to work. > The following is the configuration on my system under X.. > > > Class : PseudoColor > Depth : 8 planes > size of colormap : 256 entries > red, green, blue mask : 0x0, 0x0, 0x0 > significant bits in color speci. : 8 bits. (I think it is the problem) There is no way Brian can get a colour map with more than 256 entries. His actual problem appears to be that he needs to allocate more than 256 - n colors where n is the number of colormap entries already allocated by other clients. I'm not sure why XCopyColormapAndFree() isn't working. The O'Reilly manual (Vol 2) seems to imply that it only works if the original colormap was created by the client; I need to do some experiments to find out if that is really the case. I you want to set up a colormap with a large number of exact colors that is known in advance you may want to try preallocating a range of colors with XAllocColorCells() and creating a new colormap with XCreateColormap() if this fails. However the private colormap is created you need to exercise some care if it is associated with a subwindow. If you are using an ICCCM compliant window manager you will need to register the subwindow and colormap with the window manager using XSetWMColormapWindows(). Unfortunately some ICCCM window managers ignore this and won't install the colormap when you need it. If you are using a non-ICCCM window manager you will need to install the colormap from the client and restore the default when necessary (note that ICCCM window managers may regard this as an illegal act). Chris Flatters cflatter@nrao.edu