[comp.windows.x] Questions about ORing Clip Rectangles into a GC and setting DashList

rwhitby@lennon.austek.oz (Rod Whitby) (05/02/90)

be drawn with.

I have an exposure handler that accumulates the Expose rectangles and
marks the objects which are in the Exposed region.  When the Exposure
count reaches zero, the handler then redraws the marked objects,
setting the clip mask of each using XSetClipRectangles to be the
Exposed region.


I only allow objects to set their GC values using XCreateGC and an
XGCValues structure, and I keep a copy of the XGCValues used, so I
have knowledge of what values are in the object's GC (including the
Clip Mask).

My first question is:
> 	 Is there any way to set the GCDashList without using the
> XSetDashes convenience function ?  XSetDashes takes a dash list (char
> dash_list[]) and the length of the list, but the XGCValues structure
> only defines a single dash character (char dashes).


A problem with my exposure handler's strategy arises when one of the
objects already has a clip mask in it's GC.  If I just use
XSetClipRectangles to set the Clip Mask, then the object's existing
Clip Mask will be overwritten.  If the object sets its clip mask
using the XGCValues structure, then I have knowledge of the Pixmap it
used.

My second question is:
> 	Is there a way to OR a set of XRectangles (i.e the
> arguments to XSetClipRectangles) into a Pixmap (the value already
> stored in the object's GC)?  I want the clipped region to be the
> intersection of the existing Clip Mask and the Exposed region.

My thanks in advance for any answers to these questions.  Any comments
on my exposure handler's strategy are also welcome.

Rod Whitby
Austek Microsystems Pty. Ltd.
Technology Park 
Adelaide, SA 5095 Australia

ACSnet:	rwhitby@austek.oz	ARPA:	rwhitby@austek.oz.au
UUCP:	uunet.uu.net!munnari!austek.oz.au!rwhitby

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (05/02/90)

    Is there any way to set the GCDashList without using the
    XSetDashes convenience function ?

Not for a list of length greater than one (i.e., it isn't really a
convenience function).

    XSetDashes takes a dash list (char
    dash_list[]) and the length of the list, but the XGCValues structure
    only defines a single dash character (char dashes).

If you want to keep a copy of the GC state, including full dash and clip
state, you'll have to keep more information than just the XGCValues structure.

    Is there a way to OR a set of XRectangles (i.e the
    arguments to XSetClipRectangles) into a Pixmap (the value already
    stored in the object's GC)?  I want the clipped region to be the
    intersection of the existing Clip Mask and the Exposed region.

OR is like union, AND is like intersection.  Either way, you can't do it
directly if the clip state is really a Pixmap.  I'm afraid you'd have
to create a new bitmap, and then or/and the two regions together using
graphics operations into the bitmap.