GraphicsPath 函数

Windows GDI+ 公开一个由大约 600 个函数组成的平面 API,这些函数在 Gdiplus.dll 中实现,并在 Gdiplusflat.h 中声明。 GDI+ 平面 API 中的函数由大约 40 个 C++ 类的集合包装。 建议不要直接调用平面 API 中的函数。 每当调用 GDI+ 时,都应该通过调用 C++ 包装器提供的方法和函数来执行此操作。 Microsoft 产品支持服务不会为直接调用平面 API 的代码提供支持。 有关使用这些包装器方法的详细信息,请参阅 GDI+ 平面 API

以下平面 API 函数由 GraphicsPath C++ 类包装。

GraphicsPath 函数和相应的包装器方法

平面函数 包装器方法 备注
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fillMode, GpPath **path)
GraphicsPath::GraphicsPath(IN FillMode fillMode = FillModeAlternate) 创建 GraphicsPath 对象并初始化填充模式。 这是默认构造函数。
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) 基于点数组、类型数组和填充模式创建 GraphicsPath 对象
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) 基于点数组、类型数组和填充模式创建 GraphicsPath 对象
GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clonePath)
GraphicsPath::GraphicsPath* Clone() const 创建新的 GraphicsPath 对象,并使用此 GraphicsPath 对象的内容将其初始化
GpStatus WINGDIPAPI GdipDeletePath(GpPath* path)
GraphicsPath::~GraphicsPath()
释放 GraphicsPath 对象使用的资源
GpStatus WINGDIPAPI GdipResetPath(GpPath* path)
GraphicsPath::Reset 清空路径并将填充模式设置为 FillModeAlternate。
GpStatus WINGDIPAPI GdipGetPointCount(GpPath* path, INT* count)
INT GraphicsPath::GetPointCount 获取此路径的数据点数组中的点数。 这与该路径的点类型数组中的类型数相同。
GpStatus WINGDIPAPI GdipGetPathTypes(GpPath* path, BYTE* types, INT count)
Status GraphicsPath::GetPathTypes(OUT BYTE* types, IN INT count) const 获取此路径的点类型数组。
GpStatus WINGDIPAPI GdipGetPathPoints(GpPath*, GpPointF* points, INT count)
Status GraphicsPath::GetPathPoints(OUT PointF* points, IN INT count) const 获取此路径的点数组。 该数组包含用于绘制路径的线条和 Bézier 样条的端点和控制点。
GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath*, GpPoint* points, INT count)
Status GraphicsPath::GetPathPoints(OUT Point* points, IN INT count) const 获取此路径的点数组。 该数组包含用于绘制路径的线条和 Bézier 样条的端点和控制点。
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode)
FillMode GraphicsPath::GetFillMode() const 获取此路径的填充模式。
GpStatus WINGDIPAPI GdipSetPathFillMode(GpPath *path, GpFillMode fillmode)
Status GraphicsPath::SetFillMode(IN FillMode fillmode) 设置此路径的填充模式。
GpStatus WINGDIPAPI GdipGetPathData(GpPath *path, GpPathData* pathData)
Status GraphicsPath::GetPathData(OUT PathData* pathData) const 获取此路径的点数组和点类型数组。 这两个数组共同定义此路径的线条、曲线、图形和标记。
GpStatus WINGDIPAPI GdipStartPathFigure(GpPath *path)
Status GraphicsPath::StartFigure() 在不闭合当前图形的情况下开始绘制新图形。 添加到此路径的后续点将添加到新图形中。
GpStatus WINGDIPAPI GdipClosePathFigure(GpPath *path)
Status GraphicsPath::CloseFigure() 闭合此路径的当前图形。
GpStatus WINGDIPAPI GdipClosePathFigures(GpPath *path)
Status GraphicsPath::CloseAllFigures() 闭合此路径中的所有开口图形。
GpStatus WINGDIPAPI GdipSetPathMarker(GpPath* path)
Status GraphicsPath::SetMarker() 将此路径中的最后一个点指定为标记点。
GpStatus WINGDIPAPI GdipClearPathMarkers(GpPath* path)
Status GraphicsPath::ClearMarkers() 清除此路径中的标记。
GpStatus WINGDIPAPI GdipReversePath(GpPath* path)
Status GraphicsPath::Reverse() 反转点的顺序,这些点定义了此路径的线条和曲线。
GpStatus WINGDIPAPI GdipGetPathLastPoint(GpPath* path, GpPointF* lastPoint)
Status GraphicsPath::GetLastPoint(OUT PointF* lastPoint) const 获取此路径中最后一个图形的终点。
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) 将线条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddLines(IN const PointF* points, IN INT count) 将一系列相连线条添加到此路径的当前图形中。
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) 将椭圆弧线添加到此路径的当前图形中。
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) 将 Bézier 样条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddBeziers(IN const PointF* points, IN INT count) 将一系列相连 Bézier 样条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathCurve(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddCurve(IN const PointF* points, IN INT count) 将基数样条添加到此路径的当前图形中。
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) 将基数样条添加到此路径的当前图形中。
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) 将基数样条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathClosedCurve(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddClosedCurve(IN const PointF* points, IN INT count) 将一个闭合基数样条添加到此路径。
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) 将一个闭合基数样条添加到此路径。
GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height)
Status GraphicsPath::AddRectangle(IN const RectF& rect) 将一个矩形添加到此路径。
平面函数中的 x、y、width 和 height 参数指定一个矩形,该矩形对应于包装器方法中的 rect 参数
GpStatus WINGDIPAPI GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects, INT count)
Status GraphicsPath::AddRectangles(IN const RectF* rects, IN INT count) 将一系列矩形添加到此路径。
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) 将一个省略号添加到此路径。
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) 将一个饼图添加到此路径。 弧线是椭圆的一部分,饼图是椭圆封闭的区域的一部分。 饼图以弧线和两条直线为边(边缘线),这两条直线从椭圆中心延伸到弧线的两个端点。
GpStatus WINGDIPAPI GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count)
Status GraphicsPath::AddPolygon(IN const PointF* points, IN INT count) 将一个多边形添加到此路径。
GpStatus WINGDIPAPI GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath, BOOL connect)
Status GraphicsPath::AddPath(IN const GraphicsPath* addingPath, IN BOOL connect) 将一个路径添加到此路径。
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 ) 将字符串的轮廓添加到此路径。
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 ) 将字符串的轮廓添加到此路径。
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) 将线条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddLines(IN const Point* points, IN INT count) 将一系列相连线条添加到此路径的当前图形中。
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) 将椭圆弧线添加到此路径的当前图形中。
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) 将 Bézier 样条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddBeziers(IN const Point* points, IN INT count) 将 Bézier 样条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddCurve(IN const Point* points, IN INT count) 将基数样条添加到此路径的当前图形中。
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) 将基数样条添加到此路径的当前图形中。
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) 将基数样条添加到此路径的当前图形中。
GpStatus WINGDIPAPI GdipAddPathClosedCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddClosedCurve(IN const Point* points, IN INT count) 将一个闭合基数样条添加到此路径。
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) 将一个闭合基数样条添加到此路径。
GpStatus WINGDIPAPI GdipAddPathRectangleI(GpPath *path, INT x, INT y, INT width, INT height)
Status GraphicsPath::AddRectangle(IN const Rect& rect) 将一个矩形添加到此路径。
平面函数中的 x、y、width 和 height 参数指定一个矩形,该矩形对应于包装器方法中的 rect 参数
GpStatus WINGDIPAPI GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects, INT count)
Status GraphicsPath::AddRectangles(IN const Rect* rects, INT count) 将一系列矩形添加到此路径
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) 将一个省略号添加到此路径。
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) 将一个饼图添加到此路径。 弧线是椭圆的一部分,饼图是椭圆封闭的区域的一部分。 饼图以弧线和两条直线为边(边缘线),这两条直线从椭圆中心延伸到弧线的两个端点。
GpStatus WINGDIPAPI GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points, INT count)
Status GraphicsPath::AddPolygon(IN const Point* points, IN INT count) 将一个多边形添加到此路径。
GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatness)
Status GraphicsPath::Flatten(IN const Matrix* matrix = NULL, IN REAL flatness = FlatnessDefault) 将转换应用于此路径,并将路径中的每个曲线转换为相连线条的序列。
GpStatus WINGDIPAPI GdipWindingModeOutline( GpPath *path, GpMatrix *matrix, REAL flatness )
Status GraphicsPath::Outline( IN const Matrix *matrix = NULL, IN REAL flatness = FlatnessDefault ) 转换并平整此路径,然后转换此路径的数据点,以便它们仅表示路径的轮廓。
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 ) 使用曲线替代此路径,这些曲线可封闭在用指定笔绘制此路径时填充的区域。 此方法还会平整路径。
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) 将扭曲转换应用于此路径。 此方法还会平整路径(转换为一系列直线)。
平面函数中的 srcx、srcy、srcwidth 和 srcheight 参数指定一个矩形,该矩形对应于包装器方法中的 srcRect 参数
GpStatus WINGDIPAPI GdipTransformPath(GpPath* path, GpMatrix* matrix)
Status GraphicsPath::Transform(IN const Matrix* 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 获取此路径的边框。
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 获取此路径的边框。
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 确定指定点是否位于由指定的 Graphics 对象填充此路径时填充的区域
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 确定指定点是否位于由指定的 Graphics 对象填充此路径时填充的区域
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 确定指定点是否在指定的 Graphics 对象和指定的笔绘制路径时触及此路径的轮廓
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 确定指定点是否在指定的 Graphics 对象和指定的笔绘制路径时触及此路径的轮廓