diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn
index 88c0459bc9fd316e2be057729c6e97d9081011e3..1252a4a4b51adae78c8f86d1799ef50d7f591bae 100644
--- a/graphic/graphic_2d/native_drawing/BUILD.gn
+++ b/graphic/graphic_2d/native_drawing/BUILD.gn
@@ -36,6 +36,7 @@ ohos_ndk_headers("native_drawing_header") {
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_memory_stream.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_path.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_path_effect.h",
+ "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_path_iterator.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_pen.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_pixel_map.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_point.h",
@@ -83,6 +84,7 @@ ohos_ndk_library("libnative_drawing_ndk") {
"native_drawing/drawing_memory_stream.h",
"native_drawing/drawing_path.h",
"native_drawing/drawing_path_effect.h",
+ "native_drawing/drawing_path_iterator.h",
"native_drawing/drawing_pen.h",
"native_drawing/drawing_pixel_map.h",
"native_drawing/drawing_point.h",
diff --git a/graphic/graphic_2d/native_drawing/drawing_path.h b/graphic/graphic_2d/native_drawing/drawing_path.h
index 3cc9269c9d8b50f10f255b4f0d108c62e9c4b8aa..996d013fa053d848eda5b182b9ff85dc060b0b8d 100644
--- a/graphic/graphic_2d/native_drawing/drawing_path.h
+++ b/graphic/graphic_2d/native_drawing/drawing_path.h
@@ -40,6 +40,7 @@
#ifndef C_INCLUDE_DRAWING_PATH_H
#define C_INCLUDE_DRAWING_PATH_H
+#include "drawing_error_code.h"
#include "drawing_types.h"
#ifdef __cplusplus
@@ -682,6 +683,20 @@ bool OH_Drawing_PathOp(OH_Drawing_Path* path, const OH_Drawing_Path* other, OH_D
bool OH_Drawing_PathGetMatrix(OH_Drawing_Path* path, bool forceClosed,
float distance, OH_Drawing_Matrix* matrix, OH_Drawing_PathMeasureMatrixFlags flag);
+/**
+ * @brief Get pathIterator from path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @param iter Indicates the pointer to an OH_Drawing_PathIterator object.
+ * @return Returns the error code.
+ * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
+ * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if path or iter is nullptr.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_PathGetPathIterator(OH_Drawing_Path* path, OH_Drawing_PathIterator* iter);
+
#ifdef __cplusplus
}
#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_path_iterator.h b/graphic/graphic_2d/native_drawing/drawing_path_iterator.h
new file mode 100644
index 0000000000000000000000000000000000000000..18c415d478a80db2b98cf6665ec3abf800cd9058
--- /dev/null
+++ b/graphic/graphic_2d/native_drawing/drawing_path_iterator.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides functions such as 2D graphics rendering, text drawing, and image display.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 8
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_path_iterator.h
+ *
+ * @brief Declares functions related to the pathiterator object in the drawing module.
+ *
+ * @kit ArkGraphics2D
+ * @library libnative_drawing.so
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @since 14
+ * @version 1.0
+ */
+
+#ifndef C_INCLUDE_DRAWING_PATH_ITERATOR_H
+#define C_INCLUDE_DRAWING_PATH_ITERATOR_H
+
+#include "drawing_error_code.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Types of operation for the path.
+ *
+ * @since 14
+ * @version 1.0
+ */
+typedef enum {
+ /** move operation */
+ PATHITERATOR_VERB_MOVE,
+ /** line operation */
+ PATHITERATOR_VERB_LINE,
+ /** quad operation */
+ PATHITERATOR_VERB_QUAD,
+ /** conic operation */
+ PATHITERATOR_VERB_CONIC,
+ /** cubic operation */
+ PATHITERATOR_VERB_CUBIC,
+ /** close operation */
+ PATHITERATOR_VERB_CLOSE,
+ /** all operations done */
+ PATHITERATOR_VERB_DONE = PATHITERATOR_VERB_CLOSE + 1
+} OH_Drawing_PathIteratorVerb;
+
+/**
+ * @brief Creates an OH_Drawing_PathIterator object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @return Returns the pointer to the OH_Drawing_PathIterator object created.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_PathIterator* OH_Drawing_PathIteratorCreate(void);
+
+/**
+ * @brief Creates an OH_Drawing_PathIterator object with path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param path Indicates the pointer to an OH_Drawing_Path object.
+ * @return Returns the pointer to the OH_Drawing_PathIterator object created.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_PathIterator* OH_Drawing_PathIteratorCreateWithPath(OH_Drawing_Path* path);
+
+/**
+ * @brief Destroys an OH_Drawing_PathIterator object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param iter Indicates the pointer to an OH_Drawing_PathIterator object.
+ * @since 14
+ * @version 1.0
+ */
+void OH_Drawing_PathIteratorDestroy(OH_Drawing_PathIterator* iter);
+
+/**
+ * @brief Get next verb in this iterator's path, and fill entries in the point2D array
+ * with point data (if any) for that operation, the point2D array size must be 4 or more.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param iter Indicates the pointer to an OH_Drawing_PathIterator object.
+ * @param points Indicates the pointer to an OH_Drawing_Point2D object.
+ * @param count Indicates the array size of the point2D, not less than offset plus 4.
+ * @param verb Indicates the next verb in this iterator's path.
+ * @param offset Indicates offset into the array where entries should be placed.
+ * @return Returns the error code.
+ * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
+ * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if count < offect + 4, iter, points or verb is nullptr.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_PathIteratorNext(OH_Drawing_PathIterator* iter,
+ OH_Drawing_Point2D* points, const uint32_t count, OH_Drawing_PathIteratorVerb* verb, int offset);
+
+/**
+ * @brief Get the next verb in the iteration, or PATHITERATOR_VERB_DONE if there are no more elements.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param iter Indicates the pointer to an OH_Drawing_PathIterator object.
+ * @param verb Indicates the next verb in the iteration.
+ * @return Returns the error code.
+ * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
+ * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if iter or verb is nullptr.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_PathIteratorPeek(OH_Drawing_PathIterator* iter, OH_Drawing_PathIteratorVerb* verb);
+
+/**
+ * @brief The determine if there are still elements in the iterator.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param iter Indicates the pointer to an OH_Drawing_PathIterator object.
+ * @param hasNext Indicates the determine if there are still elements in the iterator.
+ * @return Returns the error code.
+ * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful.
+ * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if iter is nullptr.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_ErrorCode OH_Drawing_PathIteratorHasNext(OH_Drawing_PathIterator* iter, bool* hasNext);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h
index c1bfda620328da17b8819fcd18ea0f05eb3a6e61..8588dbcbafc1fa5ed01efef72d6f9ffb3a60cf91 100644
--- a/graphic/graphic_2d/native_drawing/drawing_types.h
+++ b/graphic/graphic_2d/native_drawing/drawing_types.h
@@ -89,6 +89,14 @@ typedef struct OH_Drawing_Brush OH_Drawing_Brush;
*/
typedef struct OH_Drawing_Path OH_Drawing_Path;
+/**
+ * @brief Defines a iterator, which is used to query a given path, to discover operations and point values.
+ *
+ * @since 14
+ * @version 1.0
+ */
+typedef struct OH_Drawing_PathIterator OH_Drawing_PathIterator;
+
/**
* @brief Defines a bitmap, which is a memory that contains the pixel data of a shape.
*
diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
index 82740916529eb02214fdb23d47dee984f6cd3c4d..a1df245ce269cdf301423ab596136ae8a8ebef58 100644
--- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
+++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
@@ -438,6 +438,34 @@
"first_introduced": "12",
"name": "OH_Drawing_PathGetBounds"
},
+ {
+ "first_introduced": "14",
+ "name": "OH_Drawing_PathGetPathIterator"
+ },
+ {
+ "first_introduced": "14",
+ "name": "OH_Drawing_PathIteratorCreate"
+ },
+ {
+ "first_introduced": "14",
+ "name": "OH_Drawing_PathIteratorDestroy"
+ },
+ {
+ "first_introduced": "14",
+ "name": "OH_Drawing_PathIteratorCreateWithPath"
+ },
+ {
+ "first_introduced": "14",
+ "name": "OH_Drawing_PathIteratorNext"
+ },
+ {
+ "first_introduced": "14",
+ "name": "OH_Drawing_PathIteratorPeek"
+ },
+ {
+ "first_introduced": "14",
+ "name": "OH_Drawing_PathIteratorHasNext"
+ },
{
"first_introduced": "12",
"name": "OH_Drawing_PathGetLength"