GraphicsPathIterator

System.Drawing.Drawing2D.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

GraphicsPathIterator(path)

Initializes a new instance of the GraphicsPathIterator class.

Name
Type
Description

path

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

Properties

Count

Int32: Gets the number of points in the path.

SubpathCount

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

Methods

CopyData(points, types, startIndex, endIndex)

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

Parameter
Type
Description

points

Upon return, contains an array of PointF structures that represents the points in the path.

types

Upon return, contains an array of bytes that represents the types of points in the path.

startIndex

Specifies the starting index of the arrays.

endIndex

Specifies the ending index of the arrays.

Returns: Int32. The number of points copied.

Dispose()

Enumerate(points, types)

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

Parameter
Type
Description

points

Upon return, contains an array of PointF structures that represents the points in the path.

types

Upon return, contains an array of bytes that represents the types of points in the path.

Returns: Int32. The number of points copied.

Finalize()

Finalizes an instance of the GraphicsPathIterator class.

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.

NextMarker(path)

Moves the iterator to the next marker in the path.

Parameter
Type
Description

path

The GraphicsPath object to which the points will be copied.

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

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.

Parameter
Type
Description

startIndex

The integer reference supplied to this parameter receives the index of the point that starts a subpath.

endIndex

The 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.

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.

Parameter
Type
Description

pathType

Receives the point type shared by all points in the group. Possible types can be retrieved from the PathPointType enumeration.

startIndex

Receives the starting index of the group of points.

endIndex

Receives 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.

NextSubpath(path, isClosed)

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

Parameter
Type
Description

path

A GraphicsPath that is to have its data points set to match the data points of the retrieved figure (subpath) for this iterator.

isClosed

Indicates 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.

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.

Parameter
Type
Description

startIndex

Receives the starting index of the next subpath.

endIndex

Receives the ending index of the next subpath.

isClosed

Indicates 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.

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.

Last updated

Was this helpful?