From 2a8e89cd969ed637c73b300524d4c62a7ea9546c Mon Sep 17 00:00:00 2001 From: Shi Bofan Date: Sat, 13 Sep 2025 19:20:37 +0800 Subject: [PATCH] interface_capi: pixelround Signed-off-by: Shi Bofan --- arkui/ace_engine/native/libace.ndk.json | 40 ++++++++ arkui/ace_engine/native/native_node.h | 13 +++ arkui/ace_engine/native/native_type.h | 121 ++++++++++++++++++++++++ 3 files changed, 174 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index dc3d30be4c1..a2dedd045b9 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -4138,5 +4138,45 @@ { "first_introduced": "21", "name": "OH_ArkUI_ContentTransitionEffect_Create" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_Create" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_Dispose" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_SetTop" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_GetTop" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_SetStart" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_GetStart" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_SetBottom" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_GetBottom" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_SetEnd" + }, + { + "first_introduced": "21", + "name": "OH_ArkUI_PixelRoundPolicy_GetEnd" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 8404c8c7f23..f31b0c2c5cf 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -2118,6 +2118,19 @@ typedef enum { */ NODE_ALLOW_FORCE_DARK = 108, + /** + * @brief Defines the pixelRound attribute, which can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .object indicates struct of policy for pixelRound. The parameter type is {@link ArkUI_PixelRoundPolicy}. \n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .object indicates struct of policy for pixelRound. The parameter type is {@link ArkUI_PixelRoundPolicy}. \n + * + * @since 21 + */ + NODE_PIXEL_ROUND = 109, + /** * @brief Defines the text content attribute, which can be set, reset, and obtained as required through APIs. * diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 06813a6f04f..1de3dd5b4d6 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -263,6 +263,13 @@ typedef struct ArkUI_EmbeddedComponentOption ArkUI_EmbeddedComponentOption; */ typedef struct ArkUI_PositionEdges ArkUI_PositionEdges; +/** + * @brief Defines the PixelRound policy of a component's four edges. + * + * @since 21 + */ +typedef struct ArkUI_PixelRoundPolicy ArkUI_PixelRoundPolicy; + /** * @brief Defines the event callback type. * @@ -2861,6 +2868,20 @@ typedef enum { ARKUI_LAYOUTPOLICY_FIXATIDEALSIZE, } ArkUI_LayoutPolicy; +/** + * @brief Enumerates the PixelRoundPolicy. + * + * @since 21 + */ +typedef enum { + /** No Force round the component boundary coordinates to integer pixel. */ + ARKUI_PIXELROUNDCALCPOLICY_NOFORCEROUND = 0, + /** Force ceil the component boundary coordinates to integer pixel. */ + ARKUI_PIXELROUNDCALCPOLICY_FORCECEIL, + /** Force floor the component boundary coordinates to integer pixel. */ + ARKUI_PIXELROUNDCALCPOLICY_FORCEFLOOR, +} ArkUI_PixelRoundCalcPolicy; + /** * @brief Define the direction to expand the swipe action. * @@ -5605,6 +5626,106 @@ int32_t OH_ArkUI_ListItemSwipeAction_Expand(ArkUI_NodeHandle node, ArkUI_ListIte * @since 21 */ int32_t OH_ArkUI_ListItemSwipeAction_Collapse(ArkUI_NodeHandle node); + +/** + * @brief Create a policy object for PixelRound attribute. + * + * @return A pointer to the policy object. + * @since 21 + */ +ArkUI_PixelRoundPolicy* OH_ArkUI_PixelRoundPolicy_Create(); + +/** + * @brief Dispose a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object to be disposed. + * @since 21 + */ +void OH_ArkUI_PixelRoundPolicy_Dispose(ArkUI_PixelRoundPolicy* policy); + +/** + * @brief Sets the top edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of top edge. + * @since 21 + */ +void OH_ArkUI_PixelRoundPolicy_SetTop(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy value); + +/** + * @brief Gets the top edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of top edge. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PixelRoundPolicy_GetTop(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy* value); + +/** + * @brief Sets the start edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of start edge. + * @since 21 + */ +void OH_ArkUI_PixelRoundPolicy_SetStart(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy value); + +/** + * @brief Gets the start edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of start edge. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PixelRoundPolicy_GetStart(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy* value); + +/** + * @brief Sets the bottom edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of bottom edge. + * @since 21 + */ +void OH_ArkUI_PixelRoundPolicy_SetBottom(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy value); + +/** + * @brief Gets the bottom edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of bottom edge. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PixelRoundPolicy_GetBottom(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy* value); + +/** + * @brief Sets the end edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of end edge. + * @since 21 + */ +void OH_ArkUI_PixelRoundPolicy_SetEnd(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy value); + +/** + * @brief Gets the end edge of a policy object for PixelRound attribute. + * + * @param policy Pointer to the policy object. + * @param value The CalcPolicy of end edge. + * @return Returns the result code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if the parameter is invalid. + * @since 21 + */ +int32_t OH_ArkUI_PixelRoundPolicy_GetEnd(ArkUI_PixelRoundPolicy* policy, ArkUI_PixelRoundCalcPolicy* value); #ifdef __cplusplus }; #endif -- Gitee