Hello,
I have an Area that I want to break down into discrete paths, for example, if I have an Area that looks like a doughnut, I want to extract two discrete paths from it. I do this by getting the PathIterator from the Area as follows:
PathIterator pi = myArea.getPathIterator(new AffineTransform(), 1.0);
Then I look at the segment type, e.g. SEG_LINETO, on each iteration to determine whether I should add the current point to my current path or start a new path.
When I iterate over the path iterator, I find many DUPLICATE CONSECUTIVE POINTS.
So if I build up a GeneralPath from the points given to me by the PathIterator as follows:
if(segmentType == PathIterator.SEG_LINETO) { myGenPath.lineTo((float)coords[0], (float)coords[1]); }
I wind up with a GeneralPath that looks fine when drawn on screen, however, examination shows that it can have many DUPLICATE CONSECUTIVE POINTS.
Is there some way to get a PathIterator from an Area that will not have duplicate consecutive points?
Thank you,
Ted Hill
|
- Re: [JAVA2D] Area.getPathIterator() question Ted Hill
- Re: [JAVA2D] Area.getPathIterator() question Knight, Jon
- Re: [JAVA2D] Area.getPathIterator() question Jim Graham