Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!ncar!ico!onecom!onecom.uucp!john From: john@onecom.uucp (John Brinegar) Newsgroups: comp.windows.x Subject: Colormap dilemma Message-ID: <1991Mar12.235227.28172@onecom> Date: 12 Mar 91 23:52:27 GMT Sender: john@onecom (John Brinegar) Organization: TelWatch Inc., 2905 Wilderness Place, Boulder, CO 80301 Lines: 50 I have been having philosophical discussions concerning colormaps in X, and I am interested in receiving a dose of conventional wisdom on this topic. I am currently working on a product that contains two separate X client applications with 128 colors each (same 128 colors for both applications). These 128 colors have to be settable (read/write) by the application. These colors are all specified by their RGB values. I have tried several means of achieving this goal: 1. Allocating 128 read/write (non-shareable) color cells from the default colormap for each application. This does not work, because there are only 256 cells in the colormap, and some are already allocated by other applications. This clearly is not a solution because of system resource limits. 2. Creating a separate (identical) colormap for each application, and allocating 128 read/write color cells from the newly created colormap. This solution has the familiar side effect of colormap swapping when the mouse pointer leaves the application's window. This is a problem in our environment because the colors in our application are critical to the functionality of our product. However, this is only a problem when the mouse pointer leaves either of the two applications (because the applications have identical colormaps). Advantage: Correct colors always available for each application. Disadvantage: False colors when pointer outside of both applications. 3. Using XAllocColor() to try to get the exact colors we request in each application from the default colormap. If our applications are the first third party X applications up, the odds are very good that we will successfully allocate all the requested colors (exactly as requested - by RGB values). However, this is not always guaranteed - other complex, many-colored applications may have all colorcells in the default colormap allocated, and we have to settle for approximations. (See Xlib Reference Manual). Advantage: No colormap swapping Disadvantage: No guarantees that exact colors will be available For further information, these applications are running on an IBM RS/6000 running AIX V3.1 (3003 update). Are there other alternatives for what I am trying to do, or do I need to choose between the lesser of two evils (2 and 3)? Any help with this dilemma is appreciated. -- John D. Brinegar {att!uswat, uunet!dunike} !onecom!john TelWatch Inc. (303) 440-4756