[comp.windows.x] GC

castor@media-lab.MEDIA.MIT.EDU (Carlos Rabell) (03/12/91)

I want to get the Graphics Context of an existing
window so I can change its colors at will.

Right now it works fine but since I'm using a 
GC that I created, when I try to use the window
again the original colors come out again.

Carlos Rabell
-MIT Media-Lab-

ekberg@asl.dl.nec.COM (Tom Ekberg) (03/12/91)

The purpose of a GC is to store parameters used to change pixels in a drawable
during a drawing operation.  Changing GCs will not affect pixels that are not
in the `scope' of a drawing operation.  If you want to change colors in a
window, you need to change the colormap in some way.  For example, if a window
allocates a color cell in the colormap using XAllocColorCells (assuming pseudo
color) and places a color there, you can change the color to something else by
using XStoreColor.  Another way to change colors is to use two colormaps,
placing different colors in each one.  By changing the colormap for a window
you will also change the colors.

  -- tom, ekberg@asl.dl.nec.com (x3503)