Article View: comp.windows.x
Article #37348Help with colormaps.
From: anderdla
Date: Sun, 25 Feb 1990 08:42
Date: Sun, 25 Feb 1990 08:42
56 lines
3008 bytes
3008 bytes
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."
--------------------------------------------------------------------
Technical Details
Message-ID:
<9002250842.AA02138@dogmatix.cs.uoregon.edu.cs.uoregon.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!CS.UOREGON.EDU!anderdlaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!CS.UOREGON.EDU!anderdla From: anderdla@CS.UOREGON.EDU Newsgroups: comp.windows.x Subject: Help with colormaps. Message-ID: <9002250842.AA02138@dogmatix.cs.uoregon.edu.cs.uoregon.edu> Date: 25 Feb 90 08:42:41 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 56