anderdla@CS.UOREGON.EDU (02/25/90)
First of all, I don't read this newsgroup so don't flame me if I'm dredging up an old topic. I am having troubles with colormaps. What I am working on is an application that will display run-length-encoded files (ala Utah). We have getX11, but this program uses the default colormap and dithering to accomplish the imaging. I actually want to analyze the colors in the picture and construct a colormap on the fly. Constructing the colormap is not a problem. I can't figure out how to use it. I have tried two things: i) cmap=XCreateColormap(display,window,visual,AllocAll); Whenever I use AllocAll in this call it does something funky to display. The side effect is that it bombs when it hits XNextEvent(display,&e). Reason? ii) cmap=XCreateColormap(display,window,visual,AllocNone); Now how do I allocate colorcells? The XStoreColors and XInstallColormap calls work fine, but when I try using these colors they're private(this makes sense to me, I need to acquire some of these cells for my own private use, right?). It seems that XAllocColorCells is too complicated for my purposes. What's all the plane_masks crap for? All I want is a given number of cells (say 256) and their pixel numbers that I can assign RGB values to in the colormap. There must be an easy way to do this! By the way, I was reading in the Xlib programming manual by Nye that you can specify 0 for nplanes and ncolors for the number of cells you want and it will give you that many cells w/o the bullshit. It didn`t seem to work for any value of ncolors (I put it in a loop from 256 down to 0). This is on p. 189 of the book in case anyone wants to double check or refute (I wish you would!) this. Finally, when I actually do get around to building the virtual colormap successfully, do I use XInstallColormap or XSetWindowColormap? In case you need to know, we are running X11/NeWS and OpenWindows on Sun Sparcs (Sun4). Thanks in advance for any assisstance. -------------------------------------------------------------------- ______ ___ Darren Anderson \ \ | _ anderdla@cs.uoregon.edu 1656 Walnut St. | | | / \ Eugene, Ore. 97403 | | | /___\ "MTV is like this very /_____/ | / \ big advertising agency, /______ \ and its only client is / \ \ itself." --------------------------------------------------------------------
spencer@eecs.umich.edu (Spencer W. Thomas) (02/26/90)
In article <9002250843.AA02142@dogmatix.cs.uoregon.edu.cs.uoregon.edu> anderdla@CS.UOREGON.EDU writes: > [Questions about allocating colormaps and storing colors into them.] Grab the new version of getX11 from cs.utah.edu:pub/getX11.2.1.sh.Z It still doesn't do intelligent things with the dithering (that's planned, really), but it has LOTS of X colormap code. You should find what you want in there. -- =Spencer (spencer@eecs.umich.edu)