• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 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 the start point of a path.
173  *
174  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
175  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
176  * @param x Indicates the x coordinate of the start point.
177  * @param y Indicates the y coordinate of the start point.
178  * @since 8
179  * @version 1.0
180  */
181 void OH_Drawing_PathMoveTo(OH_Drawing_Path*, float x, float y);
182 
183 /**
184  * @brief Draws a line segment from the last point of a path to the target point.
185  *
186  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
187  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
188  * @param x Indicates the x coordinate of the target point.
189  * @param y Indicates the y coordinate of the target point.
190  * @since 8
191  * @version 1.0
192  */
193 void OH_Drawing_PathLineTo(OH_Drawing_Path*, float x, float y);
194 
195 /**
196  * @brief Draws an arc to a path.
197  *
198  * This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first,
199  * and then a start angle and a sweep angle are specified.
200  * The arc is a portion of the ellipse defined by the start angle and the sweep angle.
201  * By default, a line segment from the last point of the path to the start point of the arc is also added.
202  *
203  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
204  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
205  * @param x1 Indicates the x coordinate of the upper left corner of the rectangle.
206  * @param y1 Indicates the y coordinate of the upper left corner of the rectangle.
207  * @param x2 Indicates the x coordinate of the lower right corner of the rectangle.
208  * @param y2 Indicates the y coordinate of the lower right corner of the rectangle.
209  * @param startDeg Indicates the start angle, in degrees.
210  * @param sweepDeg Indicates the angle to sweep, in degrees.
211  * @since 8
212  * @version 1.0
213  */
214 void OH_Drawing_PathArcTo(OH_Drawing_Path*, float x1, float y1, float x2, float y2, float startDeg, float sweepDeg);
215 
216 /**
217  * @brief Draws a quadratic Bezier curve from the last point of a path to the target point.
218  *
219  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
220  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
221  * @param ctrlX Indicates the x coordinate of the control point.
222  * @param ctrlY Indicates the y coordinate of the control point.
223  * @param endX Indicates the x coordinate of the target point.
224  * @param endY Indicates the y coordinate of the target point.
225  * @since 8
226  * @version 1.0
227  */
228 void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY);
229 
230 /**
231  * @brief Draws a conic from the last point of a path to the target point.
232  *
233  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
234  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
235  * @param ctrlX Indicates the x coordinate of the control point.
236  * @param ctrlY Indicates the y coordinate of the control point.
237  * @param endX Indicates the x coordinate of the target point.
238  * @param endY Indicates the y coordinate of the target point.
239  * @param weight Indicates the weight of added conic.
240  * @since 12
241  * @version 1.0
242  */
243 void OH_Drawing_PathConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight);
244 
245 /**
246  * @brief Draws a cubic Bezier curve from the last point of a path to the target point.
247  *
248  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
249  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
250  * @param ctrlX1 Indicates the x coordinate of the first control point.
251  * @param ctrlY1 Indicates the y coordinate of the first control point.
252  * @param ctrlX2 Indicates the x coordinate of the second control point.
253  * @param ctrlY2 Indicates the y coordinate of the second control point.
254  * @param endX Indicates the x coordinate of the target point.
255  * @param endY Indicates the y coordinate of the target point.
256  * @since 8
257  * @version 1.0
258  */
259 void OH_Drawing_PathCubicTo(
260     OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY);
261 
262 /**
263  * @brief Sets the relative starting point of a path.
264  *
265  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
266  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
267  * @param x Indicates the x coordinate of the relative starting point.
268  * @param y Indicates the y coordinate of the relative starting point.
269  * @since 12
270  * @version 1.0
271  */
272 void OH_Drawing_PathRMoveTo(OH_Drawing_Path*, float x, float y);
273 
274 /**
275  * @brief Draws a line segment from the last point of a path to the relative target point.
276  *
277  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
278  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
279  * @param x Indicates the x coordinate of the relative target point.
280  * @param y Indicates the y coordinate of the relative target point.
281  * @since 12
282  * @version 1.0
283  */
284 void OH_Drawing_PathRLineTo(OH_Drawing_Path*, float x, float y);
285 
286 /**
287  * @brief Draws a quadratic bezier curve from the last point of a path to the relative target point.
288  *
289  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
290  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
291  * @param ctrlX Indicates the x coordinate of the relative control point.
292  * @param ctrlY Indicates the y coordinate of the relative control point.
293  * @param endX Indicates the x coordinate of the relative target point.
294  * @param endY Indicates the y coordinate of the relative target point.
295  * @since 12
296  * @version 1.0
297  */
298 void OH_Drawing_PathRQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY);
299 
300 /**
301  * @brief Draws a conic from the last point of a path to the relative target point.
302  *
303  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
304  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
305  * @param ctrlX Indicates the x coordinate of the relative control point.
306  * @param ctrlY Indicates the y coordinate of the relative control point.
307  * @param endX Indicates the x coordinate of the relative target point.
308  * @param endY Indicates the y coordinate of the relative target point.
309  * @param weight Indicates the weight of added conic.
310  * @since 12
311  * @version 1.0
312  */
313 void OH_Drawing_PathRConicTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float endX, float endY, float weight);
314 
315 /**
316  * @brief Draws a cubic bezier curve from the last point of a path to the relative target point.
317  *
318  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
319  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
320  * @param ctrlX1 Indicates the x coordinate of the first relative control point.
321  * @param ctrlY1 Indicates the y coordinate of the first relative control point.
322  * @param ctrlX2 Indicates the x coordinate of the second relative control point.
323  * @param ctrlY2 Indicates the y coordinate of the second relative control point.
324  * @param endX Indicates the x coordinate of the relative target point.
325  * @param endY Indicates the y coordinate of the relative target point.
326  * @since 12
327  * @version 1.0
328  */
329 void OH_Drawing_PathRCubicTo(OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2,
330     float endX, float endY);
331 
332 /**
333  * @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction.
334  *
335  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
336  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
337  * @param left Indicates the left coordinate of the upper left corner of the rectangle.
338  * @param top Indicates the top coordinate of the upper top corner of the rectangle.
339  * @param right Indicates the right coordinate of the lower right corner of the rectangle.
340  * @param bottom Indicates the bottom coordinate of the lower bottom corner of the rectangle.
341  * @param OH_Drawing_PathDirection Indicates the path direction.
342  * @since 12
343  * @version 1.0
344  */
345 void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top, float right, float bottom,
346     OH_Drawing_PathDirection);
347 
348 /**
349  * @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction.
350  *
351  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
352  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
353  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
354  * @param OH_Drawing_PathDirection Indicates the path direction.
355  * @param start Indicates initial corner of rect to add.
356  * @since 12
357  * @version 1.0
358  */
359 void OH_Drawing_PathAddRectWithInitialCorner(OH_Drawing_Path*, const OH_Drawing_Rect*,
360     OH_Drawing_PathDirection, uint32_t start);
361 
362 /**
363  * @brief Adds a new contour to the path, defined by the round rect, and wound in the specified direction.
364  *
365  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
366  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
367  * @param OH_Drawing_RoundRect Indicates the pointer to an <b>OH_Drawing_RoundRect</b> object.
368  * @param OH_Drawing_PathDirection Indicates the path direction.
369  * @since 12
370  * @version 1.0
371  */
372 void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection);
373 
374 /**
375  * @brief Adds a oval to the path, defined by the rect, and wound in the specified direction.
376  *
377  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
378  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
379  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
380  * @param start Index of initial point of ellipse.
381  * @param OH_Drawing_PathDirection Indicates the path direction.
382  * @since 12
383  * @version 1.0
384  */
385 void OH_Drawing_PathAddOvalWithInitialPoint(OH_Drawing_Path*, const OH_Drawing_Rect*,
386     uint32_t start, OH_Drawing_PathDirection);
387 
388 /**
389  * @brief Appends arc to path, as the start of new contour.Arc added is part of ellipse bounded by oval,
390  * from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees
391  * is aligned with the positive x-axis, and positive sweeps extends arc clockwise.If sweepAngle <= -360, or
392  * sweepAngle >= 360; and startAngle modulo 90 is nearly zero, append oval instead of arc. Otherwise, sweepAngle
393  * values are treated modulo 360, and arc may or may not draw depending on numeric rounding.
394  *
395  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
396  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
397  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
398  * @param startAngle Indicates the starting angle of arc in degrees.
399  * @param sweepAngle Indicates the sweep, in degrees. Positive is clockwise.
400  * @since 12
401  * @version 1.0
402  */
403 void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle);
404 
405 /**
406  * @brief Appends src path to path, transformed by matrix. Transformed curves may have different verbs,
407  * point, and conic weights.
408  *
409  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
410  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
411  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
412  * @param OH_Drawing_Matrix Indicates the length of the <b>OH_Drawing_Matrix</b> object.
413  * @since 12
414  * @version 1.0
415  */
416 void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const OH_Drawing_Matrix*);
417 
418 /**
419  * @brief Appends src path to path, transformed by matrix and mode. Transformed curves may have different verbs,
420  * point, and conic weights.
421  *
422  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
423  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
424  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
425  * @param OH_Drawing_Matrix Indicates the length of the <b>OH_Drawing_Matrix</b> object.
426  * @param OH_Drawing_PathAddMode Indicates the add path's add mode.
427  * @since 12
428  * @version 1.0
429  */
430 void OH_Drawing_PathAddPathWithMatrixAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src,
431     const OH_Drawing_Matrix*, OH_Drawing_PathAddMode);
432 
433 /**
434  * @brief Appends src path to path, transformed by mode. Transformed curves may have different verbs,
435  * point, and conic weights.
436  *
437  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
438  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
439  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object, which is Appends src path to path.
440  * @param OH_Drawing_PathAddMode Indicates the add path's add mode.
441  * @since 12
442  * @version 1.0
443  */
444 void OH_Drawing_PathAddPathWithMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, OH_Drawing_PathAddMode);
445 
446 /**
447  * @brief Appends src path to path, transformed by offset and mode. Transformed curves may have different verbs,
448  * point, and conic weights.
449  *
450  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
451  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
452  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
453  * @param dx Indicates offset added to src path x-axis coordinates.
454  * @param dy Indicates offset added to src path y-axis coordinates.
455  * @param OH_Drawing_PathAddMode Indicates the add path's add mode.
456  * @since 12
457  * @version 1.0
458  */
459 void OH_Drawing_PathAddPathWithOffsetAndMode(OH_Drawing_Path* path, const OH_Drawing_Path* src, float dx, float dy,
460     OH_Drawing_PathAddMode);
461 
462 /**
463  * @brief Adds a oval to the path, defined by the rect, and wound in the specified direction.
464  *
465  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
466  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
467  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
468  * @param OH_Drawing_PathDirection Indicates the path direction.
469  * @since 12
470  * @version 1.0
471  */
472 void OH_Drawing_PathAddOval(OH_Drawing_Path*, const OH_Drawing_Rect*, OH_Drawing_PathDirection);
473 
474 /**
475  * @brief Adds contour created from point array, adding (count - 1) line segments.
476  *
477  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
478  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
479  * @param points Indicates the point array.
480  * @param count Indicates the size of point array.
481  * @param isClosed Indicates Whether to add lines that connect the end and start.
482  * @since 12
483  * @version 1.0
484  */
485 void OH_Drawing_PathAddPolygon(OH_Drawing_Path* path, const OH_Drawing_Point2D* points, uint32_t count, bool isClosed);
486 
487 /**
488  * @brief  Adds a circle to the path, and wound in the specified direction.
489  *
490  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
491  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
492  * @param x Indicates the x coordinate of the center of the circle.
493  * @param y Indicates the y coordinate of the center of the circle.
494  * @param radius Indicates the radius of the circle.
495  * @param OH_Drawing_PathDirection Indicates the path direction.
496  * @since 12
497  * @version 1.0
498  */
499 void OH_Drawing_PathAddCircle(OH_Drawing_Path* path, float x, float y, float radius, OH_Drawing_PathDirection);
500 
501 /**
502  * @brief Parses the svg path from the string.
503  *
504  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
505  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
506  * @param str Indicates the string of the SVG path.
507  * @return Returns true if build path is successful, returns false otherwise.
508  * @since 12
509  * @version 1.0
510  */
511 bool OH_Drawing_PathBuildFromSvgString(OH_Drawing_Path* path, const char* str);
512 
513 /**
514  * @brief Return the status that point (x, y) is contained by path.
515  *
516  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
517  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
518  * @param x Indicates the x-axis value of containment test.
519  * @param y Indicates the y-axis value of containment test.
520  * @return Returns true if the point (x, y) is contained by path.
521  * @since 12
522  * @version 1.0
523  */
524 bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y);
525 
526 /**
527  * @brief Transforms verb array, point array, and weight by matrix. transform may change verbs
528  * and increase their number. path is replaced by transformed data.
529  *
530  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
531  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
532  * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
533  * @since 12
534  * @version 1.0
535  */
536 void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*);
537 
538 /**
539  * @brief Transforms verb array, point array, and weight by matrix.
540  * Transform may change verbs and increase their number.
541  *
542  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
543  * @param src Indicates the pointer to an <b>OH_Drawing_Path</b> object.
544  * @param OH_Drawing_Matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
545  * @param dst Indicates the pointer to an <b>OH_Drawing_Path</b> object.
546  * @param applyPerspectiveClip Indicates whether to apply perspective clip.
547  * @since 12
548  * @version 1.0
549  */
550 void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_Drawing_Matrix*,
551     OH_Drawing_Path* dst, bool applyPerspectiveClip);
552 
553 /**
554  * @brief Sets FillType, the rule used to fill path.
555  *
556  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
557  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
558  * @param OH_Drawing_PathFillType Indicates the add path's fill type.
559  * @since 12
560  * @version 1.0
561  */
562 void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType);
563 
564 /**
565  * @brief Gets the length of the current path object.
566  *
567  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
568  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
569  * @param forceClosed Indicates whether free to modify/delete the path after this call.
570  * @return Returns the length of the current path object.
571  * @since 12
572  * @version 1.0
573  */
574 float OH_Drawing_PathGetLength(OH_Drawing_Path*, bool forceClosed);
575 
576 /**
577  * @brief Gets the smallest bounding box that contains the path.
578  *
579  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
580  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
581  * @param OH_Drawing_Rect Indicates the pointer to an <b>OH_Drawing_Rect</b> object.
582  * @since 12
583  * @version 1.0
584  */
585 void OH_Drawing_PathGetBounds(OH_Drawing_Path*, OH_Drawing_Rect*);
586 
587 /**
588  * @brief Closes a path. A line segment from the start point to the last point of the path is added.
589  *
590  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
591  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
592  * @since 8
593  * @version 1.0
594  */
595 void OH_Drawing_PathClose(OH_Drawing_Path*);
596 
597 /**
598  * @brief Offset path replaces dst.
599  *
600  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
601  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
602  * @param dst Indicates the pointer to an <b>OH_Drawing_Path</b> object.
603  * @param dx Indicates offset added to dst path x-axis coordinates.
604  * @param dy Indicates offset added to dst path y-axis coordinates.
605  * @since 12
606  * @version 1.0
607  */
608 void OH_Drawing_PathOffset(OH_Drawing_Path* path, OH_Drawing_Path* dst, float dx, float dy);
609 
610 /**
611  * @brief Resets path data.
612  *
613  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
614  * @param OH_Drawing_Path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
615  * @since 8
616  * @version 1.0
617  */
618 void OH_Drawing_PathReset(OH_Drawing_Path*);
619 
620 /**
621  * @brief Determines whether the path current contour is closed.
622  *
623  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
624  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
625  * @param forceClosed Whether to close the Path.
626  * @return Returns <b>true</b> if the path current contour is closed; returns <b>false</b> otherwise.
627  * @since 12
628  * @version 1.0
629  */
630 bool OH_Drawing_PathIsClosed(OH_Drawing_Path* path, bool forceClosed);
631 
632 /**
633  * @brief Gets the position and tangent of the distance from the starting position of the Path.
634  *
635  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
636  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
637  * @param forceClosed Whether to close the Path.
638  * @param distance The distance from the start of the Path.
639  * @param position Sets to the position of distance from the starting position of the Path.
640  * @param tangent Sets to the tangent of distance from the starting position of the Path.
641  * @return Returns <b>true</b> if succeeded; returns <b>false</b> otherwise.
642  * @since 12
643  * @version 1.0
644  */
645 bool OH_Drawing_PathGetPositionTangent(OH_Drawing_Path* path, bool forceClosed,
646     float distance, OH_Drawing_Point2D* position, OH_Drawing_Point2D* tangent);
647 
648 /**
649  * @brief Gets the path between the start and end points.
650  *
651  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
652  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
653  * @param forceClosed Whether to close the path.
654  * @param start The distance from the starting point of the segment to the starting point of the path.
655  * @param stop The distance from the end point of the segment to the starting point of the path.
656  * @param startWithMoveTo Whether the path obtained moveTo to the starting segment.
657  * @param dst The path obtained.
658  * @param result Indicates the result of getting the path segment.
659  *               The value is false if the segment is zero-length or start >= stop, and true otherwise.
660  * @return Returns the error code.
661  *         Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
662  *         Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of path, dst and result is nullptr.
663  * @since 18
664  * @version 1.0
665  */
666 OH_Drawing_ErrorCode OH_Drawing_PathGetSegment(OH_Drawing_Path* path, bool forceClosed,
667     float start, float stop, bool startWithMoveTo, OH_Drawing_Path* dst, bool* result);
668 
669 /**
670  * @brief Combines two paths.
671  *
672  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
673  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
674  * @param srcPath Indicates the pointer to an <b>OH_Drawing_Path</b> object.
675  * @param op Indicates the operation to apply to combine.
676  * @return Returns <b>true</b> if constructed path is not empty; returns <b>false</b> otherwise.
677  * @since 12
678  * @version 1.0
679  */
680 bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* srcPath, OH_Drawing_PathOpMode op);
681 
682 /**
683  * @brief Computes the corresponding matrix at the specified distance.
684  *
685  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
686  * @param path Indicates the pointer to an <b>OH_Drawing_Path</b> object.
687  * @param forceClosed Whether to close the Path.
688  * @param distance The distance from the start of the Path.
689  * @param matrix Indicates the pointer to an <b>OH_Drawing_Matrix</b> object.
690  * @param flag Indicates what should be returned in the matrix.
691  * @return Returns <b>false</b> if path is nullptr or zero-length;
692  *         returns <b>true</b> if path is not nullptr and not zero-length.
693  * @since 12
694  * @version 1.0
695  */
696 bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed,
697     float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag);
698 
699 #ifdef __cplusplus
700 }
701 #endif
702 /** @} */
703 #endif
704