[comp.windows.open-look] XAllocColorCells Problem

fhage@virga.rap.ucar.edu (Frank Hage) (03/01/91)

Help!

I'm using DevGuide (XView) [SPARC 2 GX running XNews under SunOS 4.1.1
with olwm] for an application and am having a problem storing colors in
allocated color cells. I can allocate the number of cells I desire, but
all attempts to set these cells have failed. (I ask for 16 colors and 1
overlay plane (for a total of 32 cells), and I typically get color cells
72-104.) I try (abbreviated for clarity) :

------------------------------------------------------------
dpy = (Display *) xv_get(my_base_window_handle,XV_DISPLAY);
cmap = DefaultColormap(dpy,DefaultScreen(dpy));

num_colors = 16;
XAllocColorCells(dpy,cmap,False,mask,1,pixels,num_colors);

flags = DoRed | DoGreen | DoBlue;
for(i=0; i < num_colors; i++){
	XStoreNamedColor(dpy,cmap,color_name[i],pixels[i],flags);
}
[the 16 (pixel[i] | mask[0])  colors set to white in a similar fashion]
------------------------------------------------------------

When I draw all 256 colors in my canvas I see that the allocated color
cells have not changed. I've tried XParseColor()/XStoreColors() with
the same result. I've also tried calling XInstallColormap(dpy,cmap); and
XSetPlaneMask(dpy,gc,AllPlanes); before drawing. I looked in the
XView examples and found /usr/openwin/share/src/sun/xview/examples/color/
color.c which also uses XAllocColorCells(); and it is only able to
change the *first* 72 colors (It appears to create a new colormap of
256 colors and installs it when the window has the input focus). All the
windows on the screen change color, but my 256 color box app. shows
only the first 72 have actually changed. 

Can anyone tell me what is happening, and what I need to do to set my
allocated color cells.

-Thanks in advance,	Frank Hage	(fhage@rap.ncar.ucar.edu)