[cairo] how to use alpha blending by cairo?
Kristian Høgsberg
krh at bitplanet.net
Thu Jun 29 13:31:42 PDT 2006
On 6/27/06, lao wb <laowenbo at gmail.com> wrote:
> Hi
> I am using GTK+ to do with my application. I have a bitmap without alpha
> channel as my background, another bitmap with alpha channel to show above
> through to see the background. At first, I tried to use gdk to do this,
> still not succeed yet, always show only the last one gdk_draw_pixbuf
> invokes in the expose handler.
To do this with cairo, you can say something like:
cr = gdk_cairo_create (widget->window);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
But I suspect the problem is you're loading an xpm file to a drawable
and converting that to a pixbuf. Consider storing the overlay image
as a PNG file and load it using gdk_pixbuf_new_from_file().
cheers,
Kristian
More information about the cairo
mailing list