home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!noc.near.net!gateway!miki!oj
- From: oj@miki.pictel.com (Oliver Jones)
- Subject: Re: Displaying polygonal boundaries with interior holes
- Message-ID: <1992Aug26.173610.2645@miki.pictel.com>
- Organization: PictureTel Corporation
- References: <9208252222.AA15019@sunshine.rdyne.rockwell.com>
- Date: Wed, 26 Aug 1992 17:36:10 GMT
- Lines: 49
-
- In article <9208252222.AA15019@sunshine.rdyne.rockwell.com> yqd515@sunshine.rdyne.rockwell.COM (ALLWARDT) writes:
-
- >I have a program which displays colored polygonal regions. Some of the
- >regions specified may be "complex" in the sense that they have interior
- >holes.
-
- >I'd like to have the same functionality running under X. I guess what I'm
- >looking for is an "XFillPolygons" routine (note the plural)....
-
- According to the way XFillPolygon does its containment tests, you can
- combine your multiple disjoint polygons into a single polygon boundary
- stored in a single XPoint array.
-
- For example, suppose your "outer" polygon connects points A,B,C,D,E,A
- One "inner" polygon connects points G,H,K,L,M,G
- Another "inner" polygon connects points P,Q,R,S,T,P
-
- If you make up a single XPoint struct with the following sequence,
- XFillPolygon will draw what you want:
-
- A,B,C,D,E,A, G,H,K,L,M,G,A P,Q,R,S,T,P,A
-
- Notice that every "inner" polygon begins with a boundary-edge
- from point A to the inner polygon's first point, and ends with
- a boundary-edge back from its first point to A.
-
- For example, the first inner polygon ( G,H,K,L,M,G) is drawn as
- A,G,H,K,L,M,G,A. The lines AG and GA are coincident, so no pixels
- under them are lit, and it doesn't matter whether they cross any
- other edges.
-
- Make sure you tell XFillPolygon that this is a Complex polygon!
-
- This method is probably a good stress-test for X server rendering code.
-
- > or a way to perform this using regions
-
- You can do this too. Use XPolygonRegion to rasterize each polygon
- separately, then use the subtraction or xor operators to combine the
- regions appropriately.
-
- There are a couple of problems with this. One) a Region structure is
- typically less compact than the XPoint array, so it will take more
- network bandwidth to send it to the server. Two) you'll have to cook
- up an XDrawRegion function, because Xlib has none (R6?).
-
- Ollie Jones
-
-
-