Hi all,

I am trying to make a ClutterStage transparent, in other words, make the
background of a ClutterStage transparent. But it seems that ClutterStage is
a special ClutterActor and it doesn't work as expected.

At first, I tried to set the opacity of a ClutterStage to 0x00, but what I
got was that all the actors on the stage were missing. Apparently, that was
not what I want.

ClutterActor *stage = clutter_stage_get_default ();   // use a default stage

clutter_actor_set_opacity ( stage, 0x00 );           // all actors on the
stage are missing after then



Also, I tried to embed a stage onto a GTK transparent window by using
ClutterEmbed class in clutter-gtk-0.8. The transparent GTK window was made
with the help of cairo by setting the alpha value of a RGBA colormap. But I
couldn't make the ClutterEmbed widget transparent in this way, either.

The related code snippets are pasted below:

/* initialize */

GtkWidget *clutterWidget = gtk_clutter_embed_new ();   // wrap a clutter
stage inside GTK widget

gtk_widget_set_app_paintable ( clutterWidget, TRUE );   // set the widget
paintable



/* connect “expose-event” signal to call back function : expose_clutter */

g_signal_connect (G_OBJECT( clutterWidget ), “expose-event”,
G_CALLBACK(expose_clutter), NULL);



/* call back function : expose_clutter */

Gboolean expose_clutter( GtkWidget *widget, GdkEventExpose *event, gpointer
userdata)

{

         /* use cairo to paint a transparent GtkWidget */

         cairo_t *cr = gdk_cairo_create (widget->window);

         … …

         /* draw the background */

         cairo_set_operator ( cr, CAIRO_OPERATOR_SOURCE );

         cairo_paint ( cr );

         … …

}

The ClutterStage is wrapped in a GtkWidget. When testing transparency of the
GtkWidget, I found that it is the color of stage that makes it opaque,
though GtkWidget has been set transparent.

So, I'm wondering whether I can make a transparent ClutterStage, is there
any method could be applied to achieve this effect?



Looking forward to your help and reply.



Thanks & Best Regards,

Yuanyi Zhu

Mar 3, 2009

Reply via email to