Re: XForms: pixmap masks

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 28 Oct 97 08:02:36 PST

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> The manual mentions using a mask to make a pixmap transparent, but not
> how to do it. I apologize if this is a stupid question. I've RTFed two
> different Xlib programming M's which were no help. So how do I make a
> pixmap transparent? My pixmaps were drawn with a background color the
> same as the area on which they'll be displayed. Do I have to create the
> mask myself? ...

Yes. The easiest way is to use XPM. Set the color of your background
to `None' (I just edit the XPM file). When you load the XPM file
either using fl_create_from_pixmap_data(), fl_read_pixmap_file(), or
some other XForms glue routine or use the XPM functions directly, you
will be handed a shape_mask which can be manipulated as you wish.
Refer to the XPM documentation provided with the XPM distribution.
Check you favorite X distribution site (under contrib, I believe) to
find it if you don't already have it.

Otherwise, it is a Pixmap of depth 1. Bits set to 0 turn off the
image and bits set to 1 turn it on. You can use the standard X XImage
and Pixmap functions to create it.

> ... Once I have the mask, do I just call it with the
> fl_set_pixmap_pixmap to make the pixmap transparent?

Yes.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/