GraphicsPath Functions

Windows GDI+ exposes a flat API that consists of about 600 functions, which are implemented in Gdiplus.dll and declared in Gdiplusflat.h. The functions in the GDI+ flat API are wrapped by a collection of about 40 C++ classes. It is recommended that you do not directly call the functions in the flat API. Whenever you make calls to GDI+, you should do so by calling the methods and functions provided by the C++ wrappers. Microsoft Product Support Services will not provide support for code that calls the flat API directly. For more information on using these wrapper methods, see GDI+ Flat API.

The following flat API functions are wrapped by the GraphicsPath C++ class.

GraphicsPath Functions and Corresponding Wrapper Methods

Flat function Wrapper method Remarks
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fillMode, GpPath **path)
GraphicsPath::GraphicsPath(IN FillMode fillMode = FillModeAlternate) Creates a GraphicsPath object and initializes the fill mode. This is the default constructor.
GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF* points, GDIPCONST BYTE* types, INT count, GpFillMode fillMode, GpPath **path)
GraphicsPath::GraphicsPath(IN const PointF* points, IN const BYTE* types, IN INT count, IN FillMode fillMode = FillModeAlternate) Creates a GraphicsPath object based on an array of points, an array of types, and a fill mode.
GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint* points, GDIPCONST BYTE* types, INT count, GpFillMode fillMode, GpPath **path)
GraphicsPath::GraphicsPath(IN const Point* points, IN const BYTE* types, IN INT count, IN FillMode fillMode = FillModeAlternate) Creates a GraphicsPath object based on an array of points, an array of types, and a fill mode.
GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clonePath)
GraphicsPath::GraphicsPath* Clone() const Creates a new GraphicsPath object, and initializes it with the contents of this GraphicsPath object.
GpStatus WINGDIPAPI GdipDeletePath(GpPath* path)
GraphicsPath::~GraphicsPath()
Releases resources used by the GraphicsPath object.
GpStatus WINGDIPAPI GdipResetPath(GpPath* path)
GraphicsPath::Reset Empties the path and sets the fill mode to FillModeAlternate.
GpStatus WINGDIPAPI GdipGetPointCount(GpPath* path, INT* count)
INT GraphicsPath::GetPointCount Gets the number of points in this path's array of data points. This is the same as the number of types in the path's array of point types.
GpStatus WINGDIPAPI GdipGetPathTypes(GpPath* path, BYTE* types, INT count)
Status GraphicsPath::GetPathTypes(OUT BYTE* types, IN INT count) const Gets this path's array of point types.
GpStatus WINGDIPAPI GdipGetPathPoints(GpPath*, GpPointF* points, INT count)
Status GraphicsPath::GetPathPoints(OUT PointF* points, IN INT count) const Gets this path's array of points. The array contains the endpoints and control points of the lines and Bézier splines that are used to draw the path.
GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath*, GpPoint* points, INT count)
Status GraphicsPath::GetPathPoints(OUT Point* points, IN INT count) const Gets this path's array of points. The array contains the endpoints and control points of the lines and Bézier splines that are used to draw the path.
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode)
FillMode GraphicsPath::GetFillMode() const Gets the fill mode of this path.
GpStatus WINGDIPAPI GdipSetPathFillMode(GpPath *path, GpFillMode fillmode)
Status GraphicsPath::SetFillMode(IN FillMode fillmode) Sets the fill mode of this path.
GpStatus WINGDIPAPI GdipGetPathData(GpPath *path, GpPathData* pathData)
Status GraphicsPath::GetPathData(OUT PathData* pathData) const Gets an array of points and an array of point types from this path. Together, these two arrays define the lines, curves, figures, and markers of this path.
GpStatus WINGDIPAPI GdipStartPathFigure(GpPath *path)
Status GraphicsPath::StartFigure() Starts a new figure without closing the current figure. Subsequent points added to this path are added to the new figure.
GpStatus WINGDIPAPI GdipClosePathFigure(GpPath *path)
Status GraphicsPath::CloseFigure() Closes the current figure of this path.
GpStatus WINGDIPAPI GdipClosePathFigures(GpPath *path)
Status GraphicsPath::CloseAllFigures() Closes all open figures in this path.
GpStatus WINGDIPAPI GdipSetPathMarker(GpPath* path)
Status GraphicsPath::SetMarker() Designates the last point in this path as a marker point.
GpStatus WINGDIPAPI GdipClearPathMarkers(GpPath* path)
Status GraphicsPath::ClearMarkers() Clears the markers from this path.
GpStatus WINGDIPAPI GdipReversePath(GpPath* path)
Status GraphicsPath::Reverse() Reverses the order of the points that define this path's lines and curves.
GpStatus WINGDIPAPI GdipGetPathLastPoint(GpPath* path, GpPointF* lastPoint)
Status GraphicsPath::GetLastPoint(OUT PointF* lastPoint) const Gets the ending point of the last figure in this path.
GpStatus WINGDIPAPI GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2)
Status GraphicsPath::AddLine(IN REAL x1, IN REAL y1, IN REAL x2, IN REAL y2) Adds a line to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddLines(IN const PointF* points, IN INT count) Adds a sequence of connected lines to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
Status GraphicsPath::AddArc(IN REAL x, IN REAL y, IN REAL width, IN REAL height, IN REAL startAngle, IN REAL sweepAngle) Adds an elliptical arc to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathBezier(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4)
Status GraphicsPath::AddBezier(IN REAL x1, IN REAL y1, IN REAL x2, IN REAL y2, IN REAL x3, IN REAL y3, IN REAL x4, IN REAL y4) Adds a Bézier spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddBeziers(IN const PointF* points, IN INT count) Adds a sequence of connected Bézier splines to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathCurve(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddCurve(IN const PointF* points, IN INT count) Adds a cardinal spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension)
Status GraphicsPath::AddCurve(IN const PointF* points, IN INT count, IN REAL tension) Adds a cardinal spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, INT count, INT offset, INT numberOfSegments, REAL tension)
Status GraphicsPath::AddCurve(IN const PointF* points, IN INT count, IN INT offset, IN INT numberOfSegments, IN REAL tension) Adds a cardinal spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathClosedCurve(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddClosedCurve(IN const PointF* points, IN INT count) Adds a closed cardinal spline to this path.
GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension)
Status GraphicsPath::AddClosedCurve(IN const PointF* points, IN INT count, IN REAL tension) Adds a closed cardinal spline to this path.
GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height)
Status GraphicsPath::AddRectangle(IN const RectF& rect) Adds a rectangle to this path.
The x, y, width, and height parameters in the flat function specify a rectangle that corresponds to the rect parameter in the wrapper method.
GpStatus WINGDIPAPI GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects, INT count)
Status GraphicsPath::AddRectangles(IN const RectF* rects, IN INT count) Adds a sequence of rectangles to this path.
GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, REAL height)
Status GraphicsPath::AddEllipse(IN REAL x, IN REAL y, IN REAL width, IN REAL height) Adds an ellipse to this path.
GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
Status GraphicsPath::AddPie(IN REAL x, IN REAL y, IN REAL width, IN REAL height, IN REAL startAngle, IN REAL sweepAngle) Adds a pie to this path. An arc is a portion of an ellipse, and a pie is a portion of the area enclosed by an ellipse. A pie is bounded by an arc and two lines (edges) that go from the center of the ellipse to the endpoints of the arc.
GpStatus WINGDIPAPI GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddPolygon(IN const PointF* points, IN INT count) Adds a polygon to this path.
GpStatus WINGDIPAPI GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath, BOOL connect)
Status GraphicsPath::AddPath(IN const GraphicsPath* addingPath, IN BOOL connect) Adds a path to this path.
GpStatus WINGDIPAPI GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *format)
Status GraphicsPath::AddString( IN const WCHAR *string, IN INT length, IN const FontFamily *family, IN INT style, IN REAL emSize, IN const RectF &layoutRect, IN const StringFormat *format ) Adds the outline of a string to this path.
GpStatus WINGDIPAPI GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST Rect *layoutRect, GDIPCONST GpStringFormat *format)
Status GraphicsPath::AddString( IN const WCHAR *string, IN INT length, IN const FontFamily *family, IN INT style, IN REAL emSize, IN const Rect &layoutRect, IN const StringFormat *format ) Adds the outline of a string to this path.
GpStatus WINGDIPAPI GdipAddPathLineI(GpPath *path, INT x1, INT y1, INT x2, INT y2)
Status GraphicsPath::AddLine(IN INT x1, IN INT y1, IN INT x2, IN INT y2) Adds a line to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddLines(IN const Point* points, IN INT count) Adds a sequence of connected lines to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathArcI(GpPath *path, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
Status GraphicsPath::AddArc(IN INT x, IN INT y, IN INT width, IN INT height, IN REAL startAngle, IN REAL sweepAngle) Adds an elliptical arc to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2, INT y2, INT x3, INT y3, INT x4, INT y4)
Status GraphicsPath::AddBezier(IN INT x1, IN INT y1, IN INT x2, IN INT y2, IN INT x3, IN INT y3, IN INT x4, IN INT y4) Adds a Bézier spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddBeziers(IN const Point* points, IN INT count) Adds a Bézier spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddCurve(IN const Point* points, IN INT count) Adds a cardinal spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, REAL tension)
Status GraphicsPath::AddCurve(IN const Point* points, IN INT count, IN REAL tension) Adds a cardinal spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points, INT count, INT offset, INT numberOfSegments, REAL tension)
Status GraphicsPath::AddCurve(IN const Point* points, IN INT count, IN INT offset, IN INT numberOfSegments, IN REAL tension) Adds a cardinal spline to the current figure of this path.
GpStatus WINGDIPAPI GdipAddPathClosedCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddClosedCurve(IN const Point* points, IN INT count) Adds a closed cardinal spline to this path.
GpStatus WINGDIPAPI GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, REAL tension)
Status GraphicsPath::AddClosedCurve(IN const Point* points, IN INT count, IN REAL tension) Adds a closed cardinal spline to this path.
GpStatus WINGDIPAPI GdipAddPathRectangleI(GpPath *path, INT x, INT y, INT width, INT height)
Status GraphicsPath::AddRectangle(IN const Rect& rect) Adds a rectangle to this path.
The x, y, width, and height parameters in the flat function specify a rectangle that corresponds to the rect parameter in the wrapper method.
GpStatus WINGDIPAPI GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects, INT count)
Status GraphicsPath::AddRectangles(IN const Rect* rects, INT count) Adds a sequence of rectangles to this path
GpStatus WINGDIPAPI GdipAddPathEllipseI(GpPath *path, INT x, INT y, INT width, INT height)
Status GraphicsPath::AddEllipse(IN INT x, IN INT y, IN INT width, IN INT height) Adds an ellipse to this path.
GpStatus WINGDIPAPI GdipAddPathPieI(GpPath *path, INT x, INT y, INT width, INT height, REAL startAngle, REAL sweepAngle)
Status GraphicsPath::AddPie(IN INT x, IN INT y, IN INT width, IN INT height, IN REAL startAngle, IN REAL sweepAngle) Adds a pie to this path. An arc is a portion of an ellipse, and a pie is a portion of the area enclosed by an ellipse. A pie is bounded by an arc and two lines (edges) that go from the center of the ellipse to the endpoints of the arc.
GpStatus WINGDIPAPI GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddPolygon(IN const Point* points, IN INT count) Adds a polygon to this path.
GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatness)
Status GraphicsPath::Flatten(IN const Matrix* matrix = NULL, IN REAL flatness = FlatnessDefault) Applies a transformation to this path and converts each curve in the path to a sequence of connected lines.
GpStatus WINGDIPAPI GdipWindingModeOutline( GpPath *path, GpMatrix *matrix, REAL flatness )
Status GraphicsPath::Outline( IN const Matrix *matrix = NULL, IN REAL flatness = FlatnessDefault ) Transforms and flattens this path, and then converts this path's data points so that they represent only the outline of the path.
GpStatus WINGDIPAPI GdipWidenPath( GpPath *nativePath, GpPen *pen, GpMatrix *matrix, REAL flatness )
Status GraphicsPath::Widen( IN const Pen* pen, IN const Matrix* matrix = NULL, IN REAL flatness = FlatnessDefault ) Replaces this path with curves that enclose the area that is filled when this path is drawn by a specified pen. This method also flattens the path.
GpStatus WINGDIPAPI GdipWarpPath(GpPath *path, GpMatrix* matrix, GDIPCONST GpPointF *points, INT count, REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, WarpMode warpMode, REAL flatness)
Status GraphicsPath::Warp(IN const PointF* destPoints, IN INT count, IN const RectF& srcRect, IN const Matrix* matrix = NULL, IN WarpMode warpMode = WarpModePerspective, IN REAL flatness = FlatnessDefault) Applies a warp transformation to this path. This method also flattens (converts to a sequence of straight lines) the path.
The srcx, srcy, srcwidth, and srcheight parameters in the flat function specify a rectangle that corresponds to the srcRect parameter in the wrapper method.
GpStatus WINGDIPAPI GdipTransformPath(GpPath* path, GpMatrix* matrix)
Status GraphicsPath::Transform(IN const Matrix* matrix) Multiplies each of this path's data points by a specified matrix.
GpStatus WINGDIPAPI GdipGetPathWorldBounds(GpPath* path, GpRectF* bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen)
Status GraphicsPath::GetBounds(OUT RectF* bounds, IN const Matrix* matrix, IN const Pen* pen) const Gets a bounding rectangle for this path.
GpStatus WINGDIPAPI GdipGetPathWorldBoundsI(GpPath* path, GpRect* bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen)
Status GraphicsPath::GetBounds(OUT Rect* bounds, IN const Matrix* matrix, IN const Pen* pen) const Gets a bounding rectangle for this path.
GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, GpGraphics *graphics, BOOL *result)
BOOL GraphicsPath::IsVisible(IN REAL x, IN REAL y, IN const Graphics* g) const Determines whether a specified point lies in the area that is filled when this path is filled by a specified Graphics object.
GpStatus WINGDIPAPI GdipIsVisiblePathPointI(GpPath* path, INT x, INT y, GpGraphics *graphics, BOOL *result)
BOOL GraphicsPath::IsVisible(IN INT x, IN INT y, IN const Graphics* g) const Determines whether a specified point lies in the area that is filled when this path is filled by a specified Graphics object.
GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPoint(GpPath* path, REAL x, REAL y, GpPen *pen, GpGraphics *graphics, BOOL *result)
BOOL GraphicsPath::IsOutlineVisible(IN REAL x, IN REAL y, IN const Pen* pen, IN const Graphics* g) const Determines whether a specified point touches the outline of this path when the path is drawn by a specified Graphics object and a specified pen.
GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPointI(GpPath* path, INT x, INT y, GpPen *pen, GpGraphics *graphics, BOOL *result)
BOOL GraphicsPath::IsOutlineVisible(IN INT x, IN INT y, IN const Pen* pen, IN const Graphics* g) const Determines whether a specified point touches the outline of this path when the path is drawn by a specified Graphics object and a specified pen.