[maemo-developers] HildonAnimationActor and transparency
From: Vlad Vasiliev vlad at gas.byDate: Fri Oct 23 10:40:51 EEST 2009
- Previous message: HildonAnimationActor and transparency
- Next message: HildonAnimationActor and transparency
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm sorry I forgot a small additional part of code. Here is the correct variant pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/omweather/icons/Glance/dark_cloud.png", 128, 128, NULL); image = gtk_image_new_from_pixbuf (pixbuf); g_object_unref(G_OBJECT(pixbuf)); g_signal_connect(G_OBJECT(image), "expose_event", G_CALLBACK(expose_event), pixbuf) ha = hildon_animation_actor_new(); gtk_container_add (GTK_CONTAINER (ha), image); realize(ha); gtk_widget_show_all (ha) realize (GtkWidget *widget) { GdkScreen *screen; screen = gtk_widget_get_screen (widget); gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen)); } gboolean expose_event (GtkWidget *widget,GdkEventExpose *event, gpointer data) { cairo_t *cr; GdkPixbuf *pixbuf = (GdkPixbuf *) data; cr = gdk_cairo_create(widget->window); gdk_cairo_region(cr, event->region); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0); cairo_paint(cr); cairo_destroy(cr); return TRUE; } Vlad Vasiliev wrote: > Hi Cornelius > > I used the next solution: > > pixbuf = gdk_pixbuf_new_from_file_at_size > ("/usr/share/omweather/icons/Glance/dark_cloud.png", > 128, 128, NULL); > > image = gtk_image_new_from_pixbuf (pixbuf); > g_object_unref(G_OBJECT(pixbuf)); > g_signal_connect(G_OBJECT(image), "expose_event", > G_CALLBACK(expose_event), > pixbuf) > ha = hildon_animation_actor_new(); > gtk_container_add (GTK_CONTAINER (ha), image); > > > gboolean > expose_event (GtkWidget *widget,GdkEventExpose *event, > gpointer data) > { > cairo_t *cr; > GdkPixbuf *pixbuf = (GdkPixbuf *) data; > > cr = gdk_cairo_create(widget->window); > gdk_cairo_region(cr, event->region); > cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); > gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0); > cairo_paint(cr); > cairo_destroy(cr); > return TRUE; > } > > BR, > Vlad. > Cornelius Hald wrote: > >> Hi, >> >> yesterday I was playing around with HildonAnimationActor and it's really >> nice what you can do with it. But there are still some things, I don't >> really understand. Hopefully someone can help me with that :) >> >> I created a HildonAnimationActor and put a GtkImage, made from a ARGB >> png, onto it with gtk_container_add(). >> >> The problem is, that the HildonAnimationActor has it's own background, >> so the transparent parts of the image show the background of the actor >> instead of the underlaying widget. >> >> I can use hildon_animation_actor_set_opacity() an the actor to make it >> transparent, but that affects the complete actor, so both, the actors >> background and the image become transparent. >> >> My question is: How do I make the background of the actor completely >> transparent without altering the transparency of the content of the >> actor? >> >> I really hope I don't have to go back to HildonRemoteTexture, because >> HildonAnimationActor is much nicer for my purpose. >> >> Thanks! >> Conny >> >> >> P.S. HildonAnimationActor is a GtkWindow, so maybe I should just try to >> remove the background of the window? I don't know how to do that, but I >> know it's possible. Would this be the way to go or is there a simpler >> way? >> >> >> _______________________________________________ >> maemo-developers mailing list >> maemo-developers at maemo.org >> https://lists.maemo.org/mailman/listinfo/maemo-developers >> >> > > _______________________________________________ > maemo-developers mailing list > maemo-developers at maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers >
- Previous message: HildonAnimationActor and transparency
- Next message: HildonAnimationActor and transparency
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]