Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

HildonAnimationActor and transparency

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


hald at icandy

Oct 23, 2009, 12:08 AM

Post #1 of 4 (298 views)
Permalink
HildonAnimationActor and transparency

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
https://lists.maemo.org/mailman/listinfo/maemo-developers


vlad at gas

Oct 23, 2009, 12:30 AM

Post #2 of 4 (268 views)
Permalink
Re: HildonAnimationActor and transparency [In reply to]

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
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


vlad at gas

Oct 23, 2009, 12:40 AM

Post #3 of 4 (282 views)
Permalink
Re: HildonAnimationActor and transparency [In reply to]

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
>> https://lists.maemo.org/mailman/listinfo/maemo-developers
>>
>>
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers [at] maemo
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers


hald at icandy

Oct 23, 2009, 1:27 AM

Post #4 of 4 (263 views)
Permalink
Re: HildonAnimationActor and transparency [In reply to]

Vlad, you are great :)

Your solution works like a charm. Thank you very much!!!

I think you could also have a solution for my second problem, but I'll
create a new thread for that.

Thanks again!
Conny


On Fri, 2009-10-23 at 10:40 +0300, Vlad Vasiliev wrote:
> 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
> >> https://lists.maemo.org/mailman/listinfo/maemo-developers
> >>
> >>
> >
> > _______________________________________________
> > maemo-developers mailing list
> > maemo-developers [at] maemo
> > https://lists.maemo.org/mailman/listinfo/maemo-developers
> >
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers [at] maemo
> https://lists.maemo.org/mailman/listinfo/maemo-developers

_______________________________________________
maemo-developers mailing list
maemo-developers [at] maemo
https://lists.maemo.org/mailman/listinfo/maemo-developers

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.