From 8c0136dc3f6032e235bd8f2ee2f88de7875ad940 Mon Sep 17 00:00:00 2001 From: lixiaoxiang Date: Thu, 17 Apr 2025 11:59:10 +0800 Subject: [PATCH] add newDrawingCInterface Signed-off-by: --- .../native_drawing/drawing_matrix.h | 11 ++++ .../graphic_2d/native_drawing/drawing_path.h | 57 +++++++++++++++++++ .../native_drawing/drawing_region.h | 11 ++++ .../native_drawing/drawing_round_rect.h | 11 ++++ .../native_drawing/libnative_drawing.ndk.json | 28 +++++++++ 5 files changed, 118 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_matrix.h b/graphic/graphic_2d/native_drawing/drawing_matrix.h index bbf6645df..5b6fc1f66 100644 --- a/graphic/graphic_2d/native_drawing/drawing_matrix.h +++ b/graphic/graphic_2d/native_drawing/drawing_matrix.h @@ -57,6 +57,17 @@ extern "C" { */ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); +/** + * @brief Creates an OH_Drawing_Matrix copy object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @return Returns the pointer to the OH_Drawing_Matrix object created. + * @since 20 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCopy(const OH_Drawing_Matrix* matrix); + /** * @brief Creates an OH_Drawing_Matrix object with rotation. Sets matrix to * rotate by degrees about a pivot point at (px, py). diff --git a/graphic/graphic_2d/native_drawing/drawing_path.h b/graphic/graphic_2d/native_drawing/drawing_path.h index a198ec855..713456d67 100644 --- a/graphic/graphic_2d/native_drawing/drawing_path.h +++ b/graphic/graphic_2d/native_drawing/drawing_path.h @@ -171,6 +171,49 @@ OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path* path); */ void OH_Drawing_PathDestroy(OH_Drawing_Path* path); +/** + * @brief Sets OH_Drawing_Path object with the same content of another. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param other Indicates the pointer to an OH_Drawing_Path object to copy content from. + * @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 other is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathSetPath(OH_Drawing_Path* path, OH_Drawing_Path* other); + +/** + * @brief Checks if OH_Drawing_Path object is empty. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param isEmpty Indicates the return value. + * @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 isEmpty is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathIsEmpty(OH_Drawing_Path* path, bool* isEmpty); + +/** + * @brief Checks if OH_Drawing_Path represents a rectangle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param rect Indicates the Pointer to an OH_Drawing_Rect object. + * @param isRect Indicates the return value. + * @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 isRect is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathIsRect(OH_Drawing_Path* path, OH_Drawing_Rect* rect, bool* isRect); + /** * @brief Sets the start point of a path. * @@ -569,6 +612,20 @@ void OH_Drawing_PathTransformWithPerspectiveClip(OH_Drawing_Path* src, const OH_ */ void OH_Drawing_PathSetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType pathFillType); +/** + * @brief Gets FillType, the rule used to fill path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to an OH_Drawing_Path object. + * @param pathFillType Indicates the FillType apply to path. + * @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 pathFillType is nullptr. + * @since 20 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_PathGetFillType(OH_Drawing_Path* path, OH_Drawing_PathFillType* pathFillType); + /** * @brief Gets the length of the current path object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index ea27f3bce..a73a71fe8 100644 --- a/graphic/graphic_2d/native_drawing/drawing_region.h +++ b/graphic/graphic_2d/native_drawing/drawing_region.h @@ -89,6 +89,17 @@ typedef enum { */ OH_Drawing_Region* OH_Drawing_RegionCreate(void); +/** + * @brief Creates an OH_Drawing_Region copy object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param region Indicates the pointer to an OH_Drawing_Region object to copy. + * @return Returns the pointer to the OH_Drawing_Region object created. + * @since 20 + * @version 1.0 + */ +OH_Drawing_Region* OH_Drawing_RegionCopy(const OH_Drawing_Region* region); + /** * @brief Determines whether the region contains the specified coordinates. * diff --git a/graphic/graphic_2d/native_drawing/drawing_round_rect.h b/graphic/graphic_2d/native_drawing/drawing_round_rect.h index e3dec061f..f675f1ab5 100644 --- a/graphic/graphic_2d/native_drawing/drawing_round_rect.h +++ b/graphic/graphic_2d/native_drawing/drawing_round_rect.h @@ -85,6 +85,17 @@ typedef enum { */ OH_Drawing_RoundRect* OH_Drawing_RoundRectCreate(const OH_Drawing_Rect* rect, float xRad, float yRad); +/** + * @brief Creates an OH_Drawing_RoundRect copy object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param roundRect Indicates the pointer to an OH_Drawing_RoundRect object to copy. + * @return Returns the pointer to the OH_Drawing_RoundRect object created. + * @since 20 + * @version 1.0 + */ +OH_Drawing_RoundRect* OH_Drawing_RoundRectCopy(const OH_Drawing_RoundRect* roundRect); + /** * @brief Sets the radiusX and radiusY for a specific corner position. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index def91bc0d..463cdb316 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -344,6 +344,10 @@ }, { "name": "OH_Drawing_MaskFilterCreateBlur" }, { "name": "OH_Drawing_MaskFilterDestroy" }, + { + "first_introduced": "20", + "name": "OH_Drawing_MatrixCopy" + }, { "name": "OH_Drawing_MatrixCreate" }, { "name": "OH_Drawing_MatrixCreateRotation" }, { "name": "OH_Drawing_MatrixCreateScale" }, @@ -515,6 +519,22 @@ "first_introduced": "12", "name": "OH_Drawing_PathGetMatrix" }, + { + "first_introduced": "20", + "name": "OH_Drawing_PathGetFillType" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PathIsEmpty" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PathIsRect" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_PathSetPath" + }, { "first_introduced": "12", "name": "OH_Drawing_PenCopy" @@ -653,6 +673,10 @@ "first_introduced": "12", "name": "OH_Drawing_RoundRectGetCorner" }, + { + "first_introduced": "20", + "name": "OH_Drawing_RoundRectCopy" + }, { "first_introduced": "12", "name": "OH_Drawing_RoundRectSetCorner" @@ -1182,6 +1206,10 @@ "first_introduced": "12", "name": "OH_Drawing_RegionCreate" }, + { + "first_introduced": "20", + "name": "OH_Drawing_RegionCopy" + }, { "first_introduced": "12", "name": "OH_Drawing_RegionContains" -- Gitee