2 // System.Drawing.Drawing2D.GeneralPathIterator.cs
5 // Bors Kirzner <boris@mainsoft.com>
7 // Copyright (C) 2005 Mainsoft Corporation, (http://www.mainsoft.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using java.awt.geom;
\r
33 namespace System.Drawing.Drawing2D
\r
35 internal class GeneralPathIterator : PathIterator
\r
41 ExtendedGeneralPath _path;
\r
42 AffineTransform _affine;
\r
44 private static readonly int [] curvesize = {2, 2, 4, 6, 0};
\r
46 #endregion // Fileds
\r
48 #region Constructors
\r
50 public GeneralPathIterator(ExtendedGeneralPath _path) : this (_path, null)
\r
54 public GeneralPathIterator(ExtendedGeneralPath _path, AffineTransform at)
\r
60 #endregion // Constructors
\r
64 public int getWindingRule()
\r
66 return _path.getWindingRule ();
\r
69 public bool isDone()
\r
71 return (typeIdx >= _path.TypesCount);
\r
76 int type = _path.Types [typeIdx++] & ExtendedGeneralPath.SEG_MASK;
\r
77 pointIdx += curvesize [type];
\r
80 public int currentSegment(float [] coords) {
\r
81 int type = _path.Types [typeIdx] & ExtendedGeneralPath.SEG_MASK;
\r
82 int numCoords = curvesize [type];
\r
83 if (numCoords > 0 && _affine != null)
\r
84 _affine.transform (_path.Coords, pointIdx, coords, 0, numCoords/2);
\r
86 Array.Copy (_path.Coords, pointIdx, coords, 0, numCoords);
\r
90 public int currentSegment(double [] coords)
\r
92 int type = _path.Types [typeIdx] & ExtendedGeneralPath.SEG_MASK;
\r
93 int numCoords = curvesize [type];
\r
94 if (numCoords > 0 && _affine != null)
\r
95 _affine.transform (_path.Coords, pointIdx, coords, 0, numCoords/2);
\r
97 for (int i=0; i < numCoords; i++)
\r
98 coords [i] = _path.Coords [pointIdx + i];
\r
103 #endregion // Methods
\r