On Wed, 4 Oct 2000, Martin Grimme wrote:
> Hello,
> again I've got a weird question:
>
> When I draw pixmaps onto a GdkDrawable using draw_pixmap(),
> transparency will be completely ignored. Is there any way around
> this? I want to draw pixmaps _with_ transparency onto a GdkPixmap.
>
> It seems to be possible for GdkPixmaps to have transparent areas.
> Consider the following piece of code:
>
> from gtk import *
> import _gtk
>
> win = GtkWindow()
> win.show()
> pix = win.get_window()
> root = _gtk.gdk_get_root_win() # _root_window() doesn't work...
> gc = root.new_gc()
> draw_pixmap(root, gc, pix, 0, 0, 0, 0, 200, 200)
>
> This puts the background of the window into the root window.
> But if there are parts of the window covered or otherwise out of view,
> those parts are not copied to the root window, thus I assume there
> is transparency possible for GdkPixmaps (the covered parts seem
> to be transparent).
Pixmaps do not have an alpha channel, so by default, they won't be drawn
shaped. When you load a pixmap in pygtk, you may have noticed that you
get both a pixmap and the corresponding mask. If you are not using the
mask when doing your drawing, then you are doing something wrong :)
To use the mask returned when creating the pixmap, you need to assign it
to the clip_mask attribute of the GC before drawing. Also, you will need
to set clip_x_origin and clip_y_origin attributes if you aren't going to
draw the pixmap at (0,0). Now anything you draw with that GC will be
clipped to the mask.
>
> Please help, if you can!
> Thank you.
>
> Martin Grimme - http://www.pycage.de
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
___
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk