[cairo] GTKCairo development

Owen Taylor otaylor at redhat.com
Sat May 1 06:25:04 PDT 2004

On Fri, 2004-04-30 at 16:14, Andrew Johnson wrote:
> On Fri, 2004-04-30 at 15:49, =?iso-8859-1?Q?=D8yvind_Kol=E5s?= wrote:
> >     - some way of accessing the current gtk+ theme's colors, (currently
> >       I have a crude implementation in the gtkcairo_slide demo in
> >       cairo-demo
> > 
> >       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);

We might want a convenience function something on the Gdk/Cairo
interface to set the Cairo color from a GdkColor so you
can do:

 gdk_cairo_set_color (cairo, &style->base[GTK_STATE_NORMAL]);

I'd agree that introducing GtkStyle into the Cairo layers is not

> 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.

Any theme that doesn't set distinguishable colors is buggy.

> >     - making the default font in the toy api the same as the current
> >       gtk+ theme
> > 
> similar issue to the above, you would use the style to get the pango
> font description and convert to set on cairo.

Here what we need is Pango/Cairo integration ... obviously that is a
fairly big job, but since we have a real font system, spending effort
integrating GTK+ with the toy font system is a bit weird. It's on my
roadmap, but probably will take a while yet. If someone else wanted to
play around with that, that would be great.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040501/b7ca9b59/attachment.pgp

More information about the cairo mailing list