Re: [gtk-list] Colors and GDK, this the best way?



On Thu, Sep 17, 1998 at 07:57:14PM -0700, Eric Harlow wrote:
> 
> 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)
> ...
> 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? 

Yes, you are making it harder on yourself than necessary.  Try:

  GdkGC bluegc;
  GdkColor c;

  c.red   = 0;
  c.green = 0;
  c.blue  = 0xffff;

  /* Optionally, use the colormap of your choice here */
  gdk_color_alloc(gdk_colormap_get_system(), &c);

  gdk_gc_set_foreground(&bluegc, &c);


-JT



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