From 96be1c478ccb0346261dd9a4342a9e6d0e7b80d8 Mon Sep 17 00:00:00 2001 From: zhanglin Date: Wed, 16 Oct 2024 17:35:44 +0800 Subject: [PATCH] =?UTF-8?q?add=20region=20NDK=E6=8E=A5=E5=8F=A3=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhanglin --- .../native_drawing/drawing_region.h | 33 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 8 +++++ 2 files changed, 41 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index 39eb09315..0c8e65513 100644 --- a/graphic/graphic_2d/native_drawing/drawing_region.h +++ b/graphic/graphic_2d/native_drawing/drawing_region.h @@ -40,6 +40,7 @@ * @version 1.0 */ +#include "drawing_error_code.h" #include "drawing_types.h" #ifdef __cplusplus @@ -102,6 +103,21 @@ OH_Drawing_Region* OH_Drawing_RegionCreate(void); */ bool OH_Drawing_RegionContains(OH_Drawing_Region* region, int32_t x, int32_t y); +/** + * @brief Determines whether region is empty. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param cRegion Indicates the pointer to an OH_Drawing_Region object. + * @param isEmpty Indicates whether the region is empty.It is true if region is empty; + * it is false otherwise. + * @return Returns the error code {@link OH_Drawing_ErrorCode}. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if cRegion or isEmpty is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_RegionIsEmpty(OH_Drawing_Region* cRegion, bool* isEmpty); + /** * @brief Combines two regions. * @@ -127,6 +143,23 @@ bool OH_Drawing_RegionOp(OH_Drawing_Region* region, const OH_Drawing_Region* oth */ bool OH_Drawing_RegionSetRect(OH_Drawing_Region* region, const OH_Drawing_Rect* rect); +/** + * @brief Constructs a copy of an existing region. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param cRegion Indicates the pointer to an OH_Drawing_Region object. + * @param cCopy Indicates the pointer to an OH_Drawing_Region object. + * @param isRegion Indicates whether the constructed region is empty.It is true if region is not empty; + * it is false otherwise. + * @return Returns the error code {@link OH_Drawing_ErrorCode}. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of cRegion, cCopy and isRegion is nullptr. + * @since 14 + * @version 1.0 + */ +OH_Drawing_ErrorCode OH_Drawing_RegionSetRegion(OH_Drawing_Region* cRegion, const OH_Drawing_Region* cCopy, + bool* isRegion); + /** * @brief Constructs region that matchs outline of path within clip. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 3f0f7905b..4ef732a06 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1138,6 +1138,10 @@ "first_introduced": "12", "name": "OH_Drawing_RegionContains" }, + { + "first_introduced": "14", + "name": "OH_Drawing_RegionIsEmpty" + }, { "first_introduced": "12", "name": "OH_Drawing_RegionOp" @@ -1154,6 +1158,10 @@ "first_introduced": "12", "name": "OH_Drawing_RegionSetRect" }, + { + "first_introduced": "14", + "name": "OH_Drawing_RegionSetRegion" + }, { "first_introduced": "12", "name": "OH_Drawing_SetTypographyTextFontFamily" -- Gitee