[9143] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: Transparent pixmaps...
daemon@ATHENA.MIT.EDU (Federico Mena Quintero)
Fri Oct 9 21:30:27 1998
Date: Fri, 9 Oct 1998 21:30:35 -0400
From: Federico Mena Quintero <federico@nuclecu.unam.mx>
To: gtk-list@redhat.com
In-reply-to: <13854.43196.956749.517997@afroblue.zedat.fu-berlin.de> (message
from Stephan Krings on Sat, 10 Oct 1998 02:30:44 +0200 (CEST))
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
> 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
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null