[comp.windows.x] How to make XClearRegion?

drk@igor.Rational.COM (David R. Kaelbling) (02/03/89)

I want to use XClearRegion.  Since it doesn't exist, I'm soliciting
suggestions on a good way to implement it myself on top of X.  

There is no way I can see to accurately query the contents of a Region
(i.e., I can't find anything which decomposes a Region into Rects
again), so I abandoned the simple "iterate over the contents and call
XClearArea" approach.

I'm looking at to creating a special GC for use with XSetRegion, but
it isn't immediately obvious to me where to get all of information
necessary (where do I get the window backgroud pixel/pixmap)?

This doesn't seem like too unusal a thing to want, so I'm assuming I
just missed the relevant section of TFM.  Can anyone give me a clue?

	Thanks,
	David

David Kaelbling                                       (408) 496-3600
c/o Rational; 3320 Scott Boulevard; Santa Clara, CA       95054-3197
drk@Rational.COM, drk@igor.uu.net, ...!{uunet,ubvax,amdcad}!igor!drk

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (02/03/89)

    This doesn't seem like too unusal a thing to want, so I'm assuming I
    just missed the relevant section of TFM.  Can anyone give me a clue?

I don't think you've missed anything.  Seems like a plausible thing to
do, but there's no convenient way to do it.  The main bug is that Xlib
ought to (but doesn't) provide an interface for extracting an "external
representation" of a region, e.g. a list of rectangles.

jonnyg@ROVER.UMD.EDU (Jon Greenblatt) (02/04/89)

	Try setting the clip region for a graphics context to the region you
want to clear then fill the entire window with the background pixel/pixmap
as defined in the window attributes using this graphics context.  This is
not straight forward but it works, and once done can be use in any program.
I do something similar to this when I collect expose events durring
graphic animations. I would post the code but it does not do exactly
what you want.

						JonnyG.