brian@ucselx.sdsu.edu (Brian Ho) (08/22/90)
Hello out there, 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) Please Send me mail at brian@math.sdsu.edu brian@ucselx.sdsu.edu Thank you in Advance..
cflatter@ZIA.AOC.NRAO.EDU (Chris Flatters) (08/22/90)
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
mouse@SHAMASH.MCRCIM.MCGILL.EDU (der Mouse) (08/23/90)
> 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. In my experience it is not. My programs regularly use XCopyColormapAndFree with the original colormap being the default colormap of the visual in use. (In fact, this is the only context in which I have called XCopyColormapAndFree, at least so far.) I have never had so much as a peep of trouble out of it. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
mouse@LARRY.MCRCIM.MCGILL.EDU (08/23/90)
> I am trying to display more than 256 different colors, [...]. > I am wondering if there is a way [...] to display 256+ colors. > Class : PseudoColor > Depth : 8 planes > size of colormap : 256 entries As long as you use that visual, there is no way you can ever possibly get more than 256 colors. Technically speaking, it is possible to get more than 256 colors with the above. However, I doubt that there are any servers out there that can actually give it to you. It would require a server whose max-installed-maps value for the visual is greater than 1; also, you would have to use more than one window. The former condition is the difficult one - as far as I know, servers that satisfy it simply do not exist. (Now I'll probably get 200 messages telling me I'm wrong, that there is the Frobozz 2199 that has a max-installed-maps of 8....:) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu