Newsgroups: comp.windows.x
Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!hellgate.utah.edu!nil.utah.edu!kma
From: kma%nil.utah.edu@cs.utah.edu (Kwan-Liu Ma)
Subject: problem with colormap (X11)
Date: Wed, 25-Oct-89 16:30:00 MDT
Message-ID: <1989Oct25.163000.19611@hellgate.utah.edu>
Organization: Department of Computer Science, University of Utah

Hi,

I have some problem dealing with colormap in X11:

I create a private colormap for a specific window as follows:

   my_cmap = XCreateColormap(display, win, visual, AllocAll);
   XSetWindowColormap(dipaly, win, my_cmap);

   for (i = 0; i<64; i++) {
     Color[i].pixel = i;
     Color[i].red = ...
     Color[i].green = ...
     Color[i].blue = ...
     ...
   }
   XStoreColors(display, cmap, Color, 64);

Later in my program, I use 

  XCreateGC(display, win, ...);
  XSetForeground(display, gc, Color[i].pixel);
  XFillRectangle(display, win, gc, ...);

to form some images.

It turns out that I always get colors from the default colormap
instead of the private one. Where did I do wrong??
Thanks for any help !!

  -- Kwan
