Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ora!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU (der Mouse) Newsgroups: comp.windows.x Subject: Re: read/write colorcells problem Message-ID: <9103151144.AA11354@lightning.McRCIM.McGill.EDU> Date: 15 Mar 91 11:44:17 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 25 > I have a problem to allocate read/write colorcells in a colormap. If > I create a new virtual colormap with XCopyColrormapAndFree after a > failure of XAllocColorCells, one of the extra allocation requests > returns a bad pixel value (e.g. 256) that is out of range of the > colormap. > /* Allocate one pixel */ > defs[0].pixel = 2; > XAllocColor(theDisp, cmap, &defs[0]); This does not necessarily allocate a cell in the colormap. (If your point is just to make sure at least one cell is allocated, it will work.) XAllocColor ignores the pixel field of the structure passed in; it fills that value in with the colormap index of the cell allocated for the given RGB values on return. What makes you think 256 is out of range? If you got 256 from the "size of colormap" field printed by xdpyinfo, or the analogous thing from Xlib calls, I would say this is a server bug...whose server are you using, on what machine? der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu