GraphicsPathIterator.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //
  2. // System.Drawing.Drawing2D.GraphicsPathIterator.cs
  3. //
  4. // Author:
  5. // Dennis Hayes ([email protected])
  6. // Duncan Mak ([email protected])
  7. //
  8. // (C) 2002/3 Ximian, Inc
  9. //
  10. using System;
  11. using System.Drawing;
  12. namespace System.Drawing.Drawing2D
  13. {
  14. public sealed class GraphicsPathIterator : MarshalByRefObject, IDisposable
  15. {
  16. PointF [] _points;
  17. byte [] _types;
  18. int _count;
  19. int _current;
  20. // Constructors
  21. public GraphicsPathIterator (GraphicsPath path)
  22. {
  23. this._points = path.PathPoints;
  24. this._types = path.PathTypes;
  25. this._count = path.PointCount;
  26. this._current = 0;
  27. }
  28. // Public Properites
  29. public int Count {
  30. get {
  31. return _count;
  32. }
  33. }
  34. public int SubpathCount {
  35. get {
  36. int count = 0;
  37. foreach (byte b in _types)
  38. if (b == (byte) PathPointType.Start)
  39. count++;
  40. return count;
  41. }
  42. }
  43. // Public Methods.
  44. public int CopyData (ref PointF [] points, ref byte [] types, int startIndex, int endIndex)
  45. {
  46. for (int i = 0, j = startIndex; j < endIndex; i++, j++) {
  47. points [i] = _points [j];
  48. types [i] = _types [j];
  49. }
  50. return endIndex - startIndex;
  51. }
  52. public void Dispose ()
  53. {
  54. }
  55. ~GraphicsPathIterator ()
  56. {
  57. }
  58. public int Enumerate (ref PointF [] points, ref byte [] types)
  59. {
  60. points = _points;
  61. types = _types;
  62. return _count;
  63. }
  64. public bool HasCurve ()
  65. {
  66. foreach (byte b in _types)
  67. if (b == (byte) PathPointType.Bezier)
  68. return true;
  69. return false;
  70. }
  71. [MonoTODO]
  72. public int NextMarker (GraphicsPath path)
  73. {
  74. throw new NotImplementedException ();
  75. }
  76. [MonoTODO]
  77. public int NextMarker (out int startIndex, out int endIndex)
  78. {
  79. throw new NotImplementedException ();
  80. }
  81. [MonoTODO]
  82. public int NextPathType (out byte pathType, out int startIndex, out int endIndex)
  83. {
  84. throw new NotImplementedException ();
  85. }
  86. [MonoTODO]
  87. public int NextSubpath (GraphicsPath path, out bool isClosed)
  88. {
  89. throw new NotImplementedException ();
  90. }
  91. [MonoTODO]
  92. public int NextSubpath (out int startIndex, out int endIndex, out bool isClosed)
  93. {
  94. throw new NotImplementedException ();
  95. }
  96. public void Rewind ()
  97. {
  98. _current = 0;
  99. }
  100. }
  101. }