Colors and GDK, this the best way?




After muddling with GDK and playing with trying to change the colors
in a drawable area, I got the following segment of code to work so I
can use the "bluegc" to draw blue lines and such. (see bottom)

Java has it nice and simple -

    blue = new Color (r, g, b);

Seems that gtk is a bit more complicated than it should be.  Perhaps
I'm doing it the hard way.  Is there a quicker and better way to get a
gc that I can use to draw lines? 

---- code begins ---

   if (bluegc == NULL) {

        style = drawing_area->style;

        gc_values_mask = GDK_GC_FOREGROUND |
                         GDK_GC_FONT;

        gc_values.foreground.red = 0;
        gc_values.foreground.blue = 0xffff;
        gc_values.foreground.green = 0;

        gdk_color_alloc (style->colormap, 
                         &gc_values.foreground);

        bluegc = gtk_gc_get (style->depth,      
                         style->colormap,      
                         &gc_values,
                         gc_values_mask);    

    }




_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com



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