• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef C_INCLUDE_DRAWING_PATH_H
17 #define C_INCLUDE_DRAWING_PATH_H
18 
19 /**
20  * @addtogroup Drawing
21  * @{
22  *
23  * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
24  *
25  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
26  *
27  * @since 8
28  * @version 1.0
29  */
30 
31 /**
32  * @file drawing_path.h
33  *
34  * @brief Declares functions related to the <b>path</b> object in the drawing module.
35  *
36  * @since 8
37  * @version 1.0
38  */
39 
40 #include "drawing_error_code.h"
41 #include "drawing_types.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @brief Direction for adding closed contours.
49  *
50  * @since 12
51  * @version 1.0
52  */
53 typedef enum {
54     /** clockwise direction for adding closed contours */
55     PATH_DIRECTION_CW,
56     /** counter-clockwise direction for adding closed contours */
57     PATH_DIRECTION_CCW,
58 } OH_Drawing_PathDirection;
59 
60 /**
61  * @brief FillType of path.
62  *
63  * @since 12
64  * @version 1.0
65  */
66 typedef enum {
67     /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings */
68     PATH_FILL_TYPE_WINDING,
69     /** Specifies that "inside" is computed by an odd number of edge crossings */
70     PATH_FILL_TYPE_EVEN_ODD,
71     /** Same as Winding, but draws outside of the path, rather than inside */
72     PATH_FILL_TYPE_INVERSE_WINDING,
73     /** Same as EvenOdd, but draws outside of the path, rather than inside */
74     PATH_FILL_TYPE_INVERSE_EVEN_ODD,
75 } OH_Drawing_PathFillType;
76 
77 /**
78  * @brief Add mode of path.
79  *
80  * @since 12
81  * @version 1.0
82  */
83 typedef enum {
84     /** Appended to destination unaltered */
85     PATH_ADD_MODE_APPEND,
86     /** Add line if prior contour is not closed */
87     PATH_ADD_MODE_EXTEND,
88 } OH_Drawing_PathAddMode;
89 
90 /**
91  * @brief Operations when two paths object are combined.
92  *
93  * @since 12
94  * @version 1.0
95  */
96 typedef enum {
97     /**
98      * Difference operation.
99      */
100     PATH_OP_MODE_DIFFERENCE,
101     /**
102      * Intersect operation.
103      */
104     PATH_OP_MODE_INTERSECT,
105     /**
106      * Union operation.
107      */
108     PATH_OP_MODE_UNION,
109     /**
110      * Xor operation.
111      */
112     PATH_OP_MODE_XOR,
113     /**
114      * Reverse difference operation.
115      */
116     PATH_OP_MODE_REVERSE_DIFFERENCE,
117 } OH_Drawing_PathOpMode;
118 
119 /**
120  * @brief Enumerates the matrix information corresponding to the path measurements.
121  *
122  * @since 12
123  * @version 1.0
124  */
125 typedef enum {
126     /**
127      * Gets position.
128      */
129     GET_POSITION_MATRIX,
130     /**
131      * Gets tangent.
132      */
133     GET_TANGENT_MATRIX,
134     /**
135      * Gets both position and tangent.
136      */
137     GET_POSITION_AND_TANGENT_MATRIX,
138 } OH_Drawing_PathMeasureMatrixFlags;
139 
140 /**
141  * @brief Creates an <b>OH_Drawing_Path</b> object.
142  *
143  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
144  * @return Returns the pointer to the <b>OH_Drawing_Path</b> object created.
145  * @since 8
146  * @version 1.0
147  */
148 OH_Drawing_Path* OH_Drawing_PathCreate(void);
149 
150 /**
151  * @brief Creates an <b>OH_Drawing_Path</b> copy object.
152  *
153  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
154  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
155  * @return Returns the pointer to the <b>OH_Drawing_Path</b> object created.
156  * @since 12
157  * @version 1.0
158  */
159 OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path*);
160 
161 /**
162  * @brief Destroys an <b>OH_Drawing_Path</b> object and reclaims the memory occupied by the object.
163  *
164  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
165  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
166  * @since 8
167  * @version 1.0
168  */
169 void OH_Drawing_PathDestroy(OH_Drawing_Path*);
170 
171 /**
172  * @brief Sets <b>OH_Drawing_Path</b> object with the same content of another.
173  *
174  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
175  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
176  * @param other Indicates the pointer to an <b>OH_Drawing_Path</b> object to copy content from.
177  * @return Returns the error code.
178  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
179  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if path or other is nullptr.
180  * @since 20
181  * @version 1.0
182  */
183 OH_Drawing_ErrorCode OH_Drawing_PathSetPath(OH_Drawing_Path* path, OH_Drawing_Path* other);
184 
185 /**
186  * @brief Checks if <b>OH_Drawing_Path</b> represents a empty.
187  *
188  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
189  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
190  * @param isEmpty Indicates the return value.
191  * @return Returns the error code.
192  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
193  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if path or isEmpty is nullptr.
194  * @since 20
195  * @version 1.0
196  */
197 OH_Drawing_ErrorCode OH_Drawing_PathIsEmpty(OH_Drawing_Path* path, bool* isEmpty);
198 
199 /**
200  * @brief Checks if <b>OH_Drawing_Path</b> represents a rectangle.
201  *
202  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
203  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
204  * @param rect Indicates the Pointer to an <b>OH_Drawing_Rect</b> object.
205  * @param isRect Indicates the return value.
206  * @return Returns the error code.
207  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
208  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if path or isEmpty is nullptr.
209  * @since 20
210  * @version 1.0
211  */
212 OH_Drawing_ErrorCode OH_Drawing_PathIsRect(OH_Drawing_Path* path, OH_Drawing_Rect* rect, bool* isRect);
213 
214 /**
215  * @brief Sets the start point of a path.
216  *
217  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
218  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
219  * @param x Indicates the x coordinate of the start point.
220  * @param y Indicates the y coordinate of the start point.
221  * @since 8
222  * @version 1.0
223  */
224 void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y);
225 
226 /**
227  * @brief Draws a line segment from the last point of a path to the target point.
228  *
229  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
230  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
231  * @param x Indicates the x coordinate of the target point.
232  * @param y Indicates the y coordinate of the target point.
233  * @since 8
234  * @version 1.0
235  */
236 void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y);
237 
238 /**
239  * @brief Draws an arc to a path.
240  *
241  * This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first,
242  * and then a start angle and a sweep angle are specified.
243  * The arc is a portion of the ellipse defined by the start angle and the sweep angle.
244  * By default, a line segment from the last point of the path to the start point of the arc is also added.
245  *
246  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
247  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
248  * @param x1 Indicates the x coordinate of the upper left corner of the rectangle.
249  * @param y1 Indicates the y coordinate of the upper left corner of the rectangle.
250  * @param x2 Indicates the x coordinate of the lower right corner of the rectangle.
251  * @param y2 Indicates the y coordinate of the lower right corner of the rectangle.
252  * @param startDeg Indicates the start angle, in degrees.
253  * @param sweepDeg Indicates the angle to sweep, in degrees.
254  * @since 8
255  * @version 1.0
256  */
257 void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg);
258 
259 /**
260  * @brief Draws a quadratic Bezier curve from the last point of a path to the target point.
261  *
262  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
263  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
264  * @param ctrlX Indicates the x coordinate of the control point.
265  * @param ctrlY Indicates the y coordinate of the control point.
266  * @param endX Indicates the x coordinate of the target point.
267  * @param endY Indicates the y coordinate of the target point.
268  * @since 8
269  * @version 1.0
270  */
271 void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY);
272 
273 /**
274  * @brief Draws a conic from the last point of a path to the target point.
275  *
276  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
277  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
278  * @param ctrlX Indicates the x coordinate of the control point.
279  * @param ctrlY Indicates the y coordinate of the control point.
280  * @param endX Indicates the x coordinate of the target point.
281  * @param endY Indicates the y coordinate of the target point.
282  * @param weight Indicates the weight of added conic.
283  * @since 12
284  * @version 1.0
285  */
286 void OH_Drawing_PathConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight);
287 
288 /**
289  * @brief Draws a cubic Bezier curve from the last point of a path to the target point.
290  *
291  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
292  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
293  * @param ctrlX1 Indicates the x coordinate of the first control point.
294  * @param ctrlY1 Indicates the y coordinate of the first control point.
295  * @param ctrlX2 Indicates the x coordinate of the second control point.
296  * @param ctrlY2 Indicates the y coordinate of the second control point.
297  * @param endX Indicates the x coordinate of the target point.
298  * @param endY Indicates the y coordinate of the target point.
299  * @since 8
300  * @version 1.0
301  */
302 void OH_Drawing_PathCubicTo(
303     OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY);
304 
305 /**
306  * @brief Sets the relative starting point of a path.
307  *
308  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
309  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
310  * @param x Indicates the x coordinate of the relative starting point.
311  * @param y Indicates the y coordinate of the relative starting point.
312  * @since 12
313  * @version 1.0
314  */
315 void OH_Drawing_PathRMoveTo(OH_Drawing_Path*, float x, float y);
316 
317 /**
318  * @brief Draws a line segment from the last point of a path to the relative target point.
319  *
320  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
321  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
322  * @param x Indicates the x coordinate of the relative target point.
323  * @param y Indicates the y coordinate of the relative target point.
324  * @since 12
325  * @version 1.0
326  */
327 void OH_Drawing_PathRLineTo(OH_Drawing_Path*, float x, float y);
328 
329 /**
330  * @brief Draws a quadratic bezier curve from the last point of a path to the relative target point.
331  *
332  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
333  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
334  * @param ctrlX Indicates the x coordinate of the relative control point.
335  * @param ctrlY Indicates the y coordinate of the relative control point.
336  * @param endX Indicates the x coordinate of the relative target point.
337  * @param endY Indicates the y coordinate of the relative target point.
338  * @since 12
339  * @version 1.0
340  */
341 void OH_Drawing_PathRQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY);
342 
343 /**
344  * @brief Draws a conic from the last point of a path to the relative target point.
345  *
346  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
347  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
348  * @param ctrlX Indicates the x coordinate of the relative control point.
349  * @param ctrlY Indicates the y coordinate of the relative control point.
350  * @param endX Indicates the x coordinate of the relative target point.
351  * @param endY Indicates the y coordinate of the relative target point.
352  * @param weight Indicates the weight of added conic.
353  * @since 12
354  * @version 1.0
355  */
356 void OH_Drawing_PathRConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight);
357 
358 /**
359  * @brief Draws a cubic bezier curve from the last point of a path to the relative target point.
360  *
361  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
362  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
363  * @param ctrlX1 Indicates the x coordinate of the first relative control point.
364  * @param ctrlY1 Indicates the y coordinate of the first relative control point.
365  * @param ctrlX2 Indicates the x coordinate of the second relative control point.
366  * @param ctrlY2 Indicates the y coordinate of the second relative control point.
367  * @param endX Indicates the x coordinate of the relative target point.
368  * @param endY Indicates the y coordinate of the relative target point.
369  * @since 12
370  * @version 1.0
371  */
372 void OH_Drawing_PathRCubicTo(OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2,
373     float endX, float endY);
374 
375 /**
376  * @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction.
377  *
378  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
379  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
380  * @param left Indicates the left coordinate of the upper left corner of the rectangle.
381  * @param top Indicates the top coordinate of the upper top corner of the rectangle.
382  * @param right Indicates the right coordinate of the lower right corner of the rectangle.
383  * @param bottom Indicates the bottom coordinate of the lower bottom corner of the rectangle.
384  * @param OH_Drawing_PathDirection Indicates the path direction.
385  * @since 12
386  * @version 1.0
387  */
388 void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top, float right, float bottom,
389     OH_Drawing_PathDirection);
390 
391 /**
392  * @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction.
393  *
394  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
395  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
396  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
397  * @param OH_Drawing_PathDirection Indicates the path direction.
398  * @param start Indicates initial corner of rect to add.
399  * @since 12
400  * @version 1.0
401  */
402 void OH_Drawing_PathAddRectWithInitialCorner(OH_Drawing_Path*, const OH_Drawing_Rect*,
403     OH_Drawing_PathDirection, uint32_t start);
404 
405 /**
406  * @brief Adds a new contour to the path, defined by the round rect, and wound in the specified direction.
407  *
408  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
409  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
410  * @param OH_Drawing_RoundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object.
411  * @param OH_Drawing_PathDirection Indicates the path direction.
412  * @since 12
413  * @version 1.0
414  */
415 void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection);
416 
417 /**
418  * @brief Adds a oval to the path, defined by the rect, and wound in the specified direction.
419  *
420  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
421  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
422  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
423  * @param start Index of initial point of ellipse.
424  * @param OH_Drawing_PathDirection Indicates the path direction.
425  * @since 12
426  * @version 1.0
427  */
428 void OH_Drawing_PathAddOvalWithInitialPoint(OH_Drawing_Path*, const OH_Drawing_Rect*,
429     uint32_t start, OH_Drawing_PathDirection);
430 
431 /**
432  * @brief Appends arc to path, as the start of new contour.Arc added is part of ellipse bounded by oval,
433  * from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees
434  * is aligned with the positive x-axis, and positive sweeps extends arc clockwise.If sweepAngle <= -360, or
435  * sweepAngle >= 360; and startAngle modulo 90 is nearly zero, append oval instead of arc. Otherwise, sweepAngle
436  * values are treated modulo 360, and arc may or may not draw depending on numeric rounding.
437  *
438  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
439  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
440  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
441  * @param startAngle Indicates the starting angle of arc in degrees.
442  * @param sweepAngle Indicates the sweep, in degrees. Positive is clockwise.
443  * @since 12
444  * @version 1.0
445  */
446 void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle);
447 
448 /**
449  * @brief Appends src path to path, transformed by matrix. Transformed curves may have different verbs,
450  * point, and conic weights.
451  *
452  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
453  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
454  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
455  * @param OH_Drawing_Matrix Indicates the length of the <b>OH_Drawing_Matrix</b> object.
456  * @since 12
457  * @version 1.0
458  */
459 void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const OH_Drawing_Matrix*);
460 
461 /**
462  * @brief Appends src path to path, transformed by matrix and mode. Transformed curves may have different verbs,
463  * point, and conic weights.
464  *
465  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
466  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
467  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
468  * @param OH_Drawing_Matrix Indicates the length of the <b>OH_Drawing_Matrix</b> object.
469  * @param OH_Drawing_PathAddMode Indicates the add path's add mode.
470  * @since 12
471  * @version 1.0
472  */
473 void OH_Drawing_PathAddPathWithMatrixAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src,
474     const OH_Drawing_Matrix*, OH_Drawing_PathAddMode);
475 
476 /**
477  * @brief Appends src path to path, transformed by mode. Transformed curves may have different verbs,
478  * point, and conic weights.
479  *
480  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
481  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
482  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object, which is Appends src path to path.
483  * @param OH_Drawing_PathAddMode Indicates the add path's add mode.
484  * @since 12
485  * @version 1.0
486  */
487 void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode);
488 
489 /**
490  * @brief Appends src path to path, transformed by offset and mode. Transformed curves may have different verbs,
491  * point, and conic weights.
492  *
493  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
494  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
495  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
496  * @param dx Indicates offset added to src path x-axis coordinates.
497  * @param dy Indicates offset added to src path y-axis coordinates.
498  * @param OH_Drawing_PathAddMode Indicates the add path's add mode.
499  * @since 12
500  * @version 1.0
501  */
502 void OH_Drawing_PathAddPathWithOffsetAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy,
503     OH_Drawing_PathAddMode);
504 
505 /**
506  * @brief Adds a oval to the path, defined by the rect, and wound in the specified direction.
507  *
508  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
509  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
510  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
511  * @param OH_Drawing_PathDirection Indicates the path direction.
512  * @since 12
513  * @version 1.0
514  */
515 void OH_Drawing_PathAddOval(OH_Drawing_Path*, const OH_Drawing_Rect*, OH_Drawing_PathDirection);
516 
517 /**
518  * @brief Adds contour created from point array, adding (count - 1) line segments.
519  *
520  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
521  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
522  * @param points Indicates the point array.
523  * @param count Indicates the size of point array.
524  * @param isClosed Indicates Whether to add lines that connect the end and start.
525  * @since 12
526  * @version 1.0
527  */
528 void OH_Drawing_PathAddPolygon(OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed);
529 
530 /**
531  * @brief  Adds a circle to the path, and wound in the specified direction.
532  *
533  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
534  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
535  * @param x Indicates the x coordinate of the center of the circle.
536  * @param y Indicates the y coordinate of the center of the circle.
537  * @param radius Indicates the radius of the circle.
538  * @param OH_Drawing_PathDirection Indicates the path direction.
539  * @since 12
540  * @version 1.0
541  */
542 void OH_Drawing_PathAddCircle(OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection);
543 
544 /**
545  * @brief Parses the svg path from the string.
546  *
547  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
548  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
549  * @param str Indicates the string of the SVG path.
550  * @return Returns true if build path is successful, returns false otherwise.
551  * @since 12
552  * @version 1.0
553  */
554 bool OH_Drawing_PathBuildFromSvgString(OH_Drawing_Path* path, const char* str);
555 
556 /**
557  * @brief Return the status that point (x, y) is contained by path.
558  *
559  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
560  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
561  * @param x Indicates the x-axis value of containment test.
562  * @param y Indicates the y-axis value of containment test.
563  * @return Returns true if the point (x, y) is contained by path.
564  * @since 12
565  * @version 1.0
566  */
567 bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y);
568 
569 /**
570  * @brief Transforms verb array, point array, and weight by matrix. transform may change verbs
571  * and increase their number. path is replaced by transformed data.
572  *
573  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
574  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
575  * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
576  * @since 12
577  * @version 1.0
578  */
579 void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*);
580 
581 /**
582  * @brief Transforms verb array, point array, and weight by matrix.
583  * Transform may change verbs and increase their number.
584  *
585  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
586  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
587  * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
588  * @param dst Indicates the pointer to an <b>OH_Drawing_Path</b> object.
589  * @param applyPerspectiveClip Indicates whether to apply perspective clip.
590  * @since 12
591  * @version 1.0
592  */
593 void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_Drawing_Matrix*,
594     OH_Drawing_Path* dst, bool applyPerspectiveClip);
595 
596 /**
597  * @brief Sets FillType, the rule used to fill path.
598  *
599  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
600  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
601  * @param OH_Drawing_PathFillType Indicates the add path's fill type.
602  * @since 12
603  * @version 1.0
604  */
605 void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType);
606 
607 /**
608  * @brief Gets FillType, the rule used to fill path.
609  *
610  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
611  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
612  * @param pathFillType Indicates the FillType apply to path.
613  * @return Returns the error code.
614  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
615  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if path or isEmpty is nullptr.
616  * @since 20
617  * @version 1.0
618  */
619 OH_Drawing_ErrorCode OH_Drawing_PathGetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType* pathFillType);
620 
621 /**
622  * @brief Gets the length of the current path object.
623  *
624  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
625  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
626  * @param forceClosed Indicates whether free to modify/delete the path after this call.
627  * @return Returns the length of the current path object.
628  * @since 12
629  * @version 1.0
630  */
631 float OH_Drawing_PathGetLength(OH_Drawing_Path*, bool forceClosed);
632 
633 /**
634  * @brief Gets the smallest bounding box that contains the path.
635  *
636  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
637  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
638  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
639  * @since 12
640  * @version 1.0
641  */
642 void OH_Drawing_PathGetBounds(OH_Drawing_Path*, OH_Drawing_Rect*);
643 
644 /**
645  * @brief Closes a path. A line segment from the start point to the last point of the path is added.
646  *
647  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
648  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
649  * @since 8
650  * @version 1.0
651  */
652 void OH_Drawing_PathClose(OH_Drawing_Path*);
653 
654 /**
655  * @brief Offset path replaces dst.
656  *
657  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
658  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
659  * @param dst Indicates the pointer to an <b>OH_Drawing_Path</b> object.
660  * @param dx Indicates offset added to dst path x-axis coordinates.
661  * @param dy Indicates offset added to dst path y-axis coordinates.
662  * @since 12
663  * @version 1.0
664  */
665 void OH_Drawing_PathOffset(OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy);
666 
667 /**
668  * @brief Resets path data.
669  *
670  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
671  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
672  * @since 8
673  * @version 1.0
674  */
675 void OH_Drawing_PathReset(OH_Drawing_Path*);
676 
677 /**
678  * @brief Determines whether the path current contour is closed.
679  *
680  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
681  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
682  * @param forceClosed Whether to close the Path.
683  * @return Returns <b>true</b> if the path current contour is closed; returns <b>false</b> otherwise.
684  * @since 12
685  * @version 1.0
686  */
687 bool OH_Drawing_PathIsClosed(OH_Drawing_Path* path, bool forceClosed);
688 
689 /**
690  * @brief Gets the position and tangent of the distance from the starting position of the Path.
691  *
692  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
693  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
694  * @param forceClosed Whether to close the Path.
695  * @param distance The distance from the start of the Path.
696  * @param position Sets to the position of distance from the starting position of the Path.
697  * @param tangent Sets to the tangent of distance from the starting position of the Path.
698  * @return Returns <b>true</b> if succeeded; returns <b>false</b> otherwise.
699  * @since 12
700  * @version 1.0
701  */
702 bool OH_Drawing_PathGetPositionTangent(OH_Drawing_Path* path, bool forceClosed,
703     float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent);
704 
705 /**
706  * @brief Gets the path between the start and end points.
707  *
708  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
709  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
710  * @param forceClosed Whether to close the path.
711  * @param start The distance from the starting point of the segment to the starting point of the path.
712  * @param stop The distance from the end point of the segment to the starting point of the path.
713  * @param startWithMoveTo Whether the path obtained moveTo to the starting segment.
714  * @param dst The path obtained.
715  * @param result Indicates the result of getting the path segment.
716  *               The value is false if the segment is zero-length or start >= stop, and true otherwise.
717  * @return Returns the error code.
718  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
719  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of path, dst and result is nullptr.
720  * @since 18
721  * @version 1.0
722  */
723 OH_Drawing_ErrorCode OH_Drawing_PathGetSegment(OH_Drawing_Path* path, bool forceClosed,
724     float start, float stop, bool startWithMoveTo, OH_Drawing_Path* dst, bool* result);
725 
726 /**
727  * @brief Combines two paths.
728  *
729  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
730  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
731  * @param srcPath Indicates the pointer to an <b>OH_Drawing_Path</b> object.
732  * @param op Indicates the operation to apply to combine.
733  * @return Returns <b>true</b> if constructed path is not empty; returns <b>false</b> otherwise.
734  * @since 12
735  * @version 1.0
736  */
737 bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* srcPath, OH_Drawing_PathOpMode op);
738 
739 /**
740  * @brief Computes the corresponding matrix at the specified distance.
741  *
742  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
743  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
744  * @param forceClosed Whether to close the Path.
745  * @param distance The distance from the start of the Path.
746  * @param matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
747  * @param flag Indicates what should be returned in the matrix.
748  * @return Returns <b>false</b> if path is nullptr or zero-length;
749  *         returns <b>true</b> if path is not nullptr and not zero-length.
750  * @since 12
751  * @version 1.0
752  */
753 bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed,
754     float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag);
755 
756 /**
757  * @brief Approximates the path with a series of line segments.
758  *
759  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
760  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
761  * @param acceptableError Indicates the acceptable error for a line on the path. Should be no less than 0.
762  * @param vals Indicates the storage for the computed array containing point components.
763  * There are three components for each point:
764  * 1.Fraction along the length of the path that the point resides.
765  * 2.The x coordinate of the point.
766  * 3.The y coordinate of the point.
767  * @param count Returns with the size of array. The minimum size is 6.
768  * @return Returns the error code.
769  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
770  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if path or count is nullptr.
771  *         Returns {@link OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE} if acceptableError is less than 0.
772  * @since 20
773  * @version 1.0
774  */
775 OH_Drawing_ErrorCode OH_Drawing_PathApproximate(OH_Drawing_Path* path, float acceptableError, float* vals,
776     uint32_t* count);
777 
778 /**
779  * @brief Performs interpolation between the current path and another path based on a given weight, and stores the
780  * result in the target path object.
781  *
782  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
783  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
784  * @param other Indicates the pointer to an <b>OH_Drawing_Path</b> object to be interpolated with path.
785  * @param weight Indicates the interpolation weight, which must be in the range [0, 1].
786  * @param success Indicates the interpolation is success or not.
787  * @param interpolatedPath Indicates the pointer to an <b>OH_Drawing_Path</b> object to store the result.
788  * @return Returns the error code.
789  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
790  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if either path, other, success or interpolatedPath is
791  *                 nullptr.
792  *         Returns {@link OH_DRAWING_ERROR_PARAMETER_OUT_OF_RANGE} if weight is outside the range [0, 1].
793  * @since 20
794  * @version 1.0
795  */
796 OH_Drawing_ErrorCode OH_Drawing_PathInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other,
797     float weight, bool* success, OH_Drawing_Path* interpolatedPath);
798 
799 /**
800  * @brief Checks whether the current path is compatible with another path (other) for interpolation, which means
801  * they have exactly the same structure, both paths must have the same operations, in the same order.
802  * If any of the operations are of type CONIC, then the weights of those conics must also match.
803  *
804  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
805  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
806  * @param other Indicates the pointer to an <b>OH_Drawing_Path</b> object to be interpolated with path.
807  * @param result Indicates whether the current path and the other path are compatible for interpolation.
808  *               The value is true if the paths are compatible, and false otherwise.
809  * @return Returns the error code.
810  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
811  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if either path, other or result is nullptr.
812  * @since 20
813  * @version 1.0
814  */
815 OH_Drawing_ErrorCode OH_Drawing_PathIsInterpolate(OH_Drawing_Path* path, OH_Drawing_Path* other, bool* result);
816 
817 #ifdef __cplusplus
818 }
819 #endif
820 /** @} */
821 #endif
822