home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / windows / x / 15680 < prev    next >
Encoding:
Text File  |  1992-08-26  |  2.2 KB  |  60 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!noc.near.net!gateway!miki!oj
  3. From: oj@miki.pictel.com (Oliver Jones)
  4. Subject: Re: Displaying polygonal boundaries with interior holes
  5. Message-ID: <1992Aug26.173610.2645@miki.pictel.com>
  6. Organization: PictureTel Corporation
  7. References: <9208252222.AA15019@sunshine.rdyne.rockwell.com>
  8. Date: Wed, 26 Aug 1992 17:36:10 GMT
  9. Lines: 49
  10.  
  11. In article <9208252222.AA15019@sunshine.rdyne.rockwell.com> yqd515@sunshine.rdyne.rockwell.COM (ALLWARDT) writes:
  12.  
  13. >I have a program which displays colored polygonal regions.  Some of the
  14. >regions specified may be "complex" in the sense that they have interior
  15. >holes.
  16.  
  17. >I'd like to have the same functionality running under X.  I guess what I'm
  18. >looking for is an  "XFillPolygons" routine (note the plural)....
  19.  
  20. According to the way XFillPolygon does its containment tests, you can
  21. combine your multiple disjoint polygons into a single polygon boundary
  22. stored in a single XPoint array.
  23.  
  24. For example, suppose your "outer" polygon connects points A,B,C,D,E,A
  25. One "inner" polygon connects points G,H,K,L,M,G
  26. Another "inner" polygon connects points  P,Q,R,S,T,P
  27.  
  28. If you make up a single XPoint struct with the following sequence,
  29. XFillPolygon will draw what you want:
  30.  
  31.   A,B,C,D,E,A, G,H,K,L,M,G,A  P,Q,R,S,T,P,A
  32.  
  33. Notice that every "inner" polygon begins with a boundary-edge
  34. from point A to the inner polygon's first point, and ends with
  35. a boundary-edge back from its first point to A.
  36.  
  37. For example, the first inner polygon ( G,H,K,L,M,G) is drawn as
  38. A,G,H,K,L,M,G,A.  The lines AG and GA are coincident, so no pixels
  39. under them are lit, and it doesn't matter whether they cross any
  40. other edges.
  41.  
  42. Make sure you tell XFillPolygon that this is a Complex polygon!
  43.  
  44. This method is probably a good stress-test for X server rendering code.
  45.  
  46. > or a way to perform this using regions
  47.  
  48. You can do this too.  Use XPolygonRegion to rasterize each polygon
  49. separately, then use the subtraction or xor operators to combine the
  50. regions appropriately.
  51.  
  52. There are a couple of problems with this.  One) a Region structure is
  53. typically less compact than the XPoint array, so it will take more
  54. network bandwidth to send it to the server.  Two) you'll have to cook
  55. up an XDrawRegion function, because Xlib has none (R6?).
  56.  
  57. Ollie Jones
  58.  
  59.  
  60.