Skip to main content

GraphicsPathIterator

Namespace: System.Drawing.Drawing2D

Assembly: System.Drawing.Managed (4.0.0.0)

Provides the ability to iterate through subpaths in a GraphicsPath and test the types of shapes contained in each subpath. This class cannot be inherited.

public class GraphicsPathIterator : MarshalByRefObject, IDisposable

Constructors

Instance member GraphicsPathIterator(path)

Initializes a new instance of the GraphicsPathIterator class.

NameTypeDescription
pathGraphicsPathThe GraphicsPath object for which this helper class is to be initialized.

Properties

Instance member Count

Int32: Gets the number of points in the path.

Instance member SubpathCount

Int32: Gets the number of sub paths in the path.

Methods

Instance member CopyData(points, types, startIndex, endIndex)

Copies the PathPoints property and PathTypes property arrays of the associated GraphicsPath into the two specified arrays.

ParameterTypeDescription
points by referencePointF[]Upon return, contains an array of PointF structures that represents the points in the path.
types by referenceByte[]Upon return, contains an array of bytes that represents the types of points in the path.
startIndexInt32Specifies the starting index of the arrays.
endIndexInt32Specifies the ending index of the arrays.

Returns: Int32. The number of points copied.

Instance member Dispose()

Instance member Enumerate(points, types)

Copies the PathPoints property and PathTypes property arrays of the associated GraphicsPath into the two specified arrays.

ParameterTypeDescription
points by referencePointF[]Upon return, contains an array of PointF structures that represents the points in the path.
types by referenceByte[]Upon return, contains an array of bytes that represents the types of points in the path.

Returns: Int32. The number of points copied.

Protected member Finalize()

Finalizes an instance of the GraphicsPathIterator class.

Instance member HasCurve()

Indicates whether the path associated with this GraphicsPathIterator contains a curve.

Returns: Boolean. This method returns true if the current subpath contains a curve; otherwise, false.

Instance member NextMarker(path)

Moves the iterator to the next marker in the path.

ParameterTypeDescription
pathGraphicsPathThe GraphicsPath object to which the points will be copied.

Returns: Int32. The number of points between this marker and the next.

Instance member NextMarker(startIndex, endIndex)

Increments the GraphicsPathIterator to the next marker in the path and returns the start and stop indexes by way of the parameters.

ParameterTypeDescription
startIndex by referenceInt32The integer reference supplied to this parameter receives the index of the point that starts a subpath.
endIndex by referenceInt32The integer reference supplied to this parameter receives the index of the point that ends the subpath to which startIndex points.

Returns: Int32. The number of points between this marker and the next.

Instance member NextPathType(pathType, startIndex, endIndex)

Gets the starting index and the ending index of the next group of data points that all have the same type.

ParameterTypeDescription
pathType by referenceByteReceives the point type shared by all points in the group. Possible types can be retrieved from the PathPointType enumeration.
startIndex by referenceInt32Receives the starting index of the group of points.
endIndex by referenceInt32Receives the ending index of the group of points.

Returns: Int32. This method returns the number of data points in the group. If there are no more groups in the path, this method returns 0.

Instance member NextSubpath(path, isClosed)

Gets the next figure (subpath) from the associated path of this GraphicsPathIterator.

ParameterTypeDescription
pathGraphicsPathA GraphicsPath that is to have its data points set to match the data points of the retrieved figure (subpath) for this iterator.
isClosed by referenceBooleanIndicates whether the current subpath is closed. It is true if the figure is closed, otherwise it is false.

Returns: Int32. The number of data points in the retrieved figure (subpath). If there are no more figures to retrieve, zero is returned.

Instance member NextSubpath(startIndex, endIndex, isClosed)

Moves the GraphicsPathIterator to the next subpath in the path. The start index and end index of the next subpath are contained in the parameters.

ParameterTypeDescription
startIndex by referenceInt32Receives the starting index of the next subpath.
endIndex by referenceInt32Receives the ending index of the next subpath.
isClosed by referenceBooleanIndicates whether the current subpath is closed. It is true if the figure is closed, otherwise it is false.

Returns: Int32. The number of subpaths in the GraphicsPath object.

Instance member Rewind()

Rewinds this GraphicsPathIterator to the beginning of its associated path.

The first time you call the NextSubpath method of an iterator, it gets the first figure (subpath) of that iterator's associated path. The second time, it gets the second figure, and so on. When you call the Rewind method, the sequence starts over; that is, after you call Rewind, the next call to NextSubpath gets the first figure in the path. The NextMarker and NextPathType methods behave similarly.