Am Sonntag, den 27.12.2009, 19:39 +0100 schrieb
hermann:
gboolean box_expose(GtkWidget *wi, GdkEventExpose
*ev, gpointer data)
{
cairo_t *cr;
// create a cairo context //
cr = gdk_cairo_create(wi->window);
double x0 = wi->allocation.x;
double y0 = wi->allocation.y;
double rect_width = wi->allocation.width;
double rect_height = wi->allocation.height;
cairo_rectangle (cr, x0,y0,rect_width,rect_height+3);
cairo_set_source_rgba (cr, 0, 0, 0, 0.5); // a set the opacity
level
cairo_fill (cr);
cairo_destroy(cr);
// EDIT:// don't forget to
return false;
//
> }
> draw a transparent black rectangle to the calling widget.
> You can connect it with to make sure it will redraw when needed.
>
> g_signal_connect(widget, "expose-event", G_CALLBACK(box_expose), NULL);
>
> more examples you could found here
>
http://cairographics.org/samples/
>
> regards hermann
>
Thanks. That's what I was looking for. I was getting close but this code
definitely saves me some time.
FYI, I am have merged the gtkmeter.c and gtkmeterscale.c classes into
one widget. With the transparent levels it looks very nice now.
If anyone wants this class let me know.
Cheers.
Patrick Shirkey
Boost Hardware Ltd
Am Montag, den
28.12.2009, 04:30 +1100 schrieb Patrick Shirkey:
Hi,
Does anyone have an example in c of drawing a gdk_rectangle with opacity
in the foreground color?
There's several examples in python floating around that use the cairo
but I can't find a nice example in c.
Cheers.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev(a)lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev