Creating a bitmap mask from a pixmap
- From: Harry Tily <hjt882 bham ac uk>
- To: gtk-app-devel-list gnome org
- Subject: Creating a bitmap mask from a pixmap
- Date: 02 Aug 2002 10:51:51 +0100
Hi -
I'm trying to do something that I'm sure is _really_ easy, but I've been
stuck on it for a long time.
I want to draw a pixmap to the screen, but I want the white background
of the pixmap to be transparent; that is, whatever is already on the
screen should show through the white areas of my pixmap.
I can do this easily by setting a clip mask on the graphics context
provided I have a bitmap to use for the mask, such as the one returned
when loading from an XPM file. However, as my pixmap is drawn from
scratch using gdk_draw_* functions, I don't have one.
So, I'm trying to draw a suitable mask from my pixmap: I've tried just
drawing the pixmap to the bitmap - after all, I want white to be an
unset bit in the bitmap, and anything that isn't white to be a set bit.
However, gdk_draw_pixmap (along with all other gdk_draw_* functions)
crashes the program when called on the bitmap.
Is there a way to select one colour in the pixmap as the mask, and draw
only those pixels that aren't of that colour?
Please excuse me if this is a stupid question: the FAQ on the main page
seems to have been down for at least a couple of weeks, and I haven't
had any luck trawling the archives of this list.
Harry
--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]