[cairo] GTKCairo development

Øyvind Kolås oeyvindk at hig.no
Fri Apr 30 13:32:39 PDT 2004


* Andrew Johnson <acjgenius at earthlink.net> [040430 22:20]:
> On Fri, 2004-04-30 at 15:49, =?iso-8859-1?Q?=D8yvind_Kol=E5s?= wrote:
> >       cairo_set_gtk_color (ct, "base", GTK_STATE_NORMAL);
> > 
> 
> This is a bad way to go about it. Most themes are per widget dependent,
> so you will really want a widget class/name parameter to send with it
> otherwise you will usually be wrong, or better yet, a specific style its
> being grabbed from. And this doesn't belong in cairo but in the gtk
> side, via a get value. 
> 
> gtk_style_get_color_as_rgb(style, "base",GTK_STATE_NORMAL, &r, &g, &b);
> cairo_set_rgb(r, g, b);

I don't have time to code on this now, but if the above works, it is
part of what needs to go into the documentation og gtkcairo, and a
convenience macro implementing it be defined somehow.

> also be wary this will not work unless the theme in question SETS all
> the colors, which many pixmap themes do not, in those cases this will
> almost always result in black.

I am currently getting it from the widget that implements the cairo
surface, which is an extended GtkWidget, if a theme doesn't set color
values matching the current pixmaps used, I would consider the theme to
have a bug.

> similar issue to the above, you would use the style to get the pango
> font description and convert to set on cairo.

Initially I will only try to make sure cairo toy font api's default font
matches the one in the gtk+ theme, how this is accomplished won't be
visible yet in gtkcairo's api anyways.

The direction I am thinking about bringing gtkcairo in, is to facilitate
using it as a canvas for events etc. and make sure that it is able to
draw in a consistent fashion with the rest of the enviroment, the code
will mostly be gtk+ code, but I also want the drawing code itself to be
as cairo clean as possible, or at least in gtkcairo control, since
printing what is actually drawn to screen is useful, and then being able
to reuse code, and perhaps even functions is important.

Besides it looks much better to use the cairo namespace only in the 
rendering part of the code, and seperate it completely from the rest.

/Øyvind K.

-- 
  .^.
  /V\    Øyvind Kolås,  Gjøvik University College, Norway 
 /(_)\   <oeyvindk at hig.no>,<pippin at users.sourceforge.net>
  ^ ^    




More information about the cairo mailing list