From 24f8740547b53e48ba699ef3e67d286724479f3b Mon Sep 17 00:00:00 2001 From: liyujie Date: Wed, 13 Aug 2025 17:15:42 +0800 Subject: [PATCH] Add image interface to native node and native type Signed-off-by: liyujie Change-Id: I141a2160815e136e55963e6cf58029294a529632 --- arkui/ace_engine/native/native_node.h | 190 ++++++++++++++++++++------ arkui/ace_engine/native/native_type.h | 42 +++++- 2 files changed, 190 insertions(+), 42 deletions(-) diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index 61d93ed4c9e..600a219ea12 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -1380,7 +1380,7 @@ typedef enum { * @brief Defines the focused state. This attribute can be set and obtained as required through APIs. * @note Setting the parameter to 0 shifts focus from the currently focused component on the current level * of the page to the root container. - * + * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: The parameter type is 1 or 0. * \n @@ -1865,7 +1865,7 @@ typedef enum { * @since 14 */ NODE_TAB_STOP = 98, - + /** * @brief Defines the backdrop blur attribute, which can be set, reset, and obtained as required through APIs. * @@ -2756,6 +2756,114 @@ typedef enum { * @since 20 */ NODE_IMAGE_SYNC_LOAD = 4012, + /** + * @brief Defines the image decoding size attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: width of the image decoding, in px.\n + * .value[1].i32: height of the image decoding, in px.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: width of the image decoding, in px.\n + * .value[1].i32: height of the image decoding, in px.\n + * + * @since 21 + */ + NODE_IMAGE_SOURCE_SIZE = 4013, + /** + * @brief Defines the display tranformation matrix for an image. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0...15].f32: 16 floating-point numbers.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0...15].f32: 16 floating-point numbers.\n + * + * @since 21 + */ + NODE_IMAGE_IMAGE_MATRIX = 4014, + /** + * @brief Defines the image follow text direction attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to follows the text direction.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to follows the text direction.\n + * + * @since 21 + */ + NODE_IMAGE_MATCH_TEXT_DIRECTION = 4015, + /** + * @brief Defines the image copy attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: copy option {@link ArkUI_CopyOptions}. The default value is ARKUI_COPY_OPTIONS_NONE.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: copy option {@link ArkUI_CopyOptions.\n + * + * @since 21 + */ + NODE_IMAGE_COPY_OPTION = 4016, + /** + * @brief Defines the image AI analysis enable attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: whether to enable AI analysis for the image.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: whether to enable AI analysis for the image.\n + * + * @since 21 + */ + NODE_IMAGE_ENABLE_ANALYZER = 4017, + /** + * @brief Defines the image dynamic display range attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: dynamic range mode {@link ArkUI_DynamicRangeMode}. + * The default value is ARKUI_DYNAMIC_RANGE_MODE_STANDARD.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: dynamic range mode {@link ArkUI_DynamicRangeMode.\n + * + * @since 21 + */ + NODE_IMAGE_DYNAMIC_RANGE_MODE = 4018, + /** + * @brief Defines the image dynamic display brightness attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].f32: hdr brightness. value range [0, 1]\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].f32: hdr brightness. value range [0, 1]\n + * + * @since 21 + */ + NODE_IMAGE_HDR_BRIGHTNESS = 4019, + /** + * @brief Defines the image display direction attribute. + * This attribute can be set, reset, and obtained as required through APIs. + * + * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n + * .value[0].i32: orientation {@link ArkUI_Orientation}. + * The default value is ARKUI_ORIENTATION_UP.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem}:\n + * .value[0].i32: orientation {@link ArkUI_Orientation.\n + * + * @since 21 + */ + NODE_IMAGE_ORIENTATION = 4020, /** * @brief Defines the color of the component when it is selected. * This attribute can be set, reset, and obtained as required through APIs. @@ -3150,7 +3258,7 @@ typedef enum { * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * In the case of setting the caret position: * .value[0].i32: character count from the beginning of a string to the caret position. \n - * + * * Format of the return value {@link ArkUI_AttributeItem}:\n * In the case of obtaining the caret position: If this API is called when the caret position is updated in the * current frame, it will not take effect. @@ -3161,7 +3269,7 @@ typedef enum { NODE_TEXT_INPUT_CARET_OFFSET, /** * @brief Obtains the position of the edited text area relative to the component and its size. - * + * * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: horizontal coordinate. \n * .value[1].f32: vertical coordinate. \n @@ -3172,7 +3280,7 @@ typedef enum { NODE_TEXT_INPUT_CONTENT_RECT, /** * @brief Obtains the number of lines of the edited text. - * + * * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: number of lines of the edited text. \n * @@ -3181,7 +3289,7 @@ typedef enum { /** * @brief Sets whether to hide the text selection menu when the text box is long-pressed, double-click, or * right-clicked. This attribute can be set, reset, and obtained as required through APIs. - * + * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: whether to hide the text selection menu when the text box is long-pressed, double-click, or * right-clicked. The default value is false. \n @@ -3318,7 +3426,7 @@ typedef enum { * @since 20 */ NODE_TEXT_INPUT_ENABLE_FILL_ANIMATION = 7036, - + /** * @brief Set the line height of the input node. * This attribute can be set, reset, and obtained as required through APIs. @@ -3473,7 +3581,7 @@ typedef enum { NODE_TEXT_AREA_SELECTION_MENU_HIDDEN, /** * @brief Sets whether the multi-line text box loses focus after the Enter key is pressed to submit information. - * + * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32: whether the text box loses focus. \n * \n @@ -3550,7 +3658,7 @@ typedef enum { NODE_TEXT_AREA_CARET_OFFSET, /** * @brief Obtains the position of the edited text area relative to the component and its size. - * + * * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].f32: horizontal coordinate. \n * .value[1].f32: vertical coordinate. \n @@ -3561,7 +3669,7 @@ typedef enum { NODE_TEXT_AREA_CONTENT_RECT, /** * @brief Obtains the number of lines of the edited text. - * + * * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: number of lines of the edited text. \n * @@ -3717,10 +3825,10 @@ typedef enum { * .value[0].i32: min line count.\n * * @since 20 - * + * */ NODE_TEXT_AREA_MIN_LINES = 8029, - + /** * @brief Set the max lines of the node with scroll. * This attribute can be set, reset, and obtained as required through APIs. @@ -3874,7 +3982,7 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The value 1 means that the check box is selected, and 0 means the opposite. \n - * + * */ NODE_CHECKBOX_SELECT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX, @@ -3900,7 +4008,7 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: border color, in 0xARGB format, for example, 0xFF1122FF. - * + * */ NODE_CHECKBOX_UNSELECT_COLOR, @@ -5052,7 +5160,7 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .string: component name. \n - * + * * @since 15 */ NODE_CHECKBOX_GROUP_NAME = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX_GROUP, @@ -5067,7 +5175,7 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].i32: The value 1 means that the checkboxgroup is selected, and 0 means the opposite. \n - * + * * @since 15 */ NODE_CHECKBOX_GROUP_SELECT_ALL, @@ -5095,7 +5203,7 @@ typedef enum { * \n * Format of the return value {@link ArkUI_AttributeItem}:\n * .value[0].u32: border color, in 0xARGB format, for example, 0xFF1122FF. - * + * * @since 15 */ NODE_CHECKBOX_GROUP_UNSELECTED_COLOR, @@ -5348,7 +5456,7 @@ typedef enum { /** * @brief Scroll to the next or previous page. - * + * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].i32 Indicates whether to scroll to next page. Value 0 indicates scroll to next page and value 1 * indicates scroll to previous page. \n @@ -5359,7 +5467,7 @@ typedef enum { /** * @brief Scroll a specified distance. - * + * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].f32:Horizontal scrolling distance in vp; \n * .value[1].f32: Vertical scrolling distance in vp; \n @@ -5369,7 +5477,7 @@ typedef enum { /** * @brief Performs inertial scrolling based on the initial velocity passed in. - * + * * Format of the {@link ArkUI_AttributeItem} parameter for setting the attribute:\n * .value[0].f32: Initial velocity of inertial scrolling. Unit: vp/s. If the value specified is 0, it is * considered as invalid, and the scrolling for this instance will not take effect. If the value is positive, @@ -5619,7 +5727,7 @@ typedef enum { /** * @brief Scroll to the specified index. - * + * * When activating the smooth animation, all items passed through will be loaded and layout calculated, which can * lead to performance issues when loading a large number of items.\n * \n @@ -5778,7 +5886,7 @@ typedef enum { * @since 19 */ NODE_LIST_STACK_FROM_END = 1003014, - + /** * @brief Defines the focus wrap mode for the List component. * This attribute can be set, reset, and obtained as required through APIs. @@ -6541,7 +6649,7 @@ typedef enum { /** * @brief Scroll to the specified index. - * + * * When activating the smooth animation, all items passed through will be loaded and layout calculated, which can * lead to performance issues when loading a large number of items.\n * \n @@ -7102,7 +7210,7 @@ typedef enum { * device. \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_NodeComponentEvent}. \n - * + * * @since 14 */ NODE_ON_KEY_EVENT = 21, @@ -7116,7 +7224,7 @@ typedef enum { * device. \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_NodeComponentEvent}. \n - * + * * @since 14 */ NODE_ON_KEY_PRE_IME = 22, @@ -7126,7 +7234,7 @@ typedef enum { * The event callback is triggered by interactions with a joystick and a focused component. \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_UIInputEvent}. \n - * + * * @since 15 */ NODE_ON_FOCUS_AXIS = 23, @@ -7138,7 +7246,7 @@ typedef enum { * children. \n * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_NodeComponentEvent}. \n - * + * * @since 15 */ NODE_DISPATCH_KEY_EVENT = 24, @@ -7148,7 +7256,7 @@ typedef enum { * * When the event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is * {@link ArkUI_UIInputEvent}. \n - * + * * @since 17 */ NODE_ON_AXIS = 25, @@ -7195,7 +7303,7 @@ typedef enum { /** * @brief Defines the hover event. - * + * * The event is triggered when the pointer is hovered by a pen device. * within the component. \n * When the event callback occurs, the {@link ArkUI_NodeEvent} object can be obtained from the @@ -7476,7 +7584,7 @@ typedef enum { * ArkUI_TextChangeEvent.pStr: content in the TextInput component. * ArkUI_TextChangeEvent.pExtendStr: content of the preview text in the TextInput component. * ArkUI_TextChangeEvent.number: start position of the preview text in the TextInput component. - * + * * @since 20 */ NODE_TEXT_INPUT_ON_WILL_CHANGE = 7014, @@ -7794,7 +7902,7 @@ typedef enum { * */ NODE_IMAGE_ANIMATOR_EVENT_ON_FINISH = 19004, - + /** * @brief Defines the callback triggered when the selected status of the ARKUI_NODE_CHECKBOX_GROOUP * or checkbox changes. @@ -7811,7 +7919,7 @@ typedef enum { * @since 15 */ NODE_CHECKBOX_GROUP_EVENT_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_CHECKBOX_GROUP, - + /** * @brief Defines the event triggered when the index of the currently displayed element of this * ARKUI_NODE_SWIPER instance changes. @@ -7892,7 +8000,7 @@ typedef enum { /** * @brief Defines the event triggered when the selected index of the ARKUI_NODE_SWIPER changed. - * + * * This event is triggered under the following scenarios: \n * 1. When the page switching animation starts after the user lifts their finger after swiping and the swipe meets * the threshold for page turning. \n @@ -7902,14 +8010,14 @@ typedef enum { * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains one parameter:\n * ArkUI_NodeComponentEvent.data[0].i32: index of the currently selected element. \n - * + * * @since 18 */ NODE_SWIPER_EVENT_ON_SELECTED = 1001005, /** * @brief Defines the event triggered when the selected index of the ARKUI_NODE_SWIPER changed. - * + * * This event is triggered under the following scenarios: \n * 1. When the page switching animation starts after the user lifts their finger after swiping and the swipe meets * the threshold for page turning. \n @@ -7919,7 +8027,7 @@ typedef enum { * {@link ArkUI_NodeComponentEvent}. \n * {@link ArkUI_NodeComponentEvent} contains one parameter:\n * ArkUI_NodeComponentEvent.data[0].i32: the index of the element becomes unselected. \n - * + * * @since 18 */ NODE_SWIPER_EVENT_ON_UNSELECTED = 1001006, @@ -8351,7 +8459,7 @@ ArkUI_NodeComponentEvent* OH_ArkUI_NodeEvent_GetNodeComponentEvent(ArkUI_NodeEve /** * @brief Obtains the string data in a component event. - * + * * @param event Indicates the pointer to the component event. * @return Returns the pointer to the string data. * @since 12 @@ -9310,7 +9418,7 @@ int32_t OH_ArkUI_NodeCustomEvent_GetCustomSpanDrawInfo( /** * @brief Defines the node content event type. - * + * * @since 12 */ typedef enum { @@ -9620,7 +9728,7 @@ int32_t OH_ArkUI_NodeUtils_GetNodeType(ArkUI_NodeHandle node); * @since 15 */ int32_t OH_ArkUI_NodeUtils_GetWindowInfo(ArkUI_NodeHandle node, ArkUI_HostWindowInfo** info); - + /** * @brief Obtains the index of the current FrameNode's first child node which is on the tree. * @@ -9829,7 +9937,7 @@ int32_t OH_ArkUI_RegisterLayoutCallbackOnNodeHandle(ArkUI_NodeHandle node, */ int32_t OH_ArkUI_RegisterDrawCallbackOnNodeHandle(ArkUI_NodeHandle node, void* userData, void (*onDrawCompleted)(void* userData)); - + /** * @brief Unregisters the layout completed callback for node. * @@ -9919,7 +10027,7 @@ ArkUI_ErrorCode OH_ArkUI_AddSupportedUIStates(ArkUI_NodeHandle node, int32_t uiS /** * @brief Removes registered UI states. When all states registered using OH_ArkUI_AddSupportedUIStates * are removed, the registered stateChangeHandler will no longer be executed. - * + * * @param node Target node. * @param uiStates Target UI states to be removed. * @return Returns the result code. diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index 3bfa0c36dc2..227d9528667 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -1374,6 +1374,46 @@ typedef enum { ARKUI_IMAGE_INTERPOLATION_HIGH, } ArkUI_ImageInterpolation; +/** + * @brief Enumerates the image dynamic range mode. + * + * @since 21 + */ +typedef enum { + /** high dynamic range mode. */ + ARKUI_DYNAMIC_RANGE_MODE_HIGHT = 0, + /** constraint dynamic range mode. */ + ARKUI_DYNAMIC_RANGE_MODE_CONSTRAINT, + /** standard dynamic range mode. */ + ARKUI_DYNAMIC_RANGE_MODE_STANDARD, +} ArkUI_DynamicRangeMode; + +/** + * @brief Enumerates the image rotate orientation. + * + * @since 21 + */ +typedef enum { + /** Use EXIF metadata for display orientation, with support for rotation and mirroring. */ + ARKUI_ORIENTATION_AUTO = 0, + /** Display original pixel data without transformation. */ + ARKUI_ORIENTATION_UP, + /** Display the image after rotating it 90 degrees clockwise. */ + ARKUI_ORIENTATION_RIGHT, + /** Display the image after rotating it 180 degrees clockwise. */ + ARKUI_ORIENTATION_DOWN, + /** Display the image after rotating it 270 degrees clockwise. */ + ARKUI_ORIENTATION_LEFT, + /** Display the image after flipping it horizontally. */ + ARKUI_ORIENTATION_UP_MIRRORED, + /** Display the image after flipping it horizontally and then rotating it 90 degrees clockwise. */ + ARKUI_ORIENTATION_RIGHT_MIRRORED, + /** Display the image after flipping it vertically. */ + ARKUI_ORIENTATION_DOWN_MIRRORED, + /** Display the image after flipping it horizontally and then rotating it 270 degrees clockwise. */ + ARKUI_ORIENTATION_LEFT_MIRRORED, +} ArkUI_ImageRotateOrientation; + /** * @brief Enumerates the blend modes. * @@ -2748,7 +2788,7 @@ typedef enum { /** Set bottom edge derection. */ ARKUI_EDGE_DIRECTION_BOTTOM, } ArkUI_EdgeDirection; - + /** * @brief Enumerates the corner derection. * -- Gitee