PLEASE HELP WITH COLORS



I am trying to puyt miltiple rectangles, polygons,...
onto a drawing area.
Drawing them is done.  Now I'm trying to change colors.

Here's the color changing part I've been able to piece together.

    if (layer NE last_layer)
    {
      GdkColormap  *colormap = NULL;
      colormap  = gdk_colormap_get_system();
      if (gc EQ NULL)
      {
        gc = gdk_gc_new(drawing_area);
      }
      gdk_colormap_alloc(colormap,&layers[layer]);
      gdk_gc_set_foreground(gc,colormap);
      last_layer = layer;
    }

layers[layer] is one of these |
                              |
                              V

typedef struct {
    const char    *name;
    unsigned char red;
    unsigned char green;
    unsigned char blue;
    unsigned int  show:1;
    unsigned int  fill_on:1;
    unsigned int  fill_pattern;
    unsigned int  line_style;
    char*         layer_name;
} ColorEntry;



THe color changes each time I execute the app.  My test
case has 5 different rectangles.  Each should be a different color but all
are the same color.

Does it have to do with setting foreground with the last colormap?
It changes everything to the same color!!!!




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]