diff --git a/graphic/graphic_2d/native_drawing/drawing_region.h b/graphic/graphic_2d/native_drawing/drawing_region.h index 39eb09315f1966fd014b9e50d8220cb145a6eac9..0c8e65513b200344ed5756ffff88d0d3e6c12d15 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 3f0f7905b62de328131d4b4575952e30497f76c1..4ef732a064da94b7268ed872339b55a22db8ab71 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"