Xref: utzoo comp.windows.x:13907 comp.unix.ultrix:1840
Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!gatech!ncsuvx!csl.ncsu.edu!harish
From: harish@csl.ncsu.edu (Harish Hiriyannaiah)
Newsgroups: comp.windows.x,comp.unix.ultrix
Subject: Colormaps.
Message-ID: <4092@ncsuvx.ncsu.edu>
Date: 2 Oct 89 18:54:37 GMT
Sender: news@ncsuvx.ncsu.edu
Reply-To: harish@ecebucolix.ncsu.edu (Harish Hiriyannaiah)
Distribution: na
Organization: North Carolina State University
Lines: 29

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