Gets tricky for multiline patterns though. Better off applying the pattern to each pixel of the fill based on the pattern array using fill(x,y) = pattern((x mod m), (y mod n)). Works nicely for any size pattern then.
Gavin. -----Original Message----- From: Michael Glickman [mailto:[EMAIL PROTECTED]] Sent: Monday, 14 January 2002 3:07 PM To: Palm Developer Forum Subject: RE: Fill Patterns -----Original Message----- From: Gavin Maxwell [mailto:[EMAIL PROTECTED]] Sent: Monday, 14 January 2002 2:34 PM To: Palm Developer Forum Subject: RE: Fill Patterns > I just searched for "fill patterns polygon" at google and found a bunch of > interesting stuff... include discussions on filling non-convex polygons with > patterns... easy! :-) Well, you proabaly are luckier than me. What I found was just loose code fragments written even it a less professional way than my humble code. But I found is the name for what I did: "Scan Line Algorithm". If you want to cater for non-convex polynoms, you consider several pairs of segments sides and try to find their intersections - quite a big payment for non-convexity. In case of a convex polynom you always have a single xleft+xright pair for a scan line. You use alreay mentioned mid-point algorithm or something similar to update xleft and xright as you go along from top to bottom. If you want to use fill patterns, you can't simply draw a horizontal line (what I did). Instead you can copy an appropriate scan line (or its part on edges) from the pattern bitmap. M. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
