Thanks a lot, Kristian, you are right! gdk_pixbuf_new_from_file helps to keep the alpha channel from being ruined.<br>however my job not accomplished yet, now I can use gdk_pixbuf_composite do an overall alpha blending either by cairo_paint or gdk_draw_pixbuf . But precisely what I need is to make alpha blending pixel by pixel, is there any api like gdk_pixbuf_composite without an overall_alpha parameter? Can cairo help to render an rgba pixbuf as my wish?
<br><br><br>Laowb<br><br><br><div><span class="gmail_quote">2006/6/30, Kristian Høgsberg <<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 6/27/06, lao wb <<a href="mailto:laowenbo@gmail.com">laowenbo@gmail.com</a>> wrote:<br>> Hi<br>> I am using GTK+ to do with my application. I have a bitmap without alpha<br>> channel as my background, another bitmap with alpha channel to show above
<br>> through to see the background. At first, I tried to use gdk to do this,<br>> still not succeed yet, always show only the last one gdk_draw_pixbuf<br>> invokes in the expose handler.<br><br>To do this with cairo, you can say something like:
<br><br> cr = gdk_cairo_create (widget->window);<br> gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);<br> cairo_paint (cr);<br> cairo_destroy (cr);<br><br>But I suspect the problem is you're loading an xpm file to a drawable
<br>and converting that to a pixbuf. Consider storing the overlay image<br>as a PNG file and load it using gdk_pixbuf_new_from_file().<br><br>cheers,<br>Kristian<br></blockquote></div><br>