[comp.unix.ultrix] Colormaps.

harish@csl.ncsu.edu (Harish Hiriyannaiah) (10/03/89)

I am having trouble loading color maps in X11 r3 (also using HPWidgets).
I can set the Red and Blue LUTs with no problem for any or all of the 256 
colors, but Green has me stumped.  Here is the code that is used to load an
entire map (I have also tried permutations of XAllocColorCells for 
read/write cells and XAllocColor for read/only cells with no success)
LoadColorMap returns a valid XColor array and correct number of colors. 
Has anyone out there any suggestions ?

        user_color = LoadColorMap(mapfilename,&num_usercolors);
        if (num_usercolors > DisplayCells(disp,DefaultScreen(disp)))
           num_usercolors = DisplayCells(disp,DefaultScreen(disp));
        user_colormap = XCreateColormap(disp,root_window,default_visual,
                                         AllocAll);
        XStoreColors(disp,user_colormap,user_color,num_usercolors);
	XSetWindowColormap(disp,root_window,user_colormap);
        XInstallColormap(disp,user_colormap);

Comments:

disp = disp of Toplevel widget from XtInitialize.
root_window = root_window of Toplevel widget.
default_visual = default_visual of Toplevel widget.
user_color[i].flags = DoRed|DoGreen|DoBlue;

Environment: Ultrix 3.1, VaxStation 3100, HP Widgets. The server is a
             DECStation 3100.

harish pu. hi.				harish@ecebucolix.ncsu.edu
					harish@ecelet.ncsu.edu