• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# drawing_path.h
2
3## 概述
4
5文件中定义了与自定义路径相关的功能函数。
6
7<!--RP1-->
8**相关示例:** [NDKAPIDrawing (API14)](https://gitcode.com/openharmony/applications_app_samples/tree/master/code/DocsSample/Drawing/NDKAPIDrawing)<!--RP1End-->
9
10**引用文件:** <native_drawing/drawing_path.h>
11
12**库:** libnative_drawing.so
13
14**起始版本:** 8
15
16**相关模块:** [Drawing](capi-drawing.md)
17
18## 汇总
19
20### 枚举
21
22| 名称 | typedef关键字 | 描述 |
23| -- | -- | -- |
24| [OH_Drawing_PathDirection](#oh_drawing_pathdirection) | OH_Drawing_PathDirection | 添加闭合轮廓方向枚举。 |
25| [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) | OH_Drawing_PathFillType | 定义路径的填充类型枚举。 |
26| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) | OH_Drawing_PathAddMode | 用于指定路径添加模式的枚举类型。 |
27| [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) | OH_Drawing_PathOpMode | 路径操作类型枚举。 |
28| [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) | OH_Drawing_PathMeasureMatrixFlags | 路径测量获取相应矩阵信息维度枚举。 |
29
30### 函数
31
32| 名称 | 描述 |
33| -- | -- |
34| [OH_Drawing_Path* OH_Drawing_PathCreate(void)](#oh_drawing_pathcreate) | 用于创建一个路径对象。 |
35| [OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path* path)](#oh_drawing_pathcopy) | 创建一个路径对象副本[OH_Drawing_Path](capi-drawing-oh-drawing-path.md),用于拷贝一个已有路径对象。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
36| [void OH_Drawing_PathDestroy(OH_Drawing_Path* path)](#oh_drawing_pathdestroy) | 用于销毁路径对象并回收该对象占有的内存。 |
37| [OH_Drawing_ErrorCode OH_Drawing_PathSetPath(OH_Drawing_Path* path, OH_Drawing_Path* other)](#oh_drawing_pathsetpath) | 将一个路径对象设置成当前的路径对象。 |
38| [OH_Drawing_ErrorCode OH_Drawing_PathIsEmpty(OH_Drawing_Path* path, bool* isEmpty)](#oh_drawing_pathisempty) | 判断一个路径对象是否为空。 |
39| [OH_Drawing_ErrorCode OH_Drawing_PathIsRect(OH_Drawing_Path* path, OH_Drawing_Rect* rect, bool* isRect)](#oh_drawing_pathisrect) | 判断路径对象是否构成一个矩形。 |
40| [void OH_Drawing_PathMoveTo(OH_Drawing_Path* path, float x, float y)](#oh_drawing_pathmoveto) | 用于设置自定义路径的起始点位置。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
41| [void OH_Drawing_PathLineTo(OH_Drawing_Path* path, float x, float y)](#oh_drawing_pathlineto) | 用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
42| [void OH_Drawing_PathArcTo(OH_Drawing_Path* path,float x1, float y1, float x2, float y2, float startDeg, float sweepDeg)](#oh_drawing_patharcto) | 用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,<br>矩形边框的内切椭圆将会被用来截取弧线,然后会指定一个起始角度和扫描度数,<br>从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。若路径有内容则会默认添加一条从路径的最后点位置到弧线起始点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
43| [void OH_Drawing_PathQuadTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY)](#oh_drawing_pathquadto) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
44| [void OH_Drawing_PathConicTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY, float weight)](#oh_drawing_pathconicto) | 在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线段,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
45| [void OH_Drawing_PathCubicTo(OH_Drawing_Path* path, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY)](#oh_drawing_pathcubicto) | 用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
46| [void OH_Drawing_PathRMoveTo(OH_Drawing_Path* path, float x, float y)](#oh_drawing_pathrmoveto) | 用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
47| [void OH_Drawing_PathRLineTo(OH_Drawing_Path* path, float x, float y)](#oh_drawing_pathrlineto) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
48| [void OH_Drawing_PathRQuadTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY)](#oh_drawing_pathrquadto) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
49| [void OH_Drawing_PathRConicTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY, float weight)](#oh_drawing_pathrconicto) | 使用相对位置在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
50| [void OH_Drawing_PathRCubicTo(OH_Drawing_Path* path, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2,float endX, float endY)](#oh_drawing_pathrcubicto) | 使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
51| [void OH_Drawing_PathAddRect(OH_Drawing_Path* path, float left, float top, float right, float bottom,OH_Drawing_PathDirection pathDirection)](#oh_drawing_pathaddrect) | 按指定方向,将矩形添加到路径中,添加的路径的起始点为矩形左上角。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
52| [void OH_Drawing_PathAddRectWithInitialCorner(OH_Drawing_Path* path, const OH_Drawing_Rect* rect,OH_Drawing_PathDirection pathDirection, uint32_t start)](#oh_drawing_pathaddrectwithinitialcorner) | 按指定方向,向路径添加矩形轮廓。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
53| [void OH_Drawing_PathAddRoundRect(OH_Drawing_Path* path,const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection pathDirection)](#oh_drawing_pathaddroundrect) | 按指定方向,向路径添加圆角矩形轮廓。路径添加方向为顺时针时,起始点位于圆角矩形左下方圆角与左边界的交点;路径添加方向为逆时针时,起始点位于圆角矩形左上方圆角与左边界的交点。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、roundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
54| [void OH_Drawing_PathAddOvalWithInitialPoint(OH_Drawing_Path* path, const OH_Drawing_Rect* rect,uint32_t start, OH_Drawing_PathDirection pathDirection)](#oh_drawing_pathaddovalwithinitialpoint) | 将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
55| [void OH_Drawing_PathAddOval(OH_Drawing_Path* path,const OH_Drawing_Rect* rect, OH_Drawing_PathDirection pathDirection)](#oh_drawing_pathaddoval) | 按指定方向,向路径添加椭圆。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
56| [void OH_Drawing_PathAddArc(OH_Drawing_Path* path, const OH_Drawing_Rect* rect, float startAngle, float sweepAngle)](#oh_drawing_pathaddarc) | 将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫描角度添加弧,添加的弧是矩形内切椭圆的一部分,如果扫描角度<= -360°,或>= 360°,并且起始角度对90取模接近于0,则添加椭圆而不是弧。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
57| [void OH_Drawing_PathAddPath(OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* matrix)](#oh_drawing_pathaddpath) | 将源路径矩阵变换后,添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
58| [void OH_Drawing_PathAddPathWithMatrixAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src,const OH_Drawing_Matrix* matrix, OH_Drawing_PathAddMode pathAddMode)](#oh_drawing_pathaddpathwithmatrixandmode) | 将源路径矩阵变换后,以规定模式添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
59| [void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path,const OH_Drawing_Path* src, OH_Drawing_PathAddMode pathAddMode)](#oh_drawing_pathaddpathwithmode) | 将源路径以规定模式添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
60| [void OH_Drawing_PathAddPathWithOffsetAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy,OH_Drawing_PathAddMode pathAddMode)](#oh_drawing_pathaddpathwithoffsetandmode) | 将源路径偏移后,以规定模式添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
61| [void OH_Drawing_PathAddPolygon(OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed)](#oh_drawing_pathaddpolygon) | 向路径添加多边形。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、points任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
62| [void OH_Drawing_PathAddCircle(OH_Drawing_Path* path,float x, float y, float radius, OH_Drawing_PathDirection pathDirection)](#oh_drawing_pathaddcircle) | 按指定方向,向路径添加圆形。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE;<br>pathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
63| [bool OH_Drawing_PathBuildFromSvgString(OH_Drawing_Path* path, const char* str)](#oh_drawing_pathbuildfromsvgstring) | 解析SVG字符串表示的路径。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、str任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
64| [bool OH_Drawing_PathContains(OH_Drawing_Path* path, float x, float y)](#oh_drawing_pathcontains) | 判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](capi-drawing-path-h.md#oh_drawing_pathfilltype)。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
65| [void OH_Drawing_PathTransform(OH_Drawing_Path* path, const OH_Drawing_Matrix* matrix)](#oh_drawing_pathtransform) | 对路径进行矩阵变换。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
66| [void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_Drawing_Matrix* matrix,OH_Drawing_Path* dst, bool applyPerspectiveClip)](#oh_drawing_pathtransformwithperspectiveclip) | 对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为NULL,则替换源路径。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>src、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
67| [void OH_Drawing_PathSetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType pathFillType)](#oh_drawing_pathsetfilltype) | 设置路径的填充类型,这个决定了路径内部区域的定义方式。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathFillType不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
68| [OH_Drawing_ErrorCode OH_Drawing_PathGetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType* pathFillType)](#oh_drawing_pathgetfilltype) | 获取路径的填充类型。 |
69| [float OH_Drawing_PathGetLength(OH_Drawing_Path* path, bool forceClosed)](#oh_drawing_pathgetlength) | 获取当前路径的长度。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
70| [void OH_Drawing_PathGetBounds(OH_Drawing_Path* path, OH_Drawing_Rect* rect)](#oh_drawing_pathgetbounds) | 获取包含路径的最小边界框。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
71| [void OH_Drawing_PathClose(OH_Drawing_Path* path)](#oh_drawing_pathclose) | 用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
72| [void OH_Drawing_PathOffset(OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy)](#oh_drawing_pathoffset) | 将路径中的所有点沿着x轴和y轴方向偏移一定距离,并将结果存储到目标路径对象中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
73| [void OH_Drawing_PathReset(OH_Drawing_Path* path)](#oh_drawing_pathreset) | 用于重置自定义路径数据。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
74| [bool OH_Drawing_PathIsClosed(OH_Drawing_Path* path, bool forceClosed)](#oh_drawing_pathisclosed) | 获取路径是否闭合。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
75| [bool OH_Drawing_PathGetPositionTangent(OH_Drawing_Path* path, bool forceClosed,float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent)](#oh_drawing_pathgetpositiontangent) | 获取距路径起始点指定距离的坐标点和切线值。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、position、tangent任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。 |
76| [OH_Drawing_ErrorCode OH_Drawing_PathGetSegment(OH_Drawing_Path* path, bool forceClosed,float start, float stop, bool startWithMoveTo, OH_Drawing_Path* dst, bool* result)](#oh_drawing_pathgetsegment) | 截取路径的片段并追加到目标路径上。 |
77| [bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op)](#oh_drawing_pathop) | 将两个路径按照指定的路径操作类型合并。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、srcPath任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
78| [bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed,float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag)](#oh_drawing_pathgetmatrix) | 获取距路径起始点指定距离的相应变换矩阵。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>flag不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。 |
79| [OH_Drawing_ErrorCode OH_Drawing_PathApproximate(OH_Drawing_Path* path, float acceptableError, float* vals,uint32_t* count)](#oh_drawing_pathapproximate) | 将当前路径转化为由连续直线段构成的近似路径。 |
80| [OH_Drawing_ErrorCode OH_Drawing_PathInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other,float weight, bool* success, OH_Drawing_Path* interpolatedPath)](#oh_drawing_pathinterpolate) | 按照给定权重在当前路径与另一条路径之间进行插值,并将结果存储到目标路径对象中。<br> 两条路径点数相同即可插值成功,目标路径按照当前路径的结构进行创建。 |
81| [OH_Drawing_ErrorCode OH_Drawing_PathIsInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other, bool* result)](#oh_drawing_pathisinterpolate) | 检查当前路径与另一条路径(other)在结构和操作顺序上是否完全一致,以确定两条路径是否兼容插值。<br> 若路径中包含圆锥曲线(Conic)操作,则对应操作的权重值也必须一致,才能视为兼容插值。 |
82
83## 枚举类型说明
84
85### OH_Drawing_PathDirection
86
87```
88enum OH_Drawing_PathDirection
89```
90
91**描述**
92
93添加闭合轮廓方向枚举。
94
95**起始版本:** 12
96
97| 枚举项 | 描述 |
98| -- | -- |
99| PATH_DIRECTION_CW | 顺时针方向添加闭合轮廓。 |
100| PATH_DIRECTION_CCW | 逆时针方向添加闭合轮廓。 |
101
102### OH_Drawing_PathFillType
103
104```
105enum OH_Drawing_PathFillType
106```
107
108**描述**
109
110定义路径的填充类型枚举。
111
112**起始版本:** 12
113
114| 枚举项 | 描述 |
115| -- | -- |
116| PATH_FILL_TYPE_WINDING | 绘制区域中的任意一点,向任意方向射出一条射线,对于射线和路径的所有交点,初始计数为0,<br>遇到每个顺时针的交点(路径从射线的左边向右穿过),计数加1,遇到每个逆时针的交点(路径从射线的右边向左穿过),计数减1,若最终的计数结果不为0,则认为这个点在路径内部,需要被涂色;若计数为0则不被涂色。 |
117| PATH_FILL_TYPE_EVEN_ODD | 绘制区域中的任意一点,向任意方向射出一条射线,若这条射线和路径相交的次数是奇数,则这个点被认为在路径内部,需要被涂色;若是偶数则不被涂色。 |
118| PATH_FILL_TYPE_INVERSE_WINDING | PATH_FILL_TYPE_WINDING 涂色规则取反。 |
119| PATH_FILL_TYPE_INVERSE_EVEN_ODD | PATH_FILL_TYPE_EVEN_ODD 涂色规则取反。 |
120
121### OH_Drawing_PathAddMode
122
123```
124enum OH_Drawing_PathAddMode
125```
126
127**描述**
128
129用于指定路径添加模式的枚举类型。
130
131**起始版本:** 12
132
133| 枚举项 | 描述 |
134| -- | -- |
135| PATH_ADD_MODE_APPEND | 以追加的方式添加路径。 |
136| PATH_ADD_MODE_EXTEND | 如果之前的路径未闭合,则添加直线闭合路径。 |
137
138### OH_Drawing_PathOpMode
139
140```
141enum OH_Drawing_PathOpMode
142```
143
144**描述**
145
146路径操作类型枚举。
147
148**起始版本:** 12
149
150| 枚举项 | 描述 |
151| -- | -- |
152| PATH_OP_MODE_DIFFERENCE | 差集操作。 |
153| PATH_OP_MODE_INTERSECT | 交集操作。 |
154| PATH_OP_MODE_UNION | 并集操作。 |
155| PATH_OP_MODE_XOR | 异或操作。 |
156| PATH_OP_MODE_REVERSE_DIFFERENCE | 反向差集操作。 |
157
158### OH_Drawing_PathMeasureMatrixFlags
159
160```
161enum OH_Drawing_PathMeasureMatrixFlags
162```
163
164**描述**
165
166路径测量获取相应矩阵信息维度枚举。
167
168**起始版本:** 12
169
170| 枚举项 | 描述 |
171| -- | -- |
172| GET_POSITION_MATRIX | 获取位置信息对应的矩阵。 |
173| GET_TANGENT_MATRIX | 获取切线信息对应的矩阵。 |
174| GET_POSITION_AND_TANGENT_MATRIX | 获取位置和切线信息对应的矩阵。 |
175
176
177## 函数说明
178
179### OH_Drawing_PathCreate()
180
181```
182OH_Drawing_Path* OH_Drawing_PathCreate(void)
183```
184
185**描述**
186
187用于创建一个路径对象。
188
189**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
190
191**起始版本:** 8
192
193**返回:**
194
195| 类型 | 说明 |
196| -- | -- |
197| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* | 函数会返回一个指针,指针指向创建的路径对象。 |
198
199### OH_Drawing_PathCopy()
200
201```
202OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path* path)
203```
204
205**描述**
206
207创建一个路径对象副本[OH_Drawing_Path](capi-drawing-oh-drawing-path.md),用于拷贝一个已有路径对象。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
208
209**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
210
211**起始版本:** 12
212
213
214**参数:**
215
216| 参数项 | 描述 |
217| -- | -- |
218| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
219
220**返回:**
221
222| 类型 | 说明 |
223| -- | -- |
224| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* | 函数返回一个指针,指针指向创建的路径对象副本[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)。 |
225
226### OH_Drawing_PathDestroy()
227
228```
229void OH_Drawing_PathDestroy(OH_Drawing_Path* path)
230```
231
232**描述**
233
234用于销毁路径对象并回收该对象占有的内存。
235
236**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
237
238**起始版本:** 8
239
240
241**参数:**
242
243| 参数项 | 描述 |
244| -- | -- |
245| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象的指针。 |
246
247### OH_Drawing_PathSetPath()
248
249```
250OH_Drawing_ErrorCode OH_Drawing_PathSetPath(OH_Drawing_Path* path, OH_Drawing_Path* other)
251```
252
253**描述**
254
255将一个路径对象设置成当前的路径对象。
256
257**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
258
259**起始版本:** 20
260
261
262**参数:**
263
264| 参数项 | 描述 |
265| -- | -- |
266| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
267| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* other | 用于设置的路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
268
269**返回:**
270
271| 类型 | 说明 |
272| -- | -- |
273| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行结果。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path或者other为空。 |
274
275### OH_Drawing_PathIsEmpty()
276
277```
278OH_Drawing_ErrorCode OH_Drawing_PathIsEmpty(OH_Drawing_Path* path, bool* isEmpty)
279```
280
281**描述**
282
283判断一个路径对象是否为空。
284
285**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
286
287**起始版本:** 20
288
289
290**参数:**
291
292| 参数项 | 描述 |
293| -- | -- |
294| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
295| bool* isEmpty | 表示路径对象是否为空。true表示路径对象为空,false表示路径对象不为空。作为出参使用。 |
296
297**返回:**
298
299| 类型 | 说明 |
300| -- | -- |
301| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行结果。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path或者isEmpty为空。 |
302
303### OH_Drawing_PathIsRect()
304
305```
306OH_Drawing_ErrorCode OH_Drawing_PathIsRect(OH_Drawing_Path* path, OH_Drawing_Rect* rect, bool* isRect)
307```
308
309**描述**
310
311判断路径对象是否构成一个矩形。
312
313**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
314
315**起始版本:** 20
316
317
318**参数:**
319
320| 参数项 | 描述 |
321| -- | -- |
322| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
323| [OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)* rect | 指向矩形对象[OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)的指针,作为出参使用,可以为空。 |
324| bool* isRect | 表示路径是否构成矩形。true表示构成矩形,false表示不构成矩形。作为出参使用。 |
325
326**返回:**
327
328| 类型 | 说明 |
329| -- | -- |
330| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行结果。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path或者isRect为空。 |
331
332### OH_Drawing_PathMoveTo()
333
334```
335void OH_Drawing_PathMoveTo(OH_Drawing_Path* path, float x, float y)
336```
337
338**描述**
339
340用于设置自定义路径的起始点位置。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
341
342**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
343
344**起始版本:** 8
345
346
347**参数:**
348
349| 参数项 | 描述 |
350| -- | -- |
351| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象的指针。 |
352| float x | 起始点的横坐标。 |
353| float y | 起始点的纵坐标。 |
354
355### OH_Drawing_PathLineTo()
356
357```
358void OH_Drawing_PathLineTo(OH_Drawing_Path* path, float x, float y)
359```
360
361**描述**
362
363用于添加一条从路径的最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
364
365**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
366
367**起始版本:** 8
368
369
370**参数:**
371
372| 参数项 | 描述 |
373| -- | -- |
374| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象的指针。 |
375| float x | 目标点的横坐标。 |
376| float y | 目标点的纵坐标。 |
377
378### OH_Drawing_PathArcTo()
379
380```
381void OH_Drawing_PathArcTo(OH_Drawing_Path* path,float x1, float y1, float x2, float y2, float startDeg, float sweepDeg)
382```
383
384**描述**
385
386用于给路径添加一段弧线,绘制弧线的方式为角度弧,该方式首先会指定一个矩形边框,<br>矩形边框的内切椭圆将会被用来截取弧线,然后会指定一个起始角度和扫描度数,<br>从起始角度扫描截取的椭圆周长一部分即为绘制的弧线。若路径有内容则会默认添加一条从路径的最后点位置到弧线起始点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
387
388**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
389
390**起始版本:** 8
391
392
393**参数:**
394
395| 参数项 | 描述 |
396| -- | -- |
397| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象的指针。 |
398| float x1 | 包围椭圆的矩形左上角点位置的横坐标。 |
399| float y1 | 包围椭圆的矩形左上角点位置的纵坐标。 |
400| float x2 | 包围椭圆的矩形右下角点位置的横坐标。 |
401| float y2 | 包围椭圆的矩形右下角点位置的纵坐标。 |
402| float startDeg | 起始的角度。角度的起始方向(0°)为x轴正方向。 |
403| float sweepDeg | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 |
404
405### OH_Drawing_PathQuadTo()
406
407```
408void OH_Drawing_PathQuadTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY)
409```
410
411**描述**
412
413用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
414
415**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
416
417**起始版本:** 8
418
419
420**参数:**
421
422| 参数项 | 描述 |
423| -- | -- |
424| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象的指针。 |
425| float ctrlX | 控制点位置的横坐标。 |
426| float ctrlY | 控制点位置的纵坐标。 |
427| float endX | 目标点位置的横坐标。 |
428| float endY | 目标点位置的纵坐标。 |
429
430### OH_Drawing_PathConicTo()
431
432```
433void OH_Drawing_PathConicTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY, float weight)
434```
435
436**描述**
437
438在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线段,其控制点为 (ctrlX, ctrlY),结束点为 (endX, endY)。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
439
440**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
441
442**起始版本:** 12
443
444
445**参数:**
446
447| 参数项 | 描述 |
448| -- | -- |
449| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
450| float ctrlX | 控制点位置的横坐标。 |
451| float ctrlY | 控制点位置的纵坐标。 |
452| float endX | 结束点位置的横坐标。 |
453| float endY | 结束点位置的纵坐标。 |
454| float weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。<br>若小于等于0则等同于使用[OH_Drawing_PathLineTo](capi-drawing-path-h.md#oh_drawing_pathlineto)添加一条到结束点的线段,<br>若为1则等同于[OH_Drawing_PathQuadTo](capi-drawing-path-h.md#oh_drawing_pathquadto)。 |
455
456### OH_Drawing_PathCubicTo()
457
458```
459void OH_Drawing_PathCubicTo(OH_Drawing_Path* path, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY)
460```
461
462**描述**
463
464用于添加一条从路径最后点位置(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
465
466**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
467
468**起始版本:** 8
469
470
471**参数:**
472
473| 参数项 | 描述 |
474| -- | -- |
475| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象的指针。 |
476| float ctrlX1 | 第一个控制点位置的横坐标。 |
477| float ctrlY1 | 第一个控制点位置的纵坐标。 |
478| float ctrlX2 | 第二个控制点位置的横坐标。 |
479| float ctrlY2 | 第二个控制点位置的纵坐标。 |
480| float endX | 目标点位置的横坐标。 |
481| float endY | 目标点位置的纵坐标。 |
482
483### OH_Drawing_PathRMoveTo()
484
485```
486void OH_Drawing_PathRMoveTo(OH_Drawing_Path* path, float x, float y)
487```
488
489**描述**
490
491用于设置一个相对于当前路径终点(若路径没有内容则默认为 (0, 0))的路径起始点位置。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
492
493**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
494
495**起始版本:** 12
496
497
498**参数:**
499
500| 参数项 | 描述 |
501| -- | -- |
502| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
503| float x | 相对于当前路径终点的x轴偏移量,正数往x轴正方向偏移,负数往x轴负方向偏移。 |
504| float y | 相对于当前路径终点的y轴偏移量,正数往y轴正方向偏移,负数往y轴负方向偏移。 |
505
506### OH_Drawing_PathRLineTo()
507
508```
509void OH_Drawing_PathRLineTo(OH_Drawing_Path* path, float x, float y)
510```
511
512**描述**
513
514使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
515
516**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
517
518**起始版本:** 12
519
520
521**参数:**
522
523| 参数项 | 描述 |
524| -- | -- |
525| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
526| float x | 相对于当前路径终点的x轴偏移量,用于指定目标点的横坐标。 |
527| float y | 相对于当前路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
528
529### OH_Drawing_PathRQuadTo()
530
531```
532void OH_Drawing_PathRQuadTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY)
533```
534
535**描述**
536
537使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的二阶贝塞尔曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
538
539**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
540
541**起始版本:** 12
542
543
544**参数:**
545
546| 参数项 | 描述 |
547| -- | -- |
548| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
549| float ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 |
550| float ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 |
551| float endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
552| float endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
553
554### OH_Drawing_PathRConicTo()
555
556```
557void OH_Drawing_PathRConicTo(OH_Drawing_Path* path, float ctrlX, float ctrlY, float endX, float endY, float weight)
558```
559
560**描述**
561
562使用相对位置在当前路径上添加一条路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的圆锥曲线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
563
564**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
565
566**起始版本:** 12
567
568
569**参数:**
570
571| 参数项 | 描述 |
572| -- | -- |
573| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
574| float ctrlX | 相对于路径终点的x轴偏移量,用于指定控制点的横坐标。 |
575| float ctrlY | 相对于路径终点的y轴偏移量,用于指定控制点的纵坐标。 |
576| float endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
577| float endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
578| float weight | 表示曲线的权重,决定了曲线的形状,越大越接近控制点。<br>若小于等于0则等同于使用[OH_Drawing_PathRLineTo](capi-drawing-path-h.md#oh_drawing_pathrlineto)添加一条到结束点的线段,<br>若为1则等同于[OH_Drawing_PathRQuadTo](capi-drawing-path-h.md#oh_drawing_pathrquadto)。 |
579
580### OH_Drawing_PathRCubicTo()
581
582```
583void OH_Drawing_PathRCubicTo(OH_Drawing_Path* path, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2,float endX, float endY)
584```
585
586**描述**
587
588使用相对位置在当前路径上添加一条当前路径终点(若路径没有内容则默认为 (0, 0))到目标点位置的三阶贝塞尔圆滑曲线。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
589
590**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
591
592**起始版本:** 12
593
594
595**参数:**
596
597| 参数项 | 描述 |
598| -- | -- |
599| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
600| float ctrlX1 | 相对于路径终点的x轴偏移量,用于指定第一个控制点的横坐标。 |
601| float ctrlY1 | 相对于路径终点的y轴偏移量,用于指定第一个控制点的纵坐标。 |
602| float ctrlX2 | 相对于路径终点的x轴偏移量,用于指定第二个控制点的横坐标。 |
603| float ctrlY2 | 相对于路径终点的y轴偏移量,用于指定第二个控制点的纵坐标。 |
604| float endX | 相对于路径终点的x轴偏移量,用于指定目标点的横坐标。 |
605| float endY | 相对于路径终点的y轴偏移量,用于指定目标点的纵坐标。 |
606
607### OH_Drawing_PathAddRect()
608
609```
610void OH_Drawing_PathAddRect(OH_Drawing_Path* path, float left, float top, float right, float bottom,OH_Drawing_PathDirection pathDirection)
611```
612
613**描述**
614
615按指定方向,将矩形添加到路径中,添加的路径的起始点为矩形左上角。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
616
617**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
618
619**起始版本:** 12
620
621
622**参数:**
623
624| 参数项 | 描述 |
625| -- | -- |
626| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
627| float left | 矩形左上角的x轴坐标。 |
628| float top | 矩形左上角的y轴坐标。 |
629| float right | 矩形右下角的x轴坐标。 |
630| float bottom | 矩形右下角的y轴坐标。 |
631| [OH_Drawing_PathDirection](#oh_drawing_pathdirection) pathDirection | 路径方向[OH_Drawing_PathDirection](capi-drawing-path-h.md#oh_drawing_pathdirection)。 |
632
633### OH_Drawing_PathAddRectWithInitialCorner()
634
635```
636void OH_Drawing_PathAddRectWithInitialCorner(OH_Drawing_Path* path, const OH_Drawing_Rect* rect,OH_Drawing_PathDirection pathDirection, uint32_t start)
637```
638
639**描述**
640
641按指定方向,向路径添加矩形轮廓。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
642
643**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
644
645**起始版本:** 12
646
647
648**参数:**
649
650| 参数项 | 描述 |
651| -- | -- |
652| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
653| const [OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)* rect | 指向矩形对象[OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)的指针。 |
654| OH_Drawing_PathDirection |  表示绘制方向[OH_Drawing_PathDirection](capi-drawing-path-h.md#oh_drawing_pathdirection)。 |
655| uint32_t start | 起始点的位置,表示从矩形的哪个角开始绘制路径。0:左上角,1:右上角,2:右下角,3:左下角。 |
656
657### OH_Drawing_PathAddRoundRect()
658
659```
660void OH_Drawing_PathAddRoundRect(OH_Drawing_Path* path,const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection pathDirection)
661```
662
663**描述**
664
665按指定方向,向路径添加圆角矩形轮廓。路径添加方向为顺时针时,起始点位于圆角矩形左下方圆角与左边界的交点;路径添加方向为逆时针时,起始点位于圆角矩形左上方圆角与左边界的交点。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、roundRect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
666
667**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
668
669**起始版本:** 12
670
671
672**参数:**
673
674| 参数项 | 描述 |
675| -- | -- |
676| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
677| const [OH_Drawing_RoundRect](capi-drawing-oh-drawing-roundrect.md)* roundRect | 指向圆角矩形对象[OH_Drawing_RoundRect](capi-drawing-oh-drawing-roundrect.md)的指针。 |
678| [OH_Drawing_PathDirection](#oh_drawing_pathdirection) pathDirection | 路径方向[OH_Drawing_PathDirection](capi-drawing-path-h.md#oh_drawing_pathdirection)。 |
679
680### OH_Drawing_PathAddOvalWithInitialPoint()
681
682```
683void OH_Drawing_PathAddOvalWithInitialPoint(OH_Drawing_Path* path, const OH_Drawing_Rect* rect,uint32_t start, OH_Drawing_PathDirection pathDirection)
684```
685
686**描述**
687
688将椭圆添加到路径中,其中矩形对象作为椭圆的外切矩形区域,绘制方向用来指定绘制时是顺时针或者逆时针方向。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
689
690**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
691
692**起始版本:** 12
693
694
695**参数:**
696
697| 参数项 | 描述 |
698| -- | -- |
699| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
700| const [OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)* rect | 指向矩形对象[OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)的指针。 |
701| uint32_t start | 表示椭圆初始点的索引。 |
702| [OH_Drawing_PathDirection](#oh_drawing_pathdirection) pathDirection | 表示绘制方向[OH_Drawing_PathDirection](capi-drawing-path-h.md#oh_drawing_pathdirection)。 |
703
704### OH_Drawing_PathAddOval()
705
706```
707void OH_Drawing_PathAddOval(OH_Drawing_Path* path,const OH_Drawing_Rect* rect, OH_Drawing_PathDirection pathDirection)
708```
709
710**描述**
711
712按指定方向,向路径添加椭圆。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
713
714**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
715
716**起始版本:** 12
717
718
719**参数:**
720
721| 参数项 | 描述 |
722| -- | -- |
723| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
724| const [OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)* rect | 指向矩形对象[OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)的指针。 |
725| [OH_Drawing_PathDirection](#oh_drawing_pathdirection) pathDirection | 路径方向[OH_Drawing_PathDirection](capi-drawing-path-h.md#oh_drawing_pathdirection)。 |
726
727### OH_Drawing_PathAddArc()
728
729```
730void OH_Drawing_PathAddArc(OH_Drawing_Path* path, const OH_Drawing_Rect* rect, float startAngle, float sweepAngle)
731```
732
733**描述**
734
735将圆弧添加到路径中,作为新轮廓的起点。从起始角度到扫描角度添加弧,添加的弧是矩形内切椭圆的一部分,如果扫描角度<= -360°,或>= 360°,并且起始角度对90取模接近于0,则添加椭圆而不是弧。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
736
737**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
738
739**起始版本:** 12
740
741
742**参数:**
743
744| 参数项 | 描述 |
745| -- | -- |
746| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
747| const [OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)* rect | 指向矩形对象[OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)的指针。 |
748| float startAngle | 弧的起始角度,单位为度。 |
749| float sweepAngle | 扫描的度数,为正数时顺时针扫描,为负数时逆时针扫描。实际扫描的度数为该入参对360取模的结果。 |
750
751### OH_Drawing_PathAddPath()
752
753```
754void OH_Drawing_PathAddPath(OH_Drawing_Path* path, const OH_Drawing_Path* src, const OH_Drawing_Matrix* matrix)
755```
756
757**描述**
758
759将源路径矩阵变换后,添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
760
761**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
762
763**起始版本:** 12
764
765
766**参数:**
767
768| 参数项 | 描述 |
769| -- | -- |
770| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向当前路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
771| const [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* src | 指向源路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
772| const [OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)* matrix | 指向矩阵对象[OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)的指针,为NULL时表示单位矩阵。 |
773
774### OH_Drawing_PathAddPathWithMatrixAndMode()
775
776```
777void OH_Drawing_PathAddPathWithMatrixAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src,const OH_Drawing_Matrix* matrix, OH_Drawing_PathAddMode pathAddMode)
778```
779
780**描述**
781
782将源路径矩阵变换后,以规定模式添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
783
784**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
785
786**起始版本:** 12
787
788
789**参数:**
790
791| 参数项 | 描述 |
792| -- | -- |
793| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向当前路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
794| const [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* src | 指向源路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
795| const [OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)* matrix | 指向矩阵对象[OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)的指针,为NULL表示单位矩阵。 |
796| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) pathAddMode | 路径添加模式[OH_Drawing_PathAddMode](capi-drawing-path-h.md#oh_drawing_pathaddmode)。 |
797
798### OH_Drawing_PathAddPathWithMode()
799
800```
801void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path,const OH_Drawing_Path* src, OH_Drawing_PathAddMode pathAddMode)
802```
803
804**描述**
805
806将源路径以规定模式添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
807
808**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
809
810**起始版本:** 12
811
812
813**参数:**
814
815| 参数项 | 描述 |
816| -- | -- |
817| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向当前路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
818| const [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* src | 指向源路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
819| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) pathAddMode | 路径添加模式[OH_Drawing_PathAddMode](capi-drawing-path-h.md#oh_drawing_pathaddmode)。 |
820
821### OH_Drawing_PathAddPathWithOffsetAndMode()
822
823```
824void OH_Drawing_PathAddPathWithOffsetAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy,OH_Drawing_PathAddMode pathAddMode)
825```
826
827**描述**
828
829将源路径偏移后,以规定模式添加到当前路径中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、src任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathAddMode不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
830
831**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
832
833**起始版本:** 12
834
835
836**参数:**
837
838| 参数项 | 描述 |
839| -- | -- |
840| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向当前路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
841| const [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* src | 指向源路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
842| float dx | 添加到目标路径横坐标的偏移量。 |
843| float dy | 添加到目标路径纵坐标的偏移量。 |
844| [OH_Drawing_PathAddMode](#oh_drawing_pathaddmode) pathAddMode | 路径添加模式[OH_Drawing_PathAddMode](capi-drawing-path-h.md#oh_drawing_pathaddmode)。 |
845
846### OH_Drawing_PathAddPolygon()
847
848```
849void OH_Drawing_PathAddPolygon(OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed)
850```
851
852**描述**
853
854向路径添加多边形。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、points任意一个为NULL或者count等于0时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
855
856**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
857
858**起始版本:** 12
859
860
861**参数:**
862
863| 参数项 | 描述 |
864| -- | -- |
865| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向当前路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
866| const [OH_Drawing_Point2D](capi-drawing-oh-drawing-point2d.md)* points | 表示多边形的顶点坐标数组。 |
867| uint32_t count | 表示多边形顶点坐标数组的大小。 |
868| bool isClosed | 是否添加连接起始点和终止点的线,true表示添加,false表示不添加。 |
869
870### OH_Drawing_PathAddCircle()
871
872```
873void OH_Drawing_PathAddCircle(OH_Drawing_Path* path,float x, float y, float radius, OH_Drawing_PathDirection pathDirection)
874```
875
876**描述**
877
878按指定方向,向路径添加圆形。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>radius小于等于0时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE;<br>pathDirection不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
879
880**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
881
882**起始版本:** 12
883
884
885**参数:**
886
887| 参数项 | 描述 |
888| -- | -- |
889| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
890| float x | 表示圆心的x轴坐标。 |
891| float y | 表示圆心的y轴坐标。 |
892| float radius | 表示圆形的半径。 |
893| [OH_Drawing_PathDirection](#oh_drawing_pathdirection) pathDirection | 路径方向[OH_Drawing_PathDirection](capi-drawing-path-h.md#oh_drawing_pathdirection)。 |
894
895### OH_Drawing_PathBuildFromSvgString()
896
897```
898bool OH_Drawing_PathBuildFromSvgString(OH_Drawing_Path* path, const char* str)
899```
900
901**描述**
902
903解析SVG字符串表示的路径。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、str任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
904
905**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
906
907**起始版本:** 12
908
909
910**参数:**
911
912| 参数项 | 描述 |
913| -- | -- |
914| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
915| const char* str | 表示SVG字符串。 |
916
917**返回:**
918
919| 类型 | 说明 |
920| -- | -- |
921| bool | 函数返回解析SVG字符串是否成功。true表示成功,false表示不成功。 |
922
923### OH_Drawing_PathContains()
924
925```
926bool OH_Drawing_PathContains(OH_Drawing_Path* path, float x, float y)
927```
928
929**描述**
930
931判断指定坐标点是否被路径包含,判定是否被路径包含的规则参考[OH_Drawing_PathFillType](capi-drawing-path-h.md#oh_drawing_pathfilltype)。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
932
933**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
934
935**起始版本:** 12
936
937
938**参数:**
939
940| 参数项 | 描述 |
941| -- | -- |
942| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
943| float x | 轴上坐标点。 |
944| float y | 轴上坐标点。 |
945
946**返回:**
947
948| 类型 | 说明 |
949| -- | -- |
950| bool | 函数返回true表示点在路径内,函数返回false表示点在路径外。 |
951
952### OH_Drawing_PathTransform()
953
954```
955void OH_Drawing_PathTransform(OH_Drawing_Path* path, const OH_Drawing_Matrix* matrix)
956```
957
958**描述**
959
960对路径进行矩阵变换。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
961
962**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
963
964**起始版本:** 12
965
966
967**参数:**
968
969| 参数项 | 描述 |
970| -- | -- |
971| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
972| const [OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)* matrix | 指向矩阵对象[OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)的指针。 |
973
974### OH_Drawing_PathTransformWithPerspectiveClip()
975
976```
977void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_Drawing_Matrix* matrix,OH_Drawing_Path* dst, bool applyPerspectiveClip)
978```
979
980**描述**
981
982对路径进行矩阵变换。用转换后的路径替换目标路径,如果目标路径为NULL,则替换源路径。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>src、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
983
984**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
985
986**起始版本:** 12
987
988
989**参数:**
990
991| 参数项 | 描述 |
992| -- | -- |
993| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* src | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
994| const [OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)* matrix | 指向矩阵对象[OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)的指针。 |
995| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* dst | 指向目标路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
996| bool applyPerspectiveClip | 表示变换路径是否应用透视裁剪。true表示应用透视裁剪,false表示不用透视裁剪。 |
997
998### OH_Drawing_PathSetFillType()
999
1000```
1001void OH_Drawing_PathSetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType pathFillType)
1002```
1003
1004**描述**
1005
1006设置路径的填充类型,这个决定了路径内部区域的定义方式。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>pathFillType不在枚举范围内返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
1007
1008**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1009
1010**起始版本:** 12
1011
1012
1013**参数:**
1014
1015| 参数项 | 描述 |
1016| -- | -- |
1017| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1018| [OH_Drawing_PathFillType](#oh_drawing_pathfilltype) pathFillType | 路径填充规则[OH_Drawing_PathFillType](capi-drawing-path-h.md#oh_drawing_pathfilltype)。 |
1019
1020### OH_Drawing_PathGetFillType()
1021
1022```
1023OH_Drawing_ErrorCode OH_Drawing_PathGetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType* pathFillType)
1024```
1025
1026**描述**
1027
1028获取路径的填充类型。
1029
1030**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1031
1032**起始版本:** 20
1033
1034
1035**参数:**
1036
1037| 参数项 | 描述 |
1038| -- | -- |
1039| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1040| [OH_Drawing_PathFillType](#oh_drawing_pathfilltype)* pathFillType | 指向路径填充规则[OH_Drawing_PathFillType](capi-drawing-path-h.md#oh_drawing_pathfilltype)的指针。 |
1041
1042**返回:**
1043
1044| 类型 | 说明 |
1045| -- | -- |
1046| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行结果。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path或者pathFillType为空。 |
1047
1048### OH_Drawing_PathGetLength()
1049
1050```
1051float OH_Drawing_PathGetLength(OH_Drawing_Path* path, bool forceClosed)
1052```
1053
1054**描述**
1055
1056获取当前路径的长度。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
1057
1058**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1059
1060**起始版本:** 12
1061
1062
1063**参数:**
1064
1065| 参数项 | 描述 |
1066| -- | -- |
1067| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1068| bool forceClosed | 表示是否按照闭合路径测量。true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
1069
1070**返回:**
1071
1072| 类型 | 说明 |
1073| -- | -- |
1074| float | 函数返回当前路径的长度。 |
1075
1076### OH_Drawing_PathGetBounds()
1077
1078```
1079void OH_Drawing_PathGetBounds(OH_Drawing_Path* path, OH_Drawing_Rect* rect)
1080```
1081
1082**描述**
1083
1084获取包含路径的最小边界框。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、rect任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
1085
1086**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1087
1088**起始版本:** 12
1089
1090
1091**参数:**
1092
1093| 参数项 | 描述 |
1094| -- | -- |
1095| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1096| [OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)* rect | 指向矩形对象[OH_Drawing_Rect](capi-drawing-oh-drawing-rect.md)的指针。 |
1097
1098### OH_Drawing_PathClose()
1099
1100```
1101void OH_Drawing_PathClose(OH_Drawing_Path* path)
1102```
1103
1104**描述**
1105
1106用于闭合路径,会添加一条从路径起点位置到最后点位置的线段。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
1107
1108**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1109
1110**起始版本:** 8
1111
1112
1113**参数:**
1114
1115| 参数项 | 描述 |
1116| -- | -- |
1117| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1118
1119### OH_Drawing_PathOffset()
1120
1121```
1122void OH_Drawing_PathOffset(OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy)
1123```
1124
1125**描述**
1126
1127将路径中的所有点沿着x轴和y轴方向偏移一定距离,并将结果存储到目标路径对象中。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
1128
1129**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1130
1131**起始版本:** 12
1132
1133
1134**参数:**
1135
1136| 参数项 | 描述 |
1137| -- | -- |
1138| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向当前路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1139| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* dst | 指向目标路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针,为NULL时会将结果存储到当前路径对象中。 |
1140| float dx | 轴方向的偏移量。 |
1141| float dy | 轴方向的偏移量。 |
1142
1143### OH_Drawing_PathReset()
1144
1145```
1146void OH_Drawing_PathReset(OH_Drawing_Path* path)
1147```
1148
1149**描述**
1150
1151用于重置自定义路径数据。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
1152
1153**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1154
1155**起始版本:** 8
1156
1157
1158**参数:**
1159
1160| 参数项 | 描述 |
1161| -- | -- |
1162| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象的指针。 |
1163
1164### OH_Drawing_PathIsClosed()
1165
1166```
1167bool OH_Drawing_PathIsClosed(OH_Drawing_Path* path, bool forceClosed)
1168```
1169
1170**描述**
1171
1172获取路径是否闭合。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
1173
1174**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1175
1176**起始版本:** 12
1177
1178
1179**参数:**
1180
1181| 参数项 | 描述 |
1182| -- | -- |
1183| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1184| bool forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
1185
1186**返回:**
1187
1188| 类型 | 说明 |
1189| -- | -- |
1190| bool | 返回路径是否闭合。true表示路径的测量结果为已闭合,false表示路径的测量结果为未闭合。 |
1191
1192### OH_Drawing_PathGetPositionTangent()
1193
1194```
1195bool OH_Drawing_PathGetPositionTangent(OH_Drawing_Path* path, bool forceClosed,float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent)
1196```
1197
1198**描述**
1199
1200获取距路径起始点指定距离的坐标点和切线值。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、position、tangent任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER。
1201
1202**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1203
1204**起始版本:** 12
1205
1206
1207**参数:**
1208
1209| 参数项 | 描述 |
1210| -- | -- |
1211| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1212| bool forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
1213| float distance | 表示距离起始点的距离,小于0时会被视为0处理,大于路径长度时会被视为路径长度处理。 |
1214| [OH_Drawing_Point2D](capi-drawing-oh-drawing-point2d.md)* position | 表示距路径起始点指定距离的坐标点。 |
1215| [OH_Drawing_Point2D](capi-drawing-oh-drawing-point2d.md)* tangent | 表示距路径起始点指定距离的切线值,tangent.x表示该点切线的余弦值,tangent.y表示该点切线的正弦值。 |
1216
1217**返回:**
1218
1219| 类型 | 说明 |
1220| -- | -- |
1221| bool | 返回测量是否成功。true表示成功,false表示失败。 |
1222
1223### OH_Drawing_PathGetSegment()
1224
1225```
1226OH_Drawing_ErrorCode OH_Drawing_PathGetSegment(OH_Drawing_Path* path, bool forceClosed,float start, float stop, bool startWithMoveTo, OH_Drawing_Path* dst, bool* result)
1227```
1228
1229**描述**
1230
1231截取路径的片段并追加到目标路径上。
1232
1233**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1234
1235**起始版本:** 18
1236
1237
1238**参数:**
1239
1240| 参数项 | 描述 |
1241| -- | -- |
1242| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1243| bool forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
1244| float start | 表示与路径起始点的距离,距离路径起始点start距离的位置即为截取路径片段的起始点,小于0时会被视作0,大于等于stop时会截取失败。 |
1245| float stop | 表示与路径起始点的距离,距离路径起始点stop距离的位置即为截取路径片段的终点,小于等于start时会截取失败,大于路径长度时会被视作路径长度。 |
1246| bool startWithMoveTo | 表示是否在目标路径执行[OH_Drawing_PathMoveTo](capi-drawing-path-h.md#oh_drawing_pathmoveto)移动到截取路径片段的起始点位置。true表示执行,false表示不执行。 |
1247| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* dst | 指向目标路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针,截取成功时会将得到的路径片段追加到目标路径上,截取失败时不做改变。 |
1248| bool* result | 返回是否成功截取路径片段的结果。true表示截取成功,false表示截取失败。作为出参使用。 |
1249
1250**返回:**
1251
1252| 类型 | 说明 |
1253| -- | -- |
1254| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行错误码。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path、dst、result至少有一个为空指针。 |
1255
1256### OH_Drawing_PathOp()
1257
1258```
1259bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_Drawing_PathOpMode op)
1260```
1261
1262**描述**
1263
1264将两个路径按照指定的路径操作类型合并。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、srcPath任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>op不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
1265
1266**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1267
1268**起始版本:** 12
1269
1270
1271**参数:**
1272
1273| 参数项 | 描述 |
1274| -- | -- |
1275| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针,操作完成后的路径结果将会保存在此路径对象中。 |
1276| const [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* other | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1277| [OH_Drawing_PathOpMode](#oh_drawing_pathopmode) op | 路径操作枚举类型,支持可选的具体模式可见[OH_Drawing_PathOpMode](capi-drawing-path-h.md#oh_drawing_pathopmode)枚举。 |
1278
1279**返回:**
1280
1281| 类型 | 说明 |
1282| -- | -- |
1283| bool | 返回操作后的路径是否为空。true表示路径不为空,false表示路径为空。 |
1284
1285### OH_Drawing_PathGetMatrix()
1286
1287```
1288bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed,float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag)
1289```
1290
1291**描述**
1292
1293获取距路径起始点指定距离的相应变换矩阵。<br>本接口会产生错误码,可以通过[OH_Drawing_ErrorCodeGet](capi-drawing-error-code-h.md#oh_drawing_errorcodeget)查看错误码的取值。<br>path、matrix任意一个为NULL时返回OH_DRAWING_ERROR_INVALID_PARAMETER;<br>flag不在枚举范围内时返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE。
1294
1295**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1296
1297**起始版本:** 12
1298
1299**参数:**
1300
1301| 参数项 | 描述 |
1302| -- | -- |
1303| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1304| bool forceClosed | 表示是否按照闭合路径测量,true表示测量时路径会被强制视为已闭合,false表示会根据路径的实际闭合状态测量。 |
1305| float distance | 表示距离起始点的距离,小于0时会被视为0处理,大于路径长度时会被视为路径长度处理。 |
1306| [OH_Drawing_Matrix](capi-drawing-oh-drawing-matrix.md)* matrix | 表示要获取的变换矩阵。 |
1307| [OH_Drawing_PathMeasureMatrixFlags](#oh_drawing_pathmeasurematrixflags) flag | 矩阵信息维度枚举,支持可选的具体模式可见[OH_Drawing_PathMeasureMatrixFlags](capi-drawing-path-h.md#oh_drawing_pathmeasurematrixflags)枚举。 |
1308
1309**返回:**
1310
1311| 类型 | 说明 |
1312| -- | -- |
1313| bool | 返回获取变换矩阵是否成功。true表示获取成功,false表示获取失败,失败的原因可能是path为NULL或者长度为0。 |
1314
1315### OH_Drawing_PathApproximate()
1316
1317```
1318OH_Drawing_ErrorCode OH_Drawing_PathApproximate(OH_Drawing_Path* path, float acceptableError, float* vals,uint32_t* count)
1319```
1320
1321**描述**
1322
1323将当前路径转化为由连续直线段构成的近似路径。
1324
1325**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1326
1327**起始版本:** 20
1328
1329
1330**参数:**
1331
1332| 参数项 | 描述 |
1333| -- | -- |
1334| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1335| float acceptableError | 表示路径上每条线段的可接受误差,不能小于0。<br> 1.当acceptableError为0时,曲线路径被极度细分,会严重影响性能和内存消耗,不建议设置误差值为0。<br> 2.当acceptableError特别大时,路径会极度简化,保留少量关键点,可能会丢失原有形状。<br> 3.对于椭圆等曲线,当acceptableError过大时,拟合结果通常只包含椭圆的分段贝塞尔曲线的起止点,椭圆形会被极度简化为多边形。 |
1336| float* vals | 返回包含路径近似点的数组。<br> 每个点由三个值组成,分别表示:<br> 1.该点所在的位置距离路径起点的长度比例值。<br> 2.点的x坐标。<br> 3.点的y坐标。 |
1337| uint32_t* count | 返回数组的大小,数组大小至少为6。vals为空指针时返回拟合后的点数数组的大小。 |
1338
1339**返回:**
1340
1341| 类型 | 说明 |
1342| -- | -- |
1343| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行结果。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path或者count为空指针。<br> 返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示参数acceptableError小于0。 |
1344
1345### OH_Drawing_PathInterpolate()
1346
1347```
1348OH_Drawing_ErrorCode OH_Drawing_PathInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other,float weight, bool* success, OH_Drawing_Path* interpolatedPath)
1349```
1350
1351**描述**
1352
1353按照给定权重在当前路径与另一条路径之间进行插值,并将结果存储到目标路径对象中。<br> 两条路径点数相同即可插值成功,目标路径按照当前路径的结构进行创建。
1354
1355**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1356
1357**起始版本:** 20
1358
1359
1360**参数:**
1361
1362| 参数项 | 描述 |
1363| -- | -- |
1364| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1365| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* other | 指向用于插值的另一条路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1366| float weight | 表示插值权重,范围为[0, 1]。 |
1367| bool* success | 表示插值是否成功。true表示插值成功,false表示插值失败。作为出参使用。 |
1368| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* interpolatedPath | 指向用于存储插值结果的路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1369
1370**返回:**
1371
1372| 类型 | 说明 |
1373| -- | -- |
1374| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行结果。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path、other、success或者interpolatedPath为空指针。<br> 返回OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE,表示参数weight不在[0, 1]范围内。 |
1375
1376### OH_Drawing_PathIsInterpolate()
1377
1378```
1379OH_Drawing_ErrorCode OH_Drawing_PathIsInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other, bool* result)
1380```
1381
1382**描述**
1383
1384检查当前路径与另一条路径(other)在结构和操作顺序上是否完全一致,以确定两条路径是否兼容插值。<br> 若路径中包含圆锥曲线(Conic)操作,则对应操作的权重值也必须一致,才能视为兼容插值。
1385
1386**系统能力:** SystemCapability.Graphic.Graphic2D.NativeDrawing
1387
1388**起始版本:** 20
1389
1390
1391**参数:**
1392
1393| 参数项 | 描述 |
1394| -- | -- |
1395| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* path | 指向路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1396| [OH_Drawing_Path](capi-drawing-oh-drawing-path.md)* other | 指向另一条路径对象[OH_Drawing_Path](capi-drawing-oh-drawing-path.md)的指针。 |
1397| bool* result | 表示当前路径与另一条路径是否兼容插值。作为出参使用。<br> 如果路径兼容,则返回true,否则返回false。 |
1398
1399**返回:**
1400
1401| 类型 | 说明 |
1402| -- | -- |
1403| [OH_Drawing_ErrorCode](capi-drawing-error-code-h.md#oh_drawing_errorcode) | 函数返回执行结果。<br> 返回OH_DRAWING_SUCCESS,表示执行成功。<br> 返回OH_DRAWING_ERROR_INVALID_PARAMETER,表示参数path、other或者result为空指针。 |
1404
1405
1406