Re: [gtk-list] Transparent pixmaps...



>  What I'd like to know is how do I create a transparent offscreen
>  pixmap. Loading pixmaps from files or data with transparency works
>  fine, but I'd like to create an offscreen pixmap (using
>  gdk_pixmap_new), draw into it (works fine to), and later overlay it
>  upon another pixmap (possibly using gdk_draw_pixmap). This doesn't
>  work for me, unfortunatly. The underlying pixmap is totally obscured
>  by the pixmap I'd like to put upon it.
>  
>  I also tried using a clip mask with little success.

You have to use the clip mask.  Let's say you have the pixmap in
my_pixmap, and the mask in my_mask.  You could use something like this:

void
paint_pixmap_and_mask (GdkDrawable *dest, GdkGC *gc, int x, int y, GdkPixmap *pixmap, GdkBitmap *mask)
{
	gint w, h;

	gdk_gc_set_clip_mask (gc, mask);
	gdk_gc_set_clip_origin (gc, x, y);

	gdk_window_get_size (pixmap, &w, &h);
	gdk_draw_pixmap (drawable, gc, pixmap, 0, 0, x, y, w, h);

	gdk_gc_set_clip_mask (gc, NULL);
}

  Federico



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]