From cae5caa6d959a1e5571566bb2bcad94b674c3cdc Mon Sep 17 00:00:00 2001 From: yangfan229 Date: Fri, 25 Jul 2025 16:54:53 +0800 Subject: [PATCH] add clip rect shape with offset Signed-off-by: yangfan229 Change-Id: Ia01c75d80756b63d4081949cc3bf02cb3c6ecaa0 --- arkui/ace_engine/native/native_type.h | 95 +++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 14df29f5c..91a6d2aa4 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -256,6 +256,13 @@ typedef struct AbilityBase_Want AbilityBase_Want; */ typedef struct ArkUI_EmbeddedComponentOption ArkUI_EmbeddedComponentOption; +/** + * @brief Define the RectShape used for clip. + * + * @since 22 + */ +typedef struct ArkUI_RectShape ArkUI_RectShape; + /** * @brief Defines the event callback type. * @@ -5252,6 +5259,94 @@ void OH_ArkUI_EmbeddedComponentOption_SetOnError( */ void OH_ArkUI_EmbeddedComponentOption_SetOnTerminated( ArkUI_EmbeddedComponentOption* option, void (*callback)(int32_t code, AbilityBase_Want* want)); + +/** + * @brief creates the rect shape. + * + * @return Rect shape information. + * @since 22 + */ +ArkUI_RectShape* OH_ArkUI_RectShape_Create(void); + +/** + * @brief Destroys the rect shape. + * + * @param shape Pointer to the object by the RectShape to be destroyed. + * @since 22 + */ +void OH_ArkUI_RectShape_Dispose(ArkUI_RectShape* shape); + +/** + * @brief Set the radius width for the rect shape. The unit is vp. + * + * @param shape Indicates the pointer to the RectShape. + * @param width Indicates the radius width of the rect. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 22 + */ +int32_t OH_ArkUI_RectShape_SetRadiusWidth(ArkUI_RectShape* shape, float width); + +/** + * @brief Set the radius height for the rect shape. The unit is vp. + * + * @param shape Indicates the pointer to the RectShape. + * @param height Indicates the radius height of the rect. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 22 + */ +int32_t OH_ArkUI_RectShape_SetRadiusHeight(ArkUI_RectShape* shape, float height); + +/** + * @brief Set the radius for the rect shape. The unit is vp. + * + * @param shape Indicates the pointer to the RectShape. + * @param topLeft Indicates the topLeft radius of the rect. + * @param topRight Indicates the topRight radius of the rect. + * @param bottomLeft Indicates the bottomLeft radius of the rect. + * @param bottomRight Indicates the bottomRight radius of the rect. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 22 + */ +int32_t OH_ArkUI_RectShape_SetRadius(ArkUI_RectShape* shape, float topLeft, float topRight, + float bottomLeft, float bottomRight); + +/** + * @brief Set the width for the rect shape. The unit is vp. + * + * @param shape Indicates the pointer to the RectShape. + * @param width Indicates the width of the rect. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 22 + */ +int32_t OH_ArkUI_RectShape_SetWidth(ArkUI_RectShape* shape, float width); + +/** + * @brief Set the height for the rect shape. The unit is vp. + * + * @param shape Indicates the pointer to the RectShape. + * @param height Indicates the height of the rect. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 22 + */ +int32_t OH_ArkUI_RectShape_SetHeight(ArkUI_RectShape* shape, float height); + +/** + * @brief Set the offset for the rect shape. The unit is vp. + * + * @param shape Indicates the pointer to the RectShape. + * @param x Indicates the x-axis offset of the rect. + * @param y Indicates the y-axis offset of the rect. + * @return Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. + * @since 22 + */ +int32_t OH_ArkUI_RectShape_SetOffset(ArkUI_RectShape* shape, float x, float y); + #ifdef __cplusplus }; #endif -- Gitee