[comp.windows.x] Stupid Colormap question.

bmc@MYCROFT.MAYO.EDU (08/26/89)

I am at a lost as to why the following code does not product a gray scale
colormap. It does produce a monotonic black colormap.

back ground information:
     1) Hardware : DECstation 3100 running ULTRIX 2.0 operating under DECwindows
                   (color monitor = pseudocolor visual)
     2) first_window is the parent window of my application
     3) cmap is created with
             XCreateColormap (display, first_window,
                              DefaultVisual (display, screen), AllocAll )
     4) color is an array DisplayCells in size, allocated with a malloc.

the code:

        for (i = 0; i < DisplayCells(display, screen); i++) {
             color[i].flags = DoRed | DoBlue | DoGreen;
             color[i].pad   = NULL;
             color[i].red = color[i].green = color[i].blue = (i << 8);
             color[i].pixel = i;
                              }
             XStoreColors (display, cmap, color, DisplayCells(display, screen));
             XSetWindowColormap (display, first_window, cmap);

Thanks in advance for the help.

----------------------------------------------------
Bruce M. Cameron                    bmc@bru.mayo.edu
Medical Sciences 1-14               (507) 284-3288
Mayo Foundation                     WD9CKW
Rochester, MN 55905
----------------------------------------------------