converse@EXPO.LCS.MIT.EDU (Donna Converse) (08/31/89)
> 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
glasgow@POPEYE.NOSC.MIL (Michael Glasgow) (12/31/89)
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. I can create an entire colormap, and store these colors in the colormap at the given locations with XStoreColors(), and then use XInstallColormap() to get the colormap to change. This will cause any windows which have used XAllocColor() to change colors. I don't want this to happen. Another way I could get the colors that I need is to use XAllocColor on all 216 colors, and do a translation as I read in the data to its proper pixel value. The problem with this is that it is slow for a 1500x1500 or larger image. Is there a way to store a given color cell definition in a specific location in the colormap? Also, is there a way to Query the colormap, so that I can find out how many colormap cells are available? Any response would be greatly appreciated. Michael Glasgow glasgow@popeye.nosc.mil