GraphicsPathIterator.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. public int Enumerate (ref PointF [] points, ref byte [] types)
  56. {
  57. points = _points;
  58. types = _types;
  59. return _count;
  60. }
  61. public bool HasCurve ()
  62. {
  63. foreach (byte b in _types)
  64. if (b == (byte) PathPointType.Bezier)
  65. return true;
  66. return false;
  67. }
  68. [MonoTODO]
  69. public int NextMarker (GraphicsPath path)
  70. {
  71. throw new NotImplementedException ();
  72. }
  73. [MonoTODO]
  74. public int NextMarker (out int startIndex, out int endIndex)
  75. {
  76. throw new NotImplementedException ();
  77. }
  78. [MonoTODO]
  79. public int NextPathType (out byte pathType, out int startIndex, out int endIndex)
  80. {
  81. throw new NotImplementedException ();
  82. }
  83. [MonoTODO]
  84. public int NextSubpath (GraphicsPath path, out bool isClosed)
  85. {
  86. throw new NotImplementedException ();
  87. }
  88. [MonoTODO]
  89. public int NextSubpath (out int startIndex, out int endIndex, out bool isClosed)
  90. {
  91. throw new NotImplementedException ();
  92. }
  93. public void Rewind ()
  94. {
  95. _current = 0;
  96. }
  97. }
  98. }