Path: utzoo!utgpu!watmath!att!dptg!rutgers!usc!bloom-beacon!EXPO.LCS.MIT.EDU!converse From: converse@EXPO.LCS.MIT.EDU (Donna Converse) Newsgroups: comp.windows.x Subject: Re: Storing colors in the DefaultColormap Message-ID: <8908301924.AA24307@expo.lcs.mit.edu> Date: 30 Aug 89 19:24:02 GMT References: <8912302146.AA03921@popeye.nosc.mil.sun.com> Sender: daemon@bloom-beacon.MIT.EDU Organization: X Consortium, MIT Laboratory for Computer Science Lines: 38 > I have an application that displays a digital image in a window. > The image is stored as a bunch of eight bit values that are indexes > into a predefined color map. Each image uses only the last 216 colors > of the colormap, leaving the first 40 colors to be used by the rest of > the system. > Is there a way to store a given color cell definition in a > specific location in the colormap? You can request that colormap cells be allocated, but you cannot indicate in your request a preference for the specific location or index of the cell. Furthermore, the protocol does not specify which colormap cell will be granted when there is more than one cell available to fill the request. > Also, is there a way to Query > the colormap, so that I can find out how many colormap cells are > available? The is no good way to find out the number of cells that are unused (not allocated by any client) in the default colormap. You could start out with the assumption that there are enough available, and use XCopyColormapAndFree if an allocation request fails. If you do not want to do mapping between your image data colormap cell index and the actual colormap cell index, then on certain display hardware, under certain conditions with regard to other clients, it is possible to allocate and define a particular sequence of colormap cells. From the point of view of the importance of an application's ability to run simultaneously with other applications, and the ability to work properly on many different displays, I think that you would be better off to find a fast integer mapping scheme from the image data to the actual colormap index. Donna Converse converse@expo.lcs.mit.edu