Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!SABER.COM!jimf From: jimf@SABER.COM Newsgroups: comp.windows.x Subject: Re: Colormaps Message-ID: <9007161359.AA01883@lance> Date: 16 Jul 90 13:59:52 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 33 |Does anyone know how to preserve the colors used by the motif window manager |within my 256 element colormap? Basically, I would like to create a (256 - N) |element colormap. Where N would be the number of colors needed to preserve |the 3D-look, menus, etc. used by the mwm. Due to the dynamic nature of the |imaging colormap, sharing of colormaps does not seem like a good approach. |I'd really just assume that N out of my 256 are reserved for the window manager. |Hopefully N won't be to large (16 or less?). | |If anyone has any suggestions, references, etc., I'd really appreciate it. Most of the code to do what you want is implemented in my xloadimage program in send.c, except that it allocates the colors shareable (when done in the default colormap) instead of read/write as you want. What you want to do is loop on an XAllocColorCells to allocate as many cells read/write as you can. You'll have to create a mapping of your image's pixel values to those returned by the server so that you can massage your image to fit these values. Code to do this massaging is also in send.c. Because the number of cells you can allocate is an unknown, you might want to put in a threshold value at which time you allocate a completely new colormap. This is what xloadimage does and it seems to work reasonably well. If you don't have xloadimage, it's available by anonymous ftp from expo.lcs.mit.edu in /contrib/xloadimage.1.06.tar.Z or I can email it to you. If you have further questions, feel free to email me directly. jim frost saber software jimf@saber.com