This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / class / System.Drawing / System.Drawing.Drawing2D / GraphicsPathIterator.cs
1 //\r
2 // System.Drawing.Drawing2D.GraphicsPathIterator.cs\r
3 //\r
4 // Author:\r
5 //   Dennis Hayes (dennish@Raytek.com)\r
6 //   Duncan Mak (duncan@ximian.com)\r
7 //\r
8 // (C) 2002/3 Ximian, Inc\r
9 //\r
10
11 //
12 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
21 // 
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
24 // 
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 //
33 using System;\r
34 using System.Drawing;\r
35 \r
36 namespace System.Drawing.Drawing2D\r
37 {\r
38         public sealed class GraphicsPathIterator : MarshalByRefObject, IDisposable\r
39         {\r
40                 PointF [] _points;\r
41                 byte [] _types;\r
42                 int _count;\r
43                 int _current;\r
44                 \r
45                 // Constructors\r
46                 public GraphicsPathIterator (GraphicsPath path)\r
47                 {\r
48                         this._points = path.PathPoints;\r
49                         this._types = path.PathTypes;\r
50                         this._count = path.PointCount;\r
51                         this._current = 0;\r
52                 }\r
53 \r
54                 // Public Properites\r
55                 public int Count {\r
56                         get {\r
57                                 return _count;\r
58                         }\r
59                 }\r
60 \r
61                 public int SubpathCount {\r
62                         get {\r
63                                 int count = 0;\r
64 \r
65                                 foreach (byte b in _types)\r
66                                         if (b == (byte) PathPointType.Start)\r
67                                                 count++;\r
68                                 \r
69                                 return count;\r
70                         }\r
71                 }\r
72 \r
73                 // Public Methods.\r
74                 public int CopyData (ref PointF [] points, ref byte [] types, int startIndex, int endIndex)\r
75                 {\r
76                         for (int i = 0, j = startIndex; j < endIndex; i++, j++) {\r
77                                 points [i] = _points [j];\r
78                                 types [i] = _types [j];\r
79                         }\r
80 \r
81                         return endIndex - startIndex;\r
82                 }\r
83 \r
84                 public void Dispose ()\r
85                 {\r
86                 }\r
87 \r
88                 ~GraphicsPathIterator ()\r
89                 {\r
90                 }\r
91                 \r
92                 public int Enumerate (ref PointF [] points, ref byte [] types)\r
93                 {\r
94                         points = _points;\r
95                         types = _types;\r
96 \r
97                         return _count;\r
98                 }\r
99 \r
100                 public bool HasCurve ()\r
101                 {\r
102                         foreach (byte b in _types)\r
103                                 if (b == (byte) PathPointType.Bezier)\r
104                                         return true;\r
105 \r
106                         return false;\r
107                 }\r
108 \r
109                 [MonoTODO]\r
110                 public int NextMarker (GraphicsPath path)\r
111                 {\r
112                         throw new NotImplementedException ();\r
113                 }\r
114 \r
115                 [MonoTODO]\r
116                 public int NextMarker (out int startIndex, out int endIndex)\r
117                 {\r
118                         throw new NotImplementedException ();\r
119                 }\r
120 \r
121                 [MonoTODO]\r
122                 public int NextPathType (out byte pathType, out int startIndex, out int endIndex)\r
123                 {\r
124                         throw new NotImplementedException ();\r
125                 }\r
126 \r
127                 [MonoTODO]\r
128                 public int NextSubpath (GraphicsPath path, out bool isClosed)\r
129                 {\r
130                         throw new NotImplementedException ();\r
131                 }\r
132 \r
133                 [MonoTODO]\r
134                 public int NextSubpath (out int startIndex, out int endIndex, out bool isClosed)\r
135                 {\r
136                         throw new NotImplementedException ();\r
137                 }\r
138 \r
139                 public void Rewind ()\r
140                 {\r
141                         _current = 0;\r
142                 }\r
143         }\r
144 }\r