[maemo-developers] HildonAnimationActor and transparency

From: Vlad Vasiliev vlad at gas.by
Date: Fri Oct 23 10:30:41 EEST 2009
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
>   

More information about the maemo-developers mailing list