diff --git a/ark_runtime/jsvm/libjsvm.ndk.json b/ark_runtime/jsvm/libjsvm.ndk.json index 1e74dcc9f..96e0e36dc 100644 --- a/ark_runtime/jsvm/libjsvm.ndk.json +++ b/ark_runtime/jsvm/libjsvm.ndk.json @@ -171,10 +171,6 @@ "first_introduced": "11", "name": "OH_JSVM_CreateExternal" }, - { - "first_introduced": "11", - "name": "OH_JSVM_CreateExternalArraybuffer" - }, { "first_introduced": "11", "name": "OH_JSVM_CreateObject" @@ -495,10 +491,6 @@ "first_introduced": "11", "name": "OH_JSVM_AddFinalizer" }, - { - "first_introduced": "11", - "name": "OH_JSVM_PostFinalizer" - }, { "first_introduced": "11", "name": "OH_JSVM_GetVersion" diff --git a/arkui/ace_engine/native/BUILD.gn b/arkui/ace_engine/native/BUILD.gn index fc81f3125..d29b8ce34 100644 --- a/arkui/ace_engine/native/BUILD.gn +++ b/arkui/ace_engine/native/BUILD.gn @@ -23,6 +23,16 @@ if (!is_arkui_x) { ] } + ohos_ndk_headers("arkui_header") { + dest_dir = "$ndk_headers_out_dir/arkui/" + sources = [ + "native_event.h", + "native_interface.h", + "native_node.h", + "native_type.h", + ] + } + ohos_ndk_library("libace_ndk") { ndk_description_file = "./libace.ndk.json" min_compact_version = "7" diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index c8af1edc1..90e2f0ae3 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -90,5 +90,17 @@ { "first_introduced": "11", "name": "OH_NativeXComponent_UnregisterOnFrameCallback" + }, + { + "first_introduced": "12", + "name": "OH_NativeXComponent_AttachNativeRootNode" + }, + { + "first_introduced": "12", + "name": "OH_NativeXComponent_DetachNativeRootNode" + }, + { + "first_introduced": "12", + "name": "OH_ArkUI_GetNativeAPI" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_event.h b/arkui/ace_engine/native/native_event.h new file mode 100644 index 000000000..70a2dbb00 --- /dev/null +++ b/arkui/ace_engine/native/native_event.h @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provides the UI component capabilities of the ArkUI on the Native side, such as component creation and destruction, tree node operations, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_event.h + * + * @brief Provides the event type definition set of the ArkUI on the Native side. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_EVENT +#define ARKUI_NATIVE_EVENT + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Tool type definition of the Touch event. + * + * @since 12 + */ +typedef enum { + /** The tool type is not supported. */ + NODE_TOOL_TYPE_UNKNOWN = -1, + + /** Finger */ + NODE_TOOL_TYPE_FINGER = 0, + + /** Pen */ + NODE_TOOL_TYPE_STYLUS = 1, +} ArkUI_NodeToolType; + +/** + * @brief Source type definition of the Touch event. + * + * @since 12 + */ +typedef enum { + /** Unsupported source type */ + NODE_SOURCE_TYPE_UNKNOWN = -1, + /** Touch screen */ + NODE_SOURCE_TYPE_TOUCH_SCREEN = 0, + /** Stylus */ + NODE_SOURCE_TYPE_STYLUS = 1, + /** Touchpad */ + NODE_SOURCE_TYPE_TOUCHPAD = 2, +} ArkUI_NodeSourceType; + +/** + * @brief Defines the data structure of the touch point information of the Touch event. + * + * @since 12 + */ +typedef struct { + /** Touch event ID. */ + int32_t id; + + /** Timestamp when a finger is pressed, in microseconds (us). */ + int64_t pressedTime; + + /** X coordinate of the screen to which the touch position belongs. */ + int32_t screenX; + + /** Y coordinate of the screen to which the touch position belongs. */ + int32_t screenY; + + /** X coordinate of the touch position in the window. */ + int32_t windowX; + + /** Y coordinate of the touch position in the window. */ + int32_t windowY; + + /** X coordinate of the touch position in the current trigger event component. */ + int32_t nodeX; + + /** Y coordinate of the touch position in the current trigger event component. */ + int32_t nodeY; + + /** Pressure value. The value range is [0.0, 1.0]. 0.0 indicates that the pressure is not supported. */ + double pressure; + + /** Wideness of the touch area. */ + int32_t contactAreaWidth; + + /** Height of the touch area. */ + int32_t contactAreaHeight; + + /** Angle relative to the YZ plane. The value range is [-90, 90], where a positive value indicates the right slant. */ + double tiltX; + + /** Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt. */ + double tiltY; + + /** X coordinate of the center point of the tool area. */ + int32_t toolX; + + /** Y coordinate of the center point of the tool area. */ + int32_t toolY; + + /** Width of the contact area of the tool. */ + int32_t toolWidth; + + /** Height of the contact area of the tool. */ + int32_t toolHeight; + + /** Enter the X coordinate of the device. */ + int32_t rawX; + + /** Input the Y coordinate of the device. */ + int32_t rawY; + + /** Tool type. */ + ArkUI_NodeToolType toolType; +} ArkUI_NodeTouchPoint; + +/** + * @brief Defines the enumerated value of the touch event type. + * + * @since 12 + */ +typedef enum { + /** Touch to cancel. */ + NODE_ACTION_CANCEL = 0, + /** Touch and press. */ + NODE_ACTION_DOWN = 1, + /** Touch to move. */ + NODE_ACTION_MOVE = 2, + /** Touch to lift. */ + NODE_ACTION_UP = 3, +} ArkUI_NodeTouchEventAction; + +/** + * @brief Defines the structure type of historical point information. + * + * @since 12 + */ +typedef struct { + /** Screen touch event type. */ + ArkUI_NodeTouchEventAction action; + /** Timestamp of historical touchscreen events, in microseconds (us). */ + int64_t timeStamp; + /** Source type of historical touch events. */ + ArkUI_NodeTouchPoint actionTouch; + /** Source type of historical touch events. */ + ArkUI_NodeSourceType sourceType; +} ArkUI_NodeHistoricalTouchPoint; + +/** + * @brief Defines the structure type of the Touch event. + * + * @since 12 + */ +typedef struct { + /** Type of the touch event. */ + ArkUI_NodeTouchEventAction action; + + /** Timestamp of the touch event, in microseconds (us). */ + int64_t timeStamp; + + /** Information about the touch point of the current touch event. */ + ArkUI_NodeTouchPoint actionTouch; + + /** + * @brief Return the information about all screen touch points when this event occurs. + * @param points Pointer object used to receive data. + * @return Number of screen contact points. + * @note + * When this function is invoked, the framework creates a heap memory object of the touch point information array and returns a pointer. Developers need to manually release the memory by calling delete[] after using the function. + */ + int32_t (*getTouches)(ArkUI_NodeTouchPoint** points); + + /** + * @brief Return the historical point information in the event. These are the motions that occur between this event and the previous event. + * @param historicalPoints Pointer object used to receive data. + * @return Number of historical points. + * @note + * When this function is invoked, the framework creates a heap memory object of the historical point data array and returns a pointer. After the function is invoked, you need to manually release the memory by calling delete[]. + */ + int32_t (*getHistoricalPoints)(ArkUI_NodeHistoricalTouchPoint** historicalPoints); + + /** Type of the triggering event source. */ + ArkUI_NodeSourceType sourceType; + + /** Prohibit further pop-up processing of the event to the parent node. */ + bool stopPropagation; + + /** Block the default event processing behavior of the current node and allow events to bubble up further. */ + bool preventDefault; +} ArkUI_NodeTouchEvent; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_EVENT +/** @} */ diff --git a/arkui/ace_engine/native/native_interface.h b/arkui/ace_engine/native/native_interface.h new file mode 100644 index 000000000..0f69fadc4 --- /dev/null +++ b/arkui/ace_engine/native/native_interface.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provide UI capabilities of the ArkUI on the Native side, such as creating and destroying UI components, operating tree nodes, setting attributes, and listening on events. + * + * @since 12 + */ + +/** + * @file native_interface.h + * + * @brief Provide the unified entry function of the NativeModule interface. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_INTERFACE_H +#define ARKUI_NATIVE_INTERFACE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Define the native interface type of any version. + * + * @since 12 + */ +typedef struct { +/** + * @brief Define the version information about the Native interface set. + * + * Different from the NDK version, the version field of the NativeNode interface indicates the version information of the structure. + */ +int32_t version; +} ArkUI_AnyNativeAPI; + +/** + * @brief Define the native interface set type. + * + * @since 12 + */ +typedef enum { + /** Indicates the type of the interface related to the UI component. */ + ARKUI_NATIVE_NODE, +} ArkUI_NativeAPIVariantKind; + +/** + * @brief Obtain the Native interface set of a specified version. + * + * @param type indicates the class of the Native interface set provided by the ArkUI, for example, the UI component interface class ARKUI_NATIVE_NODE. + * @param version Version of the native interface structure, which is obtained through the suffix defined by the structure, for example, ArkUI_NativeNodeAPI_1 of the UI component structure of version 1. + * @return ArkUI_AnyNativeAPI* Return the abstract object of the Native interface that carries the version. + * @code {.cpp} + * #include + * #include + * + * auto anyNativeAPI = OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1); + * if (anyNativeAPI->version == 1) { + * auto basicNodeApi = reinterpret_cast(anyNativeAPI); + * } + * @endcode + * + * @since 12 +*/ +ArkUI_AnyNativeAPI* OH_ArkUI_GetNativeAPI(ArkUI_NativeAPIVariantKind type, int32_t version); + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_INTERFACE_H +/** @} */ diff --git a/arkui/ace_engine/native/native_interface_xcomponent.h b/arkui/ace_engine/native/native_interface_xcomponent.h index e68de8f0d..5ac327f6a 100644 --- a/arkui/ace_engine/native/native_interface_xcomponent.h +++ b/arkui/ace_engine/native/native_interface_xcomponent.h @@ -42,6 +42,8 @@ #include #endif +#include "arkui/native_type.h" + #include "native_xcomponent_key_event.h" #ifdef __cplusplus @@ -624,6 +626,29 @@ int32_t OH_NativeXComponent_RegisterOnFrameCallback(OH_NativeXComponent* compone */ int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* component); +/** + * @brief Mount the UI component created by using the native interface of the ArkUI to the current XComponent. + * + * @param component indicates the pointer that points to the OH_NativeXComponent instance. + * @param root Pointer that points to the component instance created by the Native interface. + * @return 0 - Success. + * 401: parameter exception. + * + * @since 12 + */ +int32_t OH_NativeXComponent_AttachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); + +/** + * @brief Uninstall the native component of the ArkUI from the current XComponent. + * + * @param component indicates the pointer that points to the OH_NativeXComponent instance. + * @param root Pointer that points to the component instance created by the Native interface. + * @return 0 - Success. + * 401: parameter error. + * + * @since 12 + */ +int32_t OH_NativeXComponent_DetachNativeRootNode(OH_NativeXComponent* component, ArkUI_NodeHandle root); #ifdef __cplusplus }; diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h new file mode 100644 index 000000000..63ae6a01f --- /dev/null +++ b/arkui/ace_engine/native/native_node.h @@ -0,0 +1,3198 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provides the UI capabilities of the ArkUI on the Native side, such as UI component creation and destruction, tree node operation, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_node.h + * + * @brief Provides the type definition of the NativeNode interface. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_NODE_H +#define ARKUI_NATIVE_NODE_H + +#include "native_event.h" +#include "native_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_NODE_SCOPE_NUM 1000 + +/** + * @brief This API is used to provide the ArkUI to create component types on the Native side. + * + * @since 12 + */ +typedef enum { + /** Text.*/ + ARKUI_NODE_TEXT = 1, + /** Picture.*/ + ARKUI_NODE_IMAGE = 4, + /** Status switch.*/ + ARKUI_NODE_TOGGLE = 5, + /** Stack containers.*/ + ARKUI_NODE_STACK = MAX_NODE_SCOPE_NUM, + /** Paging container.*/ + ARKUI_NODE_SWIPER, + /** Roll the container.*/ + ARKUI_NODE_SCROLL, + /** List.*/ + ARKUI_NODE_LIST, + /** List item.*/ + ARKUI_NODE_LIST_ITEM, + /** List item group.*/ + ARKUI_NODE_LIST_ITEM_GROUP, +} ArkUI_NodeType; + +/** + * @brief Defines the general input parameter structure of the {@link setAttribute} function. + * + * @since 12 + */ +typedef struct { + /** Number array.*/ + const ArkUI_NumberValue* value; + /** Size of a numeric array.*/ + int32_t size; + /** Character string type.*/ + const char* string; + /** Object type.*/ + void* object; +} ArkUI_AttributeItem; + +/** + * @brief Defines the set of attribute styles that can be set by the ArkUI on the Native side. + * + * @since 12 + */ +typedef enum { + /** + * @brief Width attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: width, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: width, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {1.2}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_WIDTH, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_WIDTH); + * auto nodeWidth = item->value[0].f32; + * @endcode + * + */ + NODE_WIDTH = 0, + /** + * @brief Height attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: height, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: height, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {1.2}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_HEIGHT, &item);clang-tid + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_HEIGHT); + * auto nodeHeight = item->value[0].f32; + * @endcode + * + */ + NODE_HEIGHT, + /** + * @brief Background color attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].u32: indicates the background color. The value is in the 0xargb format. For example, 0xFFFF0000 indicates red.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].u32: indicates the background color. The value is in the 0xargb format. For example, 0xFFFF0000 indicates red.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.u32=0xFFFF0000}}; + * ArkUI_AttributeItem item = {value, 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_COLOR); + * auto nodeBackgroundColor = item->value[0].u32; + * @endcode + * + */ + NODE_BACKGROUND_COLOR, + /** + * @brief Background color image attribute. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string: image address.\n + * .value[0]?.i32: optional, repeat parameter, parameter type {@link ArkUI_ImageRepeat}, default value is ARKUI_IMAGE_REPEAT_NO_REPEAT; \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string: image address.\n + * .value[0].i32: repeat parameter, parameter type {@link ArkUI_ImageRepeat}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_IMAGE_REPEAT_NO_REPEAT}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "/pages/icon.png"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE); + * auto nodeBackgroundImageUrl = item->string; + * auto nodeBackgroundImageRepeat = item->value[0].i32; + * @endcode + * + */ + NODE_BACKGROUND_IMAGE, + /** + * @brief Interspace attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} has two formats:\n + * 1: The inner spacing values of the upper, lower, left, and right positions are equal.\n + * .value[0].f32: internal spacing, in vp.\n + * 2: Specify the inner spacing values of the upper, lower, left, and right positions.\n + * .value[0].f32: Value of the upper-inside spacing, in vp.\n + * .value[1].f32: indicates the inner right spacing, in vp.\n + * .value[2].f32: indicates the spacing between the bottom and the bottom, in vp.\n + * .value[3].f32: value of the inner-left spacing, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: indicates the upper-inside spacing, in vp.\n + * .value[1].f32: right inner spacing, in vp.\n + * .value[2].f32: Value of the spacing between the bottom and the bottom, in vp.\n + * .value[3].f32: value of the inner-left spacing, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value1[] = {1, 2, 3, 4}; + * ArkUI_AttributeItem item1 = {value1, sizeof(value1)/sizeof(ArkUI_NumberValue)}; + * ArkUI_NumberValue value2[] = {10}; + * ArkUI_AttributeItem item2 = {value2, sizeof(value2)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item1); + * nativeNodeApi->setAttribute(nodeHandle, NODE_PADDING, &item2); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_PADDING); + * auto nodePaddingTop = item->value[0].f32; + * @endcode + * + */ + NODE_PADDING, + /** + * @brief Component ID attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string: content of ID; \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string: content of ID; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ID, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ID); + * auto nodeId = item->string; + * @endcode + * + */ + NODE_ID, + /** + * @brief Use the {@link setAttribute} method to set whether the component can interact with each other. If the value is false, the component does not respond to operations such as clicking the component. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: false: non-interactive; true: interactive.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: 0: non-interactive; 1: interactive.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = false}}; + * ArkUI_AttributeItem item = {value, 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ENABLED, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_ENABLED); + * auto nodeEnabled = item->value[0].i32; + * @endcode + */ + NODE_ENABLED, + /** + * @brief Outer spacing attribute, which supports the attribute setting, attribute reset, and attribute obtaining interfaces. + * + * The attribute setting method parameter {@link ArkUI_AttributeItem} has two formats:\n + * 1: The outer spacing values of the upper, lower, left, and right positions are equal.\n + * .value[0].f32: value of the outer spacing, in vp.\n + * 2: Specify the outer spacing values of the upper, lower, left, and right positions.\n + * .value[0].f32: indicates the upper and outer spacing, in vp.\n + * .value[1].f32: indicates the value of the right outer space, in vp.\n + * .value[2].f32: Value of the spacing between the bottom and the outer, in vp.\n + * .value[3].f32: value of the outer left spacing, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: indicates the upper and outer spacing, in vp.\n + * .value[1].f32: indicates the value of the right outer space, in vp.\n + * .value[2].f32: Value of the spacing between the bottom and the outer, in vp.\n + * .value[3].f32: indicates the value of the outer-left spacing, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value1[] = {1, 2, 3, 4}; + * ArkUI_AttributeItem item1 = {value1, sizeof(value1)/sizeof(ArkUI_NumberValue)}; + * ArkUI_NumberValue value2[] = {10}; + * ArkUI_AttributeItem item2 = {value2, sizeof(value2)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item1); + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARGIN, &item2); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_MARGIN); + * auto nodeMarginTop = item->value[0].f32; + * @endcode + * + */ + NODE_MARGIN, + /** + * @brief Component translation, which supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: moving distance on the x axis, in vp. The default value is 0. \n + * .value[1].f32: moving distance on the y axis, in vp. The default value is 0. \n + * .value[2].f32: Z-axis moving distance, in vp. The default value is 0. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: moving distance on the x axis, in vp.\n + * .value[1].f32: moving distance on the y axis, in vp.\n + * .value[2].f32: Z-axis moving distance, in vp.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {100, 20, 0}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE); + * auto nodeTranslate = item->value[0].f32; + * @endcode + * + */ + NODE_TRANSLATE, + /** + * @brief Component scaling, which supports attribute setting, resetting, and obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: scaling coefficient of the x axis. The default value is 1. \n + * .value[1].f32: scaling factor of the y-axis. The default value is 1. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: scaling coefficient of the x axis.\n + * .value[1].f32: The scaling factor for the y-axis.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {1.0, 0.5}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCALE, &item); + * auto item = basicNodeApi->getAttribute(nodeHandle, NODE_SCALE); + * auto nodeScale = item->value[0].f32; + * @endcode + * + */ + NODE_SCALE, + /** + * @brief Component rotation attribute, which supports attribute setting, resetting, and obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: x-coordinate of the rotation axis vector. The default value is 0. \n + * .value[1].f32: y-coordinate of the rotation axis vector. The default value is 0. \n + * .value[2].f32: z coordinate of the rotation axis vector. The default value is 0. \n + * .value[3].f32: rotation angle. The default value is 0. \n + * .value[4].f32: line of sight distance, that is, the distance from the viewpoint to the z=0 plane, in vp. The default value is 0. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: x coordinate of the rotation axis vector.\n + * .value[1].f32: y-coordinate of the rotation axis vector.\n + * .value[2].f32: z coordinate of the rotation axis vector.\n + * .value[3].f32: rotation angle; \n + * .value[4].f32: line of sight distance, that is, the distance from the viewpoint to the z=0 plane, in vp.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {0, 0, 1, 300, 0}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_ROTATE, &item); + * auto item = basicNodeApi->getAttribute(nodeHandle, NODE_ROTATE); + * auto nodeRotate = item->value[0].f32; + * @endcode + * + */ + NODE_ROTATE, + /** + * @brief Highlight effect of the component. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: luminance value. The default value is 1.0. The recommended value range is [0, 2]. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Luminance value.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {1.2}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_BRIGHTNESS, &item); + * auto item = basicNodeApi->getAttribute(nodeHandle, NODE_BRIGHTNESS); + * auto nodeBrightness = item->value[0].f32; + * @endcode + * + */ + NODE_BRIGHTNESS, + /** + * @brief Saturation effect of the component. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: saturation value. The default value is 1.0. The recommended value range is [0, FLT_MAX]. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Saturation value.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {1.0}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SATURATION, &item); + * auto item = basicNodeApi->getAttribute(nodeHandle, NODE_SATURATION); + * auto nodeSaturate = item->value[0].f32; + * @endcode + * + */ + NODE_SATURATION, + /** + * @brief Component content blur effect, which supports attribute setting, resetting, and obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: blur radius. The larger the blur radius, the more blurred the blur. If the parameter is set to 0, the blur is not blurred. The unit is vp. The default value is 0.0.\n + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .value[0].f32: blur radius. The larger the blur radius, the more blurred the blur. If the parameter is set to 0, the blur is not blurred. The unit is vp.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {1.0}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_BLUR, "1.0"); + * auto item = basicNodeApi->getAttribute(nodeHandle, NODE_BLUR); + * auto nodeBlur = item->value[0].f32; + * @endcode + * + */ + NODE_BLUR, + /** + * @brief Linear color gradient effect of the component. Attribute setting, attribute reset, and attribute obtaining are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string: character string combination parameter. Four input parameters are separated by semicolons (;). \n + * Input parameter 1: indicates the gradient color at a certain percentage position. If an invalid color is set, the gradient color is skipped. Color and position (unit: vp) array type, separated by commas.\n + * Input parameter 2: start angle of the linear gradient. 0 o'clock rotation is the positive angle. The default value is 180.\n + * Input parameter 3: + * Indicates the direction of the linear gradient. This parameter does not take effect after the angle is set. Value range: ("left","top","right","bottom","left-top","left-bottom","right-top",\n. + * "right-bottom", "none", default "bottom"); \n + * Input parameter 4: coloring for the gradient color. The default value is false.\n + * For example, "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true". + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * * .string: character string combination parameter. Four input parameters are separated by semicolons (;). \n + * Input parameter 1: indicates the gradient color at a certain percentage position. If an invalid color is set, the system skips the gradient color. Color and position (unit: vp) array type, separated by commas.\n + * Input parameter 2: start angle of the linear gradient. Rotate clockwise in the 0 o'clock direction as the positive angle; \n + * Input parameter 3: linear gradient direction. The setting of angle does not take effect.\n + * Input parameter 4: repeat coloring for the gradient color.\n + * @code {.cpp} + * ARKUI_AttributeItem item = {.string = "#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;;left;true"}; + * basicNodeApi->setAttribute(nodeHandle, NODE_LINEAR_GRADIENT, &item); + * auto item = basicNodeApi->getAttribute(nodeHandle, NODE_LINEAR_GRADIENT); + * auto nodeLinearGradient = item->string; + * @endcode + * + */ + NODE_LINEAR_GRADIENT, + /** + * @brief Alignment mode of the component content in the element drawing area. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: alignment mode. The data type is {@link ArkUI_Alignment}. The default value is AKUI_ALIGNMENT_CENTER.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Alignment mode, data type {@link ArkUI_Alignment}.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_ALIGNMENT_CENTER}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_ALIGNMENT, "center"); + * auto item = basicNodeApi->getAttribute(nodeHandle, NODE_ALIGNMENT); + * auto nodeAlign = item->value[0].i32; + * @endcode + * + */ + NODE_ALIGNMENT, + /** + * @brief Transparency attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: Transparency value, ranging from 0 to 1.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Transparency numeric value, ranging from 0 to 1.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {0.5}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY); + * auto nodeOpacity = item->value[0].f32; + * @endcode + * + */ + NODE_OPACITY, + /** + * @brief Border width attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * 1: .value[0].f32: Set the width of the four edges in a unified manner.\n + * 2: .value[0].f32: Sets the border width of the top border.\n + * .value[1].f32: Sets the border width of the right box.\n + * .value[2].f32: Sets the border width of the lower border.\n + * .value[3].f32: Sets the border width of the left border.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Sets the border width of the top border.\n + * .value[1].f32: Sets the border width of the right box.\n + * .value[2].f32: Sets the border width of the lower border.\n + * .value[3].f32: Sets the border width of the left border.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {5}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); + * ArkUI_NumberValue value[] = {5, 5, 10, 10}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_WIDTH, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_WIDTH); + * auto nodeBorderWidth = item->value[0].f32; + * @endcode + * + */ + NODE_BORDER_WIDTH, + /** + * @brief Border rounded corner attribute, which supports attribute setting, attribute reset, and attribute obtaining interfaces. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * 1: .value[0].f32: Set the border fillets of the four edges.\n + * 2: .value[0].f32: Set the radius of the upper left corner fillet.\n + * .value[1].f32: Sets the radius of the upper right corner fillet.\n + * .value[2].f32: Sets the radius of the lower left corner fillet.\n + * .value[3].f32: Sets the radius of the lower right corner fillet.\n + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .value[0].f32: Sets the radius of the upper left corner fillet.\n + * .value[1].f32: Sets the radius of the upper right corner fillet.\n + * .value[2].f32: Sets the radius of the lower left corner fillet.\n + * .value[3].f32: Sets the radius of the lower right corner fillet.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {5}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); + * ArkUI_NumberValue value[] = {5, 5, 10, 10}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_RADIUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_RADIUS); + * auto nodeBorderRadius = item->value[0].f32; + * @endcode + * + */ + NODE_BORDER_RADIUS, + /** + * @brief Border color attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * 1: .value[0].u32: Set the border color of the four edges, represented by 0xargb, for example, 0xFFFF11FF.\n + * 2: .value[0].u32: Set the color of the upper border, represented by 0xargb, for example, 0xFFFF11FF.\n + * .value[1].u32: sets the color of the right border, represented by 0xargb, for example, 0xFFFF11FF.\n + * .value[2].u32: sets the color of the lower border, represented by 0xargb, for example, 0xFFFF11FF.\n + * .value[3].u32: Sets the color of the left border, represented by 0xargb, for example, 0xFFFF11FF.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].u32: Sets the upper border color, represented by 0xargb, for example, 0xFFFF11FF.\n + * .value[1].u32: sets the color of the right border, represented by 0xargb, for example, 0xFFFF11FF.\n + * .value[2].u32: sets the color of the lower border, represented by 0xargb, for example, 0xFFFF11FF.\n + * .value[3].u32: Sets the color of the left border, represented by 0xargb, for example, 0xFFFF11FF.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.u32 = 0xFFFF11FF}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); + * ArkUI_NumberValue value[] = {{.u32 = 0xFFFF11FF}, {.u32 = 0xFFFF11FF}, {.u32 = 0xFFFFFFFF}, {.u32 = 0x000000}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_COLOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_COLOR); + * auto nodeBorderColor = item->value[0].u32; + * @endcode + * + */ + NODE_BORDER_COLOR, + /** + * @brief Border line style attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * 1: .value[0].i32: Set the border line style of the four edges in a unified manner. Parameter type {@link ArkUI_BorderStyle}. The default value is AKUI_BORDER_:00-19:00_SOLID.\n + * 2:.value[0].i32: Sets the upper border line style. Parameter type {@linkArkUI_BorderStyle}. The default value is AKUI_BORDER_:00-20:00_SOLID.\n + * .value[1].i32: Sets the line style of the right border. Parameter type {@link ArkUI_BorderStyle}. The default value is ARKUI_BORDER_:00-19:00_SOLID.\n + * .value[2].i32: Sets the lower border line style. Parameter type {@link ArkUI_BorderStyle}. The default value is AKUI_BORDER_:00-20:00_SOLID.\n + * .value[3].i32: Sets the left border line style. Parameter type {@link ArkUI_BorderStyle}. The default value is ARKUI_BORDER_:00-19:00_SOLID.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Value corresponding to the top border line style.\n + * .value[1].i32: Value corresponding to the right border line style.\n + * .value[2].i32: Value corresponding to the lower border line style.\n + * .value[3].i32: Value corresponding to the left border line style.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_BORDER_STYLE_DOTTED}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_BORDER_STYLE_DOTTED}, {.i32 = ARKUI_BORDER_STYLE_SOLID}, + * {.i32 = ARKUI_BORDER_STYLE_SOLID}, {.i32 = ARKUI_BORDER_STYLE_DOTTED}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BORDER_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BORDER_STYLE); + * auto nodeBorderStyle = item->value[0].i32; + * @endcode + * + */ + NODE_BORDER_STYLE, + /** + * @brief Stack sequence attribute of the component. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: Stacking order value.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Stacking order value.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {2}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_Z_INDEX, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_Z_INDEX); + * auto nodeZIndex = item->value[0].f32; + * @endcode + * + */ + NODE_Z_INDEX, + /** + * @brief Whether the component is visible. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: controls whether the current component is displayed or hidden. Parameter type {@link ArkUI_Visibility}. The default value is ARKUI_VISIBGY_VISIBLE.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: controls whether the current component is displayed or hidden. Parameter type {@link ArkUI_Visibility}. The default value is ARKUI_VISIBGY_VISIBLE.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32=ARKUI_VISIBILITY_NONE}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_VISIBILITY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_VISIBILITY); + * auto nodeVisibility = item->value[0].i32; + * @endcode + * + */ + NODE_VISIBILITY, + /** + * @brief The API for tailoring and masking the attributes of the component. The APIs for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: specifies whether to crop the parent container according to the edge outline. The value 0 indicates no, and the value 1 indicates no.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: specifies whether to crop the parent container according to the edge outline. The value 0 indicates not to crop the parent container, and the value 1 indicates to crop the parent container.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = 0}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); + * auto nodeClip = item->value[0].i32; + * @endcode + * + */ + NODE_CLIP, + /** + * @brief This API is used to tailor and mask the attributes of the component. The APIs for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string: shape description, which is optional:\n + * "rect(10, 10, 10, 10)" is width, height, radiusWidth, and radiusHeight respectively in parentheses.\n + * "circle(10, 10)": width, height; \n + * "ellipse(10, 10)" is width and height respectively; \n + * "path(10, 10, M0 0 L600 0)" is width, height, commands; \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string: Shape description:\n + * "rect(10, 10, 10, 10)" is width, height, radiusWidth, and radiusHeight respectively in parentheses.\n + * "circle(10, 10)": width, height; \n + * "ellipse(10, 10)" is width and height respectively; \n + * "path(10, 10, M0 0 L600 0)" is width, height, and commands respectively; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "rect(10, 10, 10, 10)"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CLIP_SHAPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CLIP); + * auto nodeClipShape = item->string; + * @endcode + * + */ + NODE_CLIP_SHAPE, + /** + * @brief Matrix transformation function, which can translate, rotate, and zoom in or out a chart, and supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .data[0...15].f32:16 floating point numbers.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .data[0...15].f32:16 floating point numbers.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, + * {.f32 = 0}, {.f32 = 0}, {.f32 = 1}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 0}, {.f32 = 1}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSFORM, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSFORM); + * auto nodeTransform = item[0].value; + * @endcode + * + */ + NODE_TRANSFORM, + /** + * @brief Touch test type. Interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: controls the touch test type of the current component. The parameter type is {@link ArkUI_HitTestMode}. The default value is ARKUI_HIT_TEST_MODE_DEFAULT. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: controls the touch test type of the current component. The parameter type is {@link ArkKUI_HitTestMode}. The default value is ARKUI_HIT_TEST_MODE_DEFAULT. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32=ARKUI_HIT_TEST_MODE_BLOCK}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_HIT_TEST_BEHAVIOR); + * auto nodeHitTestBehavior = item->value[0].i32; + * @endcode + * + */ + NODE_HIT_TEST_BEHAVIOR, + /** + * @brief Offset of the upper left corner of the element relative to the upper left corner of the parent container. Attribute setting, attribute reset, and attribute obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: x-axis coordinate.\n + * .value[1].f32: y-axis coordinates.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem} of the attribute obtaining method:\n + * .value[0].f32: x-axis coordinate.\n + * .value[1].f32: y-axis coordinates.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {50, 50}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_POSITION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_POSITION); + * auto nodePositionX = item->value[0].f32; + * auto nodePositionY = item->value[1].f32; + * @endcode + * + */ + NODE_POSITION, + /** + * @brief Shadow effect attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Sets the shadow effect of the current component. Parameter type {@link ArkUI_ShadowStyle}.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Sets the shadow effect of the current component. Parameter type {@link ArkUI_ShadowStyle}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SHADOW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SHADOW); + * auto nodePositionX = item->value[0].i32; + * @endcode + * + */ + NODE_SHADOW, + /** + * @brief Customize the shadow effect, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string: character string combination parameter. Six input parameters are separated by semicolons (;). \n + * Input parameter 1: shadow blur radius.\n + * Input parameter 2: X-axis offset of the shadow.\n + * Input parameter 3: Y-axis offset of the shadow.\n + * Input parameter 4: shadow type.\n + * Input parameter 5: shadow color.\n + * Input parameter 6: indicates whether the shadow is filled in.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string: character string combination parameter. Six input parameters are separated by semicolons (;). \n + * Input parameter 1: shadow blur radius.\n + * Input parameter 2: X-axis offset of the shadow.\n + * Input parameter 3: Y-axis offset of the shadow.\n + * Input parameter 4: shadow type.\n + * Input parameter 5: shadow color.\n + * Input parameter 6: indicates whether the shadow is filled in.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "5; 10; 10; COLOR; 0xACCCCC; true"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CUSTOM_SHADOW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_CUSTOM_SHADOW); + * auto nodeCustomShadow = item->string; + * @endcode + * + */ + NODE_CUSTOM_SHADOW, + /** + * @brief Width and height attributes of the background image. Interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 indicates the width of the image, in vp.\n + * .value[1].f32 indicates the image height, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32 indicates the width of the image, in vp.\n + * .value[1].f32 indicates the image height, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue sizeArray[] = {20, 0} + * ARKUI_AttributeItem item = {.value = sizeArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE); + * auto width = item->value[0].f32; + * @endcode + * + */ + NODE_BACKGROUND_IMAGE_SIZE, + /** + * @brief Attributes of the width and height of the background image. The attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 indicates the width and height of the background image. The enumerated values are {@link ArkUI_ImageSize}.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 indicates the width and height of the background image. The enumerated values are {@link ArkUI_ImageSize}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue imageSizeStyle[] = {{.i32 = static_cast(ArkUI_ImageSize.ARKUI_IMAGE_SIZE_COVER)}} + * ARKUI_AttributeItem item = {.value = imageSizeStyle, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE); + * auto blurStyle = item->value[0].i32 + * @endcode + */ + NODE_BACKGROUND_IMAGE_SIZE_WITH_STYLE, + /** + * @brief Fuzzy attributes between the background and content. The interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 indicates the fuzzy type. The enumerated value is {@link ArkUI_BlurStyle}.\n + * .value[1]?.i32 indicates the light/dark color mode, which uses the enumerated value {@link ArkUI_ColorMode}.\n + * .value[2]?.i32 indicates the color obtaining mode. The enumerated value of {@link ArkUI_AdaptiveColor} is used.\n + * .value[3]?.f32 indicates the blur effect degree, which is in the range [0.0, 1.0].\n + * .value[4]?.f32 indicates the grayscale blur start boundary.\n + * .value[5]?.f32 indicates the grayscale blur end boundary.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 indicates the fuzzy type, which uses the enumerated value {@link ArkUI_BlurStyle}.\n + * .value[1]?.i32 indicates the light/dark color mode, which uses the enumerated value {@link ArkUI_ColorMode}.\n + * .value[2]?.i32 indicates the color obtaining mode. The enumerated value of {@link ArkUI_AdaptiveColor} is used.\n + * .value[3]?.f32 indicates the blur effect degree, which is in the range [0.0, 1.0].\n + * .value[4]?.f32 indicates the grayscale blur start boundary.\n + * .value[5]?.f32 indicates the grayscale blur end boundary.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue blurStyle[] = {{.i32 = static_cast(ArkUI_BlurStyle.ARKUI_BLUR_STYLE_THICK)}} + * ARKUI_AttributeItem item = {.value = blurStyle, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BACKGROUND_BLUR_STYLE); + * auto blurStyle = item->value[0].i32 + * @endcode + * + */ + NODE_BACKGROUND_BLUR_STYLE, + /** + * @brief Center point attribute of the graph transformation. Interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0]?.f32 indicates the X-axis coordinate value of the center point, in vp.\n + * .value[1]?.f32 indicates the Y-axis coordinate of the central point, in vp.\n + * .value[2]?.f32 indicates the Z-axis coordinate of the center point, in vp \n + * .value[3]?.f32 indicates the percentage position of the X-axis coordinate of the center point. For example, 0.2 indicates the position of 20%. This property overrides value[0].f32.\n + * .value[4]?.f32 indicates the percentage position of the Y axis coordinate of the center point, for example, 0.2 indicates the position of 20 percent. This property overrides value[1].f32.\n + * .value[5]?.f32 indicates the percentage position of the Z coordinate of the center point, for example, 0.2 indicates the position of 20 percent. This property overrides value[2].f32.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0]?.f32 indicates the X-axis coordinate of the center point, in vp.\n + * .value[1]?.f32 indicates the Y-axis coordinate of the central point, in vp.\n + * .value[2]?.f32 indicates the Z-axis coordinate of the central point, in vp \n + * Note: If the coordinate percentage position is set, the attribute obtaining method returns the calculated vp value. + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue centerPointArray[] = {20} + * ARKUI_AttributeItem item = {.value = centerPointArray, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSITION_CENTER, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSITION_CENTER); + * auto centerX = item->value[0].f32 + * @endcode + */ + NODE_TRANSFORM_CENTER, + /** + * @brief Transparency effect attribute during transition. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 indicates the transparency value of the start and end points.\n + * .value[1].i32 indicates the animation duration, in ms.\n + * .value[2].i32 indicates the type of the animation curve. The enumerated value of {@link ArkUI_AnimationCurve} is used.\n + * .value[3]?.i32 indicates the animation delay, in ms.\n + * .value[4]?.i32 indicates the number of times the animation is played.\n + * .value[5]?.i32 indicates the animation playing mode. The enumerated value of {@link ArkUI_AnimationPlayMode} is used.\n + * .value[6]?.f32 indicates the animation playback speed.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32 indicates the transparency value of the start and end points.\n + * .value[1].i32 indicates the animation duration, in ms.\n + * .value[2].i32 indicates the type of the animation curve. The enumerated value of {@link ArkUI_AnimationCurve} is used.\n + * .value[3]?.i32 indicates the animation delay, in ms.\n + * .value[4]?.i32 indicates the number of times the animation is played.\n + * .value[5]?.i32 indicates the animation playing mode. The enumerated value of {@link ArkUI_AnimationPlayMode} is used.\n + * .value[6]?.f32 indicates the animation playback speed.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue opacityTransition[] = {20, {.i32 = 3000}, + * {.i32 = static_cast(ArkUI_AnimationCurve.ARKUI_CURVE_EASE_IN_OUT)}} + * ARKUI_AttributeItem item = {.value = opacityTransition, .size = 3}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OPACITY_TRANSITION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OPACITY_TRANSITION); + * auto opacity = item->value[0].f32 + * @endcode + */ + NODE_OPACITY_TRANSITION, + /** + * @brief Rotation effect attributes during transition. The interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 represents the lateral rotation component.\n + * .value[1].f32 represents the vertical rotation component.\n + * .value[2].f32 represents a vertical rotation component.\n + * .value[3].f32 indicates the angle.\n + * .value[4].f32 for line of sight.\n + * .value[5].i32 indicates the animation duration, in ms.\n + * .value[6].i32 indicates the type of the animation curve. The enumerated value {@link ArkUI_AnimationCurve} is used.\n + * .value[7]?.i32 indicates the animation delay, in milliseconds.\n + * .value[8]?.i32 indicates the number of times the animation is played.\n + * .value[9]? .i32 indicates the animation playback mode, and the enumerated value {@link ArkUI_AnimationPlayMode} is used.\n + * .value[10]?.f32 indicates the animation playback speed.\n + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .value[0].f32 represents the lateral rotation component.\n + * .value[1].f32 represents the vertical rotation component.\n + * .value[2].f32 represents a vertical rotation component.\n + * .value[3].f32 indicates the angle.\n + * .value[4].f32 for line of sight.\n + * .value[5].i32 indicates the animation duration, in ms.\n + * .value[6].i32 indicates the type of the animation curve, which is the enumerated value of {@link ArkUI_AnimationCurve}.\n + * .value[7]?.i32 indicates the animation delay, in ms.\n + * .value[8]?.i32 indicates the number of times the animation is played.\n + * .value[9]? .i32 indicates the animation mode, and the enumerated value {@link ArkUI_AnimationPlayMode} is used.\n + * .value[10]?.f32 indicates the animation playback speed.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue rotateTransition[] = {0.0f, 0.0f, 1.0f, 180, 0, {.i32 = 3000}, + * {.i32 = static_cast(ArkUI_AnimationCurve.ARKUI_CURVE_SHARP)}} + * ARKUI_AttributeItem item = {.value = rotateTransition, .size = 7}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_ROTATE_TRANSITION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_ROTATE_TRANSITION); + * auto rotateX = item->value[0].f32 + * @endcode + */ + NODE_ROTATE_TRANSITION, + /** + * @brief Zoom effect attributes during transition. The interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 Landscape magnification.\n + * .value[1].f32 Vertical magnification.\n + * .value[2].f32 Vertical magnification.\n + * .value[3].i32 indicates the animation duration, in ms.\n + * .value[4].i32 indicates the type of the animation curve, which is the enumerated value of {@link ArkUI_AnimationCurve}.\n + * .value[5]?.i32 indicates the animation delay, in ms.\n + * .value[6]?.i32 indicates the number of times the animation is played.\n + * .value[7]? .i32 indicates the animation playback mode, and the enumerated value {@link ArkUI_AnimationPlayMode} is used.\n + * .value[8]?.f32 indicates the animation playback speed.\n + * \n + * Return value of the attribute obtaining method {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 Landscape magnification.\n + * .value[1].f32 Vertical magnification.\n + * .value[2].f32 Vertical magnification.\n + * .value[3].i32 indicates the animation duration, in ms.\n + * .value[4].i32 indicates the type of the animation curve, which is the enumerated value of {@link ArkUI_AnimationCurve}.\n + * .value[5]?.i32 indicates the animation delay, in ms.\n + * .value[6]?.i32 indicates the number of times the animation is played.\n + * .value[7]? .i32 indicates the animation playback mode, which is the enumerated value of {@link ArkUI_AnimationPlayMode}.\n + * .value[8]?.f32 indicates the animation playback speed.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue scaleTransition[] = {0.0f, 0.0f, 0.0f, {.i32 = 3000}, + * {.i32 = static_cast(ArkUI_AnimationCurve.ARKUI_CURVE_SHARP)}} + * ARKUI_AttributeItem item = {.value = scaleTransition, .size = 5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCALE_TRANSITION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCALE_TRANSITION); + * auto scaleX = item->value[0].f32 + * @endcode + */ + NODE_SCALE_TRANSITION, + /** + * @brief Panning effect attribute during transition. The interface supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * value[0].f32 indicates the horizontal translation distance, in vp.\n + * value[1].f32 indicates the vertical translation distance, in vp \n + * value[2].f32 indicates the vertical translation distance, in vp \n + * value[3].i32 indicates the animation duration, in milliseconds.\n + * value[4].i32 indicates the type of the animation curve. The enumerated value {@link ArkUI_AnimationCurve} is used.\n + * value[5]?.i32 indicates the animation delay, in ms.\n + * value[6]?.i32 indicates the number of times the animation is played.\n + * value[7]?.i32 indicates the animation playback mode, which is the enumerated value of {@link ArkUI_AnimationPlayMode}.\n + * value[8]?.f32 indicates the animation playback speed.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * value[0].f32 indicates the horizontal translation distance, in vp.\n + * value[1].f32 indicates the vertical translation distance, in vp.\n + * value[2].f32 indicates the vertical translation distance, in vp.\n + * value[3].i32 indicates the animation duration, in milliseconds.\n + * value[4].i32 indicates the type of the animation curve, and the enumerated value {@link ArkUI_AnimationCurve} is used.\n + * value[5]?.i32 indicates the animation delay duration, in ms.\n + * value[6]?.i32 indicates the number of times the animation is played.\n + * value[7]?.i32 indicates the animation playback mode, and the enumerated value {@link ArkUI_AnimationPlayMode} is used.\n + * value[8]?.f32 indicates the animation playback speed.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue translateTransition[] = {0.0f, 0.0f, 0.0f, + * {.i32 = 3000}, {.i32 = static_cast(ArkUI_AnimationCurve.ARKUI_CURVE_SHARP)}} + * ARKUI_AttributeItem item = {.value = translateTransition, .size = 5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TRANSLATE_TRANSITION); + * auto translateX = item->value[0].f32 + * @endcode + */ + NODE_TRANSLATE_TRANSITION, + + /** + * @brief Focus attribute, which supports attribute setting, resetting, and obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .value[0].i32: The parameter type is 1 or 0. + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: The parameter type is 1 or 0. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = 1}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOCUSABLE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FOCUSABLE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_FOCUSABLE, + + /** + * @brief Default focus attribute, which supports attribute setting, resetting, and obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * value[0].i32: The parameter type is 1 or 0. + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * value[0].i32: The parameter type is 1 or 0. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = 1}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DEFAULT_FOCUS, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DEFAULT_FOCUS); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_DEFAULT_FOCUS, + + /** + * @brief Touch hot zone attributes, which support attribute setting, attribute reset, and attribute obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .data[0].f32: x-axis coordinate of the touch point relative to the upper left corner of the component, in vp.\n + * .data[1].f32: y-axis coordinate of the touch point relative to the upper left corner of the component, in vp.\n + * .data[2].f32: Width of the touch hot zone, in%.\n + * .data[3].f32: Height of the touch hot zone, in%.\n + * .data[4...].f32: Multiple gesture response areas can be set, and the sequence is the same as that described above. + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .data[0].f32: x-axis coordinate of the touch point relative to the upper left corner of the component, in vp.\n + * .data[1].f32: y-axis coordinate of the touch point relative to the upper left corner of the component, in vp.\n + * .data[2].f32: Width of the touch hot zone, in%.\n + * .data[3].f32: Height of the touch hot zone, in%.\n + * .data[4...].f32: Multiple gesture response areas can be set, and the sequence is the same as the preceding sequence. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {0, 0, 100, 100}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); + * + * ArkUI_NumberValue value[] = {0, 0, 100, 100, 0, 0, 100, 100}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RESPONSE_REGION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RESPONSE_REGION); + * auto x = item->value[0].f32; + * auto y = item->value[1].f32; + * auto width = item->value[2].f32; + * auto height = item->value[3].f32; + * @endcode + * + */ + NODE_RESPONSE_REGION, + /** + * @brief Mask text attribute, which supports attribute setting, attribute reset, and attribute obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .string mask text; \n + * .value[0]?.i32: indicates the position of the floating layer relative to the component. The parameter type is {@link ArkUI_Alignment}. This parameter is optional, + * Default value is AKUI_ALIGNMENT_TOP_START.\n + * .value[1]?.i32: (Optional) Indicates the offset X of the floating layer based on the upper left corner of the floating layer. The unit is vp.\n + * .value[2]?.i32: (Optional) Indicates the offset Y of the floating layer based on the upper left corner of the floating layer. The unit is vp. + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .string mask text; \n + * .value[0]?.i32: indicates the position of the floating layer relative to the component. The parameter type is {@link ArkUI_Alignment}. This parameter is optional, + * Default value is AKUI_ALIGNMENT_TOP_START.\n + * .value[1]?.i32: indicates the offset X of the floating layer based on the upper left corner of the floating layer. The unit is vp.\n + * .value[2]?.i32: indicates the offset Y of the floating layer based on the upper left corner of the floating layer. The unit is vp. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_ALIGNMENT_TOP_START}, 1.2, 0.3}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue), "test"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OVERLAY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OVERLAY); + * auto text = item->string; + * @endcode + * + */ + NODE_OVERLAY, + + /** + * @brief Angle gradient effect, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string: character string combination parameter. Six input parameters are separated by semicolons:\n + * Input parameter 1: indicates the center point of the angle gradient, that is, the coordinates relative to the upper left corner of the current component, separated by commas.\n + * Input parameter 2: start point of the angle gradient. The default value is 0. \n + * Input parameter 3: end point of the angle gradient. The default value is 0. \n + * Input parameter 4: rotation angle of the angle gradient. The default value is 0. \n + * Input parameter 5: specifies the gradient color at a certain percentage position. If an invalid color is set, the gradient color is skipped.\n + * Input parameter 6: coloring for the gradient color. The default value is false.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string: character string combination parameter. Six input parameters are separated by semicolons:\n + * Input parameter 1: indicates the center point of the angle gradient, that is, the coordinates relative to the upper left corner of the current component. Separate the coordinates with commas (,). \n + * Input parameter 2: start point of the angle gradient. The default value is 0. \n + * Input parameter 3: end point of the angle gradient. The default value is 0. \n + * Input parameter 4: rotation angle of the angle gradient. The default value is 0. \n + * Input parameter 5: specifies the gradient color at a certain percentage position. If an invalid color is set, the gradient color is skipped.\n + * Input parameter 6: coloring for the gradient color. The default value is false.\n + * + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "5,10;60;180;60;#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;true"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWEEP_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWEEP_GRADIENT); + * auto nodeCustomShadow = item->string; + * @endcode + * + */ + NODE_SWEEP_GRADIENT, + /** + * @brief Angle gradient effect, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string: character string combination parameter. Four input parameters are separated by semicolons (;). \n + * Input parameter 1: indicates the center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component, separated by commas.\n + * Input parameter 2: radius of the radial gradient. The default value is 0. \n + * Input parameter 3: Specify the gradient color at a certain percentage position. If an invalid color is set, skip this step.\n + * Input parameter 4: repeat coloring for the gradient color.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string: character string combination parameter. Four input parameters are separated by semicolons (;). \n + * Input parameter 1: indicates the center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component, separated by commas.\n + * Input parameter 2: radius of the radial gradient. The default value is 0. \n + * Input parameter 3: Specifies the gradient color at a certain percentage position. If an invalid color is set, skip the gradient color.\n + * Input parameter 4: repeat coloring for the gradient color.\n + * + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "5,10;50;#ffff0000,0.0,#ff0000ff,0.3,#ffffff00,0.5;true"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_RADIAL_GRADIENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_RADIAL_GRADIENT); + * auto nodeCustomShadow = item->string; + * @endcode + * + */ + NODE_RADIAL_GRADIENT, + /** + * @brief The mask of a specified shape is added to the component. The interface for setting and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .data[0]?.u32: shape filling color.\n + * .data[1]?.u32: stroke color of a shape.\n + * .data[2]?.f32: stroke width of a shape.\n + * .string: shape description, which is optional:\n + * "progressMask(10, 10, #ff0000ff)" is the current value of the progress mask, the maximum value of the progress mask, and the color of the progress mask.\n + * "rect(10, 10, 10, 10)" is width, height, radiusWidth, and radiusHeight respectively in parentheses.\n + * "circle(10, 10)": width, height; \n + * "ellipse(10, 10)" is width and height respectively; \n + * "path(10, 10, M0 0 L600 0)" is width, height, commands; \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .data[0].u32: shape filling color.\n + * .data[1].u32: stroke color of a shape.\n + * .data[2].f32: stroke width of a shape, in vp.\n + * .string: Shape description:\n + * "progressMask(10, 10, #ff0000ff)" is the current value of the progress mask, the maximum value of the progress mask, and the color of the progress mask.\n + * "rect(10, 10, 10, 10)" is width, height, radiusWidth, and radiusHeight respectively in parentheses.\n + * "circle(10, 10)": width, height; \n + * "ellipse(10, 10)" is width and height respectively; \n + * "path(10, 10, M0 0 L600 0)" is width, height, and commands respectively; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "rect(10, 10, 10, 10)"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MASK, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MASK); + * auto nodeClipShape = item->string; + * @endcode + * + */ + NODE_MASK, + /** + * @brief Mix the current control background and subnode content. Interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: specifies the hybrid mode type of the current component. The parameter type is {@link ArkUI_BlendMode}. The default value is AKUI_BLEND_MODE_NONE.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: specifies the hybrid mode type of the current component. The parameter type is {@link ArkUI_BlendMode}. The default value is AKUI_BLEND_MODE_NONE.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32=ARKUI_BLEND_MODE_NONE}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_BLEND_MODE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_BLEND_MODE); + * auto nodeHitTestBehavior = item->value[0].i32; + * @endcode + * + */ + NODE_BLEND_MODE, + /** + * @brief Sets the layout in the axis direction of a container element. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Set the layout type in the axis direction of the container element.\n + * Parameter type {@link ArkUI_Direction}. The default value is ARKUI_DIRECTION_AUTO.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Set the layout type in the axis direction of the container element.\n + * Parameter type {@link ArkUI_Direction}. The default value is ARKUI_DIRECTION_AUTO.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32=ARKUI_DIRECTION_RTL}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_DIRECTION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_DIRECTION); + * auto nodeHitTestBehavior = item->value[0].i32; + * @endcode + * + */ + NODE_DIRECTION, + /** + * @brief Constraint size attributes. During component layout, the size range is restricted. Attribute setting, attribute reset, and attribute obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: minimum width, in vp.\n + * .value[1].f32: maximum width, in vp.\n + * .value[2].f32: Minimum height, in vp.\n + * .value[3].f32: maximum height, in vp.\n + * \n + * Return value of the method for obtaining attributes {@link ArkUI_AttributeItem} Format:\n + * .value[0].f32: minimum width, in vp; \n + * .value[1].f32: maximum width, in vp.\n + * .value[2].f32: Minimum height, in vp.\n + * .value[3].f32: maximum height, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {0, 5, 0, 5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CONSTRAINT_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONSTRAINT_SIZE); + * auto nodeMinWidth = item->value[0].f32; + * auto nodeMaxWidth = item->value[1].f32; + * auto nodeMinHeight = item->value[2].f32; + * auto nodeMaxHeight = item->value[3].f32; + * @endcode + * + */ + NODE_CONSTRAINT_SIZE, + /** + * @brief Grayscale effect attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: grayscale conversion ratio, ranging from 0 to 1. For example, 0.5 indicates that the grayscale processing is 50%.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: grayscale conversion ratio, ranging from 0 to 1.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {0.5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_GRAY_SCALE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_GRAY_SCALE); + * auto nodeGrayScale = item->value[0].f32; + * @endcode + */ + NODE_GRAY_SCALE, + /** + * @brief Inverts the image scale attributes of the input image. The interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: image inversion ratio. The value ranges from 0 to 1. For example, 0.5 indicates that the image inversion ratio is 50%.\n + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .value[0].f32: image inversion ratio, ranging from 0 to 1.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {0.5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_INVERT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_INVERT); + * auto nodeInvert = item->value[0].f32; + * @endcode + */ + NODE_INVERT, + /** + * @brief Converts an image to a dark brown proportion. The APIs for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: Convert the image to the dark brown ratio. The ratio ranges from 0 to 1. For example, 0.5 indicates that the dark brown ratio is 50%.\n + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .value[0].f32: Convert the image to the sepia ratio, ranging from 0 to 1.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {0.5}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SEPIA, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_SEPIA); + * auto nodeSepia = item->value[0].f32; + * @endcode + */ + NODE_SEPIA, + /** + * @brief Contrast attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: contrast. If the value is 1, the original image is used. A larger value indicates a higher contrast. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Contrast; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {10}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_CONTRAST, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_CONTRAST); + * auto nodeContrast = item->value[0].f32; + * @endcode + */ + NODE_CONTRAST, + /** + * @brief Foreground color attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format. Two input parameter formats are supported: \n + * 1: .value[0].u32: color value, 0xargb type, for example, 0xFFFF0000 indicates red.\n + * 2: .value[0].i32: color value enumeration {@link ArkUI_ColoringStrategy}.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].u32: color value, 0xargb type; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {{.u32=0xFFFF0000}}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FOREGROUND_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FOREGROUND_COLOR); + * auto nodeForegroundColor = item->value[0].u32; + * @endcode + */ + NODE_FOREGROUND_COLOR, + /** + * @brief Additional offset attributes of a component's sub-element relative to the component itself. Attribute setting, resetting, and obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 indicates the offset in the x-axis direction, in vp.\n + * .value[1].f32 indicates the offset in the y-axis direction, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32 indicates the offset in the x-axis direction, in vp.\n + * .value[1].f32 indicates the offset in the y-axis direction, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue offsetArray[] = {20, 0} + * ARKUI_AttributeItem item = {.value = offsetArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_OFFSET, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_OFFSET); + * auto offsetX = item->value[0].f32 + * @endcode + * + */ + NODE_OFFSET, + /** + * @brief Anchor attribute of a subelement of a component during location positioning. Attribute setting, attribute reset, and attribute obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 indicates the x-coordinate value of the anchor point, in vp.\n + * .value[1].f32 indicates the y-coordinate value of the anchor point, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32 indicates the x-coordinate value of the anchor point, in vp.\n + * .value[1].f32 indicates the y coordinate value of the anchor point, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue pointArray[] = {20, 0} + * ARKUI_AttributeItem item = {.value = pointArray, .size = 2}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_MARK_ANCHOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_MARK_ANCHOR); + * auto pointX = item->value[0].f32 + * @endcode + * + */ + NODE_MARK_ANCHOR, + + /** + * @brief The text component sets the text content attributes. The interface supports the attribute setting, attribute reset, and attribute obtaining interfaces. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string indicates the text content.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string indicates the text content.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_AttributeItem item = {.string = "https://www.example.com/xxx.png"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CONTENT); + * auto content = item->string + * @endcode + */ + NODE_TEXT_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TEXT, + /** + * @brief Component font color attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].u32: indicates the font color. The value is in the 0xargb format. For example, 0xFFFF0000 indicates red.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].u32: font color value, in 0xargb format.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.u32=0xFFFF0000}}; + * ArkUI_AttributeItem item = {value, 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_COLOR); + * auto nodeFontColor = item->value[0].u32; + * @endcode + * + */ + NODE_FONT_COLOR, + /** + * @brief Component font size attribute, which supports attribute setting, attribute reset, and attribute obtaining interfaces. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: indicates the font size, in fp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: indicates the font size, in fp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {10}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_SIZE); + * auto nodeFontSize = item->value[0].f32; + * @endcode + * + */ + NODE_FONT_SIZE, + /** + * @brief Component font style attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: font style {@link ArkUI_FontStyle}. The default value is AKUI_FONT_terrace_NORMAL.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: font style {@link ArkUI_FontStyle}; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_FONT_STYLE_NORMAL}}; + * ArkUI_AttributeItem item = {value, 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_STYLE, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_STYLE); + * auto nodeFontStyle = item->value[0].i32; + * @endcode + * + */ + NODE_FONT_STYLE, + /** + * @brief Component font thickness attribute, which supports attribute setting, attribute reset, and attribute obtaining interfaces. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: font thickness style {@link ArkUI_FontWeight}. The default value is RKUI_FONT_WEIGHT_NORMAL.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: font weight {@link ArkUI_FontWeight}; \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_FONT_WEIGHT_NORMAL}}; + * ArkUI_AttributeItem item = {value, 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_FONT_WEIGHT); + * auto nodeFontWeight = item->value[0].i32; + * @endcode + * + */ + NODE_FONT_WEIGHT, + /** + * @brief Text line height attribute, which supports attribute setting, attribute reset, and attribute obtaining interfaces. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 indicates the value of lineHeight, in fp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32 indicates the value of lineHeight, in fp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue lineHeight[] = {20} + * ARKUI_AttributeItem item = {.value = lineHeight, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LINE_HEIGHT); + * auto pointX = item->value[0].f32 + * @endcode + */ + NODE_TEXT_LINE_HEIGHT, + /** + * @brief Sets the style and color attributes of the text decoration line. The interface supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Text decoration line style {@link ArkUI_TextDecorationType}. The default value is ARKUI_TEXT_DECORATION_TYPE_NONE. \n + * .value[1]?.u32: color of the decoration line. The value is in the format of 0xargb. For example, 0xFFFF0000 indicates red.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Text decoration line style {@link ArkUI_TextDecorationType}; \n + * .value[1].u32: color of the decoration line, in the 0xargb format.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_TEXT_DECORATION_TYPE_NONE}, {.u32=0xFFFF0000}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_DECORATION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_DECORATION); + * auto nodeDecorationStyle = item->value[0].i32; + * auto nodeDecorationColor = item->value[1].u32; + * @endcode + * + */ + NODE_TEXT_DECORATION, + /** + * @brief The attributes of text are uppercase and lowercase. The interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 indicates that the text is case-sensitive.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 indicates that the text is case-sensitive.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textCase[] = {{.i32 = static_cast(ArkUI_TextCase.ARKUI_TEXT_CASE_LOWER)}} + * ARKUI_AttributeItem item = {.value = textCase, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_CASE); + * auto textCase = item->value[0].i32 + * @endcode + * + */ + NODE_TEXT_CASE, + /** + * @brief Character spacing attribute of the text. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32 indicates the character spacing, in fp \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32 indicates the character spacing, in fp \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue letterSpacing[] = {20} + * ARKUI_AttributeItem item = {.value = letterSpacing, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_LETTER_SPACING); + * auto letterSpacing = item->value[0].f32 + * @endcode + * + */ + NODE_TEXT_LETTER_SPACING, + /** + * @brief Attribute of the maximum number of text lines. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 indicates the maximum number of lines.\n + * \n + * Format of the return value {@link ArkUI_AttributeItem} of the attribute obtaining method:\n + * .value[0].i32 indicates the maximum number of lines.\n + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue maxLine[] = {{.i32 = 2}}; + * ARKUI_AttributeItem item = {.value = maxLine, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_LINES, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_LINES); + * auto maxLines = item->value[0].i32 + * @endcode + */ + NODE_TEXT_MAX_LINES, + /** + * @brief Text horizontal alignment mode, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: indicates the horizontal alignment mode of the text. The value is the enumerated value of {@link ArkUI_TextAlign}.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: indicates the horizontal alignment mode of the text. The value is the enumerated value of {@link ArkUI_TextAlign}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue alignMent[] = {{.i32 = static_cast(ArkUI_TextAlign.ARKUI_TEXT_ALIGN_CENTER)}}; + * ARKUI_AttributeItem item = {.value = alignMent, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_ALIGN); + * auto alignMent = item->value[0].i32 + * @endcode + */ + NODE_TEXT_ALIGN, + /** + * @brief Display mode attribute when the text length is too long. The attribute setting, resetting, and obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Indicates the display mode when the text is too long.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Indicates the display mode when the text is too long.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textOverFlow[] = {{.i32 = static_cast(ArkUI_TextOverFlow.ARKUI_TEXT_OVERFLOW_CLIP)} + *}; + * ARKUI_AttributeItem item = {.value = textOverFlow, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_OVERFLOW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_OVERFLOW); + * auto textOverFlow = item->value[0].i32 + * @endcode + */ + NODE_TEXT_OVERFLOW, + /** + * @brief Text Font list attribute, which supports attribute setting, resetting, and obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .string: character string. Separate multiple characters with commas (,). + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string: character string. Separate multiple characters with commas (,). + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_AttributeItem item = {.string = "HarmonyOS Sans"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_FONT_FAMILY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_FONT_FAMILY); + * auto font = item->string; + * @endcode + * + */ + NODE_FONT_FAMILY, + /** + * @brief Text copy and paste attributes, which support the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: copy and paste mode {@link ArkUI_CopyOptions}. The default value is AKUI_COPY_OPTIONS_NONE.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: copy and paste mode {@link ArkUI_CopyOptions}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_COPY_OPTIONS_NONE}}; + * ArkUI_AttributeItem item = {value, 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_COPY_OPTION, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_COPY_OPTION); + * auto nodeTextCopyOption = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_COPY_OPTION, + /** + * @brief Offset attribute of the text baseline, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: offset value, in fp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: offset value, in fp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {10}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_BASELINE_OFFSET); + * auto nodeTextBaselineOffset = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_BASELINE_OFFSET, + /** + * @brief Text shadow effect attribute. The attribute setting, resetting, and obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: shadow blur radius, in vp.\n + * .value[1].i32: shadow type {@link ArkUI_ShadowType}. The default value is AKUI_SHADOW_TYPE_COLOR.\n + * .value[2].u32: shadow color, in the format of 0xargb. For example, 0xFFFF0000 indicates red.\n + * .value[3].f32: X-axis offset of the shadow, in vp.\n + * .value[4].f32: offset of the Y axis of the shadow, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: shadow blur radius, in vp.\n + * .value[1].i32: shadow type {@link ArkUI_ShadowType}; \n + * .value[2].u32: shadow color, in 0xargb format.\n + * .value[3].f32: X-axis offset of the shadow, in vp.\n + * .value[4].f32: offset on the Y axis of the shadow, in vp.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {10, {.i32=ARKUI_SHADOW_TYPE_COLOR}, {.u32=0xFFFF0000}, 10, 10}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TEXT_TEXT_SHADOW); + * auto nodeTextShadowRadius = item->value[0].f32; + * auto nodeTextShadowType = item->value[1].i32; + * auto nodeTextShadowColor = item->value[2].u32; + * auto nodeTextShadowOffsetX = item->value[3].f32; + * auto nodeTextShadowOffsetY = item->value[4].f32; + * @endcode + * + */ + NODE_TEXT_TEXT_SHADOW, + + /** + * @brief Text Minimum display font size, which supports attribute setting, resetting, and obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .value[0].f32: minimum font size, in FP. + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: minimum font size, in FP. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {20}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MIN_FONT_SIZE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_MIN_FONT_SIZE, + + /** + * @brief Text Maximum font size to be displayed. Attributes can be set, reset, and obtained. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .value[0].f32: maximum font size of the text, in FP. + * \n + * Return value of the method for obtaining attributes {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: maximum font size of the text, in FP. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {20}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_MAX_FONT_SIZE); + * auto value = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_MAX_FONT_SIZE, + + /** + * @brief Text, which supports attribute setting, attribute reset, and attribute obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .string?: list of optional value fonts. Use multiple fonts separated by commas.\n + * .value[0].f32: Text size unit FP.\n + * .value[1]?.i32: specifies the font thickness of the text. The parameter type is {@link ArkUI_FontWeight}. This parameter is optional. + * Default value is AKUI_FONT_WEIGHT_NORMAL.\n + * .value[2]?.i32: Optional. Font style. Parameter type {@link ArkUI_FontStyle}. + * The default value is ARKUI_TEXT_FONT_STYLE_NORMAL. + * \n + * Format of the return value of the attribute obtaining method {@link ArkUI_AttributeItem}:\n + * .string?: list of optional value fonts. Use multiple fonts separated by commas.\n + * .value[0].f32: text size unit FP.\n + * .value[1]?.i32: specifies the font thickness of the text. The parameter type is {@link ArkUI_FontWeight}. This parameter is optional. + * Default value is RKUI_FONT_WEIGHT_NORMAL.\n + * .value[2]?.i32: Optional. Font style. Parameter type {@link ArkUI_FontStyle}. + * The default value is ARKUI_TEXT_FONT_STYLE_NORMAL. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {16, {.i32 = ARKUI_FONT_STYLE_NORMAL}, + * {.i32 = ARKUI_TEXT_FONT_STYLE_NORMAL}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_FONT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_FONT); + * auto size = item->value[0].f32; + * @endcode + * + */ + NODE_TEXT_FONT, + + /** + * @brief Text Height adaptation mode, which supports attribute setting, resetting, and obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .value[0].i32: parameter type {@link ArkUI_TextHeightAdaptivePolicy}. + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: parameter type {@link ArkUI_TextHeightAdaptivePolicy}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_HEIGHT_ADAPTIVE_POLICY); + * auto size = item->value[0].i32; + * @endcode + * + */ + NODE_TEXT_HEIGHT_ADAPTIVE_POLICY, + + /** + * @brief Indent attribute of the first line of the text. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: Indicates the first line indented value.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Indicates the first line indented value.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue textIndent[] = {20} + * ARKUI_AttributeItem item = {.value = textIndent, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_INDENT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_TEXT_INDENT); + * auto indentValue = item->value[0].f32 + * @endcode + */ + NODE_TEXT_INDENT, + + /** + * @brief This interface is used to set image address attributes for the image component. The interface supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string indicates the address of the image component.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string indicates the address of the image component.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_AttributeItem item = {.string = "https://www.example.com/xxx.png"}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_SRC, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_SRC); + * auto imageSrc = item->string + * @endcode + */ + NODE_IMAGE_SRC = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, + /** + * @brief Image filling effect attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 indicates the image filling effect, which is the enumerated value {@link ArkUI_ObjectFit}.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 indicates the image filling effect, which is the enumerated value {@link ArkUI_ObjectFit}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_NumberValue objectFitValue[] = {.i32 = {static_cast(ArkUI_ObjectFit.ARKUI_OBJECT_FIT_FILL)}}; + * ARKUI_AttributeItem item = {.value = objectFitValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_FIT); + * auto objectFit = item->value[0].i32 + * @endcode + */ + NODE_IMAGE_OBJECT_FIT, + /** + * @brief Image interpolation effect attributes. The interfaces for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 indicates the interpolation effect. The enumerated value is {@link ArkUI_ImageInterpolation}.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 indicates the interpolation effect. The enumerated value is {@link ArkUI_ImageInterpolation}.\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_NumberValue interpolationValue[] = {.i32 = { + * static_cast(ArkUI_ImageInterpolation.ARKUI_INTERPOLATION_LOW)}}; + * ARKUI_AttributeItem item = {.value = interpolationValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_INTERPOLATION); + * auto interpolation = item->value[0].i32 + * @endcode + */ + NODE_IMAGE_INTERPOLATION, + /** + * @brief Image repetition style attribute, which supports attribute setting, attribute reset, and attribute obtaining interfaces. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 indicates the image repetition style. The enumerated value is {@link ArkUI_ImageRepeat}.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 indicates the image repetition style. The enumerated value is {@link ArkUI_ImageRepeat}.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_NumberValue repeatValue[] = {.i32 = {static_cast(ArkUI_ImageRepeat.ARKUI_IMAGE_REPEAT_X)}}; + * ARKUI_AttributeItem item = {.value = repeatValue, .size = 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_OBJECT_REPEAT); + * auto repeat = item->value[0].i32 + * @endcode + */ + NODE_IMAGE_OBJECT_REPEAT, + /** + * @brief Image filter effect attribute. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 ~ .value[19].i32 represents the filter matrix array\n + * .size indicates the size of the filter array 5*4 \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 ~ .value[19].i32 represents the filter matrix array\n + * .size indicates the size of the filter array 5*4 \n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_NumberValue filterValue[] = {.i32 = {1}, .i32 = {0}, .i32 = {0}, .i32 = {0}, .i32 = {0}, .i32 = {0}, .i32 + * = {1}, .i32 = {0}, .i32 = {0}, .i32 = {0}, .i32 = {0}, .i32 = {0}, .i32 = {1}, .i32 = {0}, .i32 = {0}, .i32 = + * {0}, .i32 = {0}, .i32 = {0}, .i32 = {1}, .i32 = {0}}; + * ARKUI_AttributeItem item = {.value = filterValue, .size = sizeof(filterValue)/ sizeof(ARKUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_COLOR_FILTER); + * auto colorFilter = item->value + * @endcode + */ + NODE_IMAGE_COLOR_FILTER, + /** + * @brief The automatic scaling attribute of the image source supports the interface for setting, resetting, and obtaining the attribute. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32 Indicates whether a Boolean value is scaled.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32 Indicates whether a Boolean value is scaled.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_NumberValue resizeValue[] = {.i32 = true}; + * ARKUI_AttributeItem item = {.value = resizeValue, .size = 1}} + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_AUTO_RESIZE); + * auto autoResize = item->value[0].i32 + * @endcode + */ + NODE_IMAGE_AUTO_RESIZE, + /** + * @brief Placeholder map address attribute, which supports the interface for setting, resetting, and obtaining attributes. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .string indicates the address of the image component bitholder.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .string indicates the address of the image component bitholder.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ARKUI_AttributeItem item = {.string = "/pages/loading.png"} + * nativeNodeApi->setAttribute(nodeHandle, NODE_IMAGE_ALT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_IMAGE_ALT); + * auto altStr = item->string + * @endcode + */ + NODE_IMAGE_ALT, + + /** + * @brief Background color attribute of the enabled component. The attribute setting, resetting, and obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].u32: indicates the background color. The value is in the 0xargb format. For example, 0xFFFF0000 indicates red.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].u32: background color, in 0xargb format.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.u32=0xFFFF0000}}; + * ArkUI_AttributeItem item = {value, 1}; + * basicNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TOGGLE_SELECTED_COLOR); + * auto nodeToggleSelectedColor = item->value[0].u32; + * @endcode + * + */ + NODE_TOGGLE_SELECTED_COLOR = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, + /** + * @brief Color attribute of the round slider of the Switch type. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].u32: color value of the circular slider. The value is in the 0xargb format. For example, 0xFFFF0000 indicates red.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].u32: color value of the circular slider, in 0xargb format.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi - reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.u32=0xFFFF0000}}; + * ArkUI_AttributeItem item = {value, 1}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR, &item); + * auto item = nativeNodeApi=>getAttribute(nodeHandle, NODE_TOGGLE_SWITCH_POINT_COLOR); + * auto nodeSwitchPointColor = item->value[0].u32; + * @endcode + * + */ + NODE_TOGGLE_SWITCH_POINT_COLOR, + + /** + * @brief Alignment mode of a subcomponent in a container. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: alignment mode. The data type is {@link ArkUI_Alignment}. The default value is AKUI_ALIGNMENT_CENTER.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Alignment mode, data type {@link ArkUI_Alignment}.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_ALIGNMENT_CENTER}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_STACK_ALIGN_CONTENT); + * auto nodeStackAlignContent = item->value[0].i32; + * @endcode + */ + NODE_STACK_ALIGN_CONTENT = MAX_NODE_SCOPE_NUM * ARKUI_NODE_STACK, + /** + * @brief Status of the scroll bar of a scrolling component. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: scroll bar status, data type {@link + * ArkUI_ScrollBarDisplayMode}, default ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: scroll bar status, data type {@link ArkUI_ScrollBarDisplayMode}.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_DISPLAY_MODE); + * auto nodeScrollBarDisplayMode = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_BAR_DISPLAY_MODE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, + /** + * @brief Width of the scroll bar of a scrolling component. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: scroll bar width, in vp. The default value is 4. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: scroll bar width, in vp.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {20}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_WIDTH); + * auto nodeScrollBarWidth = item->value[0].f32; + * @endcode + * + */ + NODE_SCROLL_BAR_WIDTH, + /** + * @brief Scroll bar color of a scrolling component. Attribute setting, attribute reset, and attribute obtaining are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .data[0].u32: scroll bar color, 0xargb type.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .data[0].u32: scroll bar color, 0xargb type.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.u32 = 0xFFFFFFFF}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_BAR_COLOR); + * auto nodeScrollBarColor = item->value[0].u32; + * @endcode + * + */ + NODE_SCROLL_BAR_COLOR, + /** + * @brief Scrolling direction of the Scroll component. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: scrolling direction, data type {@link ArkUI_Axis}, default value AKUI_AXIS_VERSICAL.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: scrolling direction, data type {@link ArkUI_Axis}.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_AXIS_VERTICAL}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SCROLL_DIRECTION); + * auto nodeScrollBarDirection = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_SCROLL_DIRECTION, + /** + * @brief Edge sliding effect of a scrolling component. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: edge sliding effect. Parameter type: {@link ArkUI_EdgeEffect}. Default value: ARKUI_EDGE_EFFECT_NONE.\n + * .value[1]?.i32: Specifies whether to enable the sliding effect when the size of the component content is smaller than that of the component itself. The value can be 1, and the value can be 0. The default value is 1. + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: edge sliding effect. Parameter type: {@link ArkUI_EdgeEffect}.\n + * .value[1]?.i32: Specifies whether to enable the sliding effect when the widget content size is smaller than the widget itself. The options are as follows: 1 If yes, 0 If no.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_EDGE_EFFECT_NONE}, {.i32 = 1}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_EDGE_EFFECT); + * auto nodeScrollEdgeEffect = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_EDGE_EFFECT, + /** + * @brief Indicates whether the scrolling component supports the scrolling gesture. If this parameter is set to false, the scrolling function cannot be performed by finger or mouse, but the scrolling interface of the controller is not affected. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: whether to support scrolling gestures. The default value is true.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: whether to support scrolling gestures.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = true}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_SCROLL_INTERACTION); + * auto nodeScrollEnableScroll = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_ENABLE_SCROLL_INTERACTION, + /** + * @brief Rolling friction coefficient of rolling components, which takes effect when the rolling area is manually moved. It only affects the inertial rolling process and indirectly affects the chain effect during inertial rolling. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: friction coefficient. The default value is 0.6 for non-wearable devices and 0.9 for wearable devices.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: friction coefficient. + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {0.6}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_FRICTION, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_FRICTION); + * auto nodeScrollFriction = item->value[0].f32; + * @endcode + * + */ + NODE_SCROLL_FRICTION, + /** + * @brief Limit scrolling mode of the scrolling component, which supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: mode for the Scroll component to limit the scrolling. The data type is {@link ArkUI_ScrollSnapAlign}. The default value is ARKUI_SCROLL_SNAP_ALIGN_NONE. \n + * .value[1].i32: In the limit scroll mode of the Scroll component, if this property is set to false, the Scroll component slides freely between the start point and the first limit point. The default value is true. This parameter is valid only when there are multiple limit points.\n + * .value[2].i32: In the limit scroll mode of the Scroll component, if this property is set to false, the Scroll component slides freely between the last limit point and the end. The default value is true. This parameter is valid only when there are multiple limit points.\n + * .value[3...].f32: limit point of the Scroll component during scrolling. The limit point is the offset by which the Scroll component can slide and dock. You can have one or more.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: mode for the Scroll component to limit the scrolling. The data type is {@link ArkUI_ScrollSnapAlign}. \n + * .value[1].i32: In the limit scroll mode of the Scroll component, if this property is set to false, the Scroll component slides freely between the start and the first limit point.\n + * .value[2].i32: In the limit scroll mode of the Scroll component, if this property is set to false, the scroll can slide freely between the last limit point and the end.\n + * .value[3...].f32: limit point of the Scroll component during scrolling. The limit point is the offset of the Scroll component that can slide and dock.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = { + * {.i32=ARKUI_SCROLL_SNAP_ALIGN_NONE}, {.i32=true}, {.i32=true}, + * {.f32=0}, {.f32=500}, {.f32=1000}, {.f32=1500} + *}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_SNAP, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_SNAP); + * auto nodeScrollSnap = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_SNAP, + + /** + * @brief Nested scrolling option of the scrolling component, which supports attribute setting, attribute reset, and attribute obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .value[0]?.i32: nested scrolling when the scrollable component scrolls to the end, parameter type {@link ArkUI_ScrollNestedMode}.\n + * .value[1]?.i32: nested scrolling when the scrollable component scrolls to the start end. The parameter type is {@link ArkUI_ScrollNestedMode}. + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0]?.i32: nested scrolling when the scrollable component scrolls to the end, parameter type {@link ArkUI_ScrollNestedMode}.\n + * .value[1]?.i32: nested scrolling when a scrollable component scrolls to the start end. The parameter type is {@link ArkUI_ScrollNestedMode}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_NESTED_MODE_SELF_ONLY}, + * {.i32 = ARKUI_SCROLL_NESTED_OPTIONS_SELF_ONLY}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_NESTED_SCROLL); + * auto first = item->value[0].i32; + * auto second = item->value[1].i32; + * @endcode + * + */ + NODE_SCROLL_NESTED_SCROLL, + /** + * @brief Scroll to the specified position. The attribute setting, reset, and obtaining are supported. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .value[0].f32: horizontal sliding offset, in vp.\n + * .value[1].f32: vertical sliding offset, in vp.\n + * .value[2]?.i32: indicates whether to enable the default spring effect. The default value is 0. + * .value[3]?.i32: scrolling duration, in milliseconds.\n + * .value[4]?.i32: optional, scrolling curve, parameter type {@link ArkUI_AnimationCurve}. The default value is RKUI_CURVE_EASE.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: horizontal sliding offset, in vp.\n + * .value[1].f32: vertical sliding offset, in vp.\n + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {10, 100, {.i32 = 1000}, {.i32 = ARKUI_CURVE_EASE}, + * {.i32 = 1}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_OFFSET, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_OFFSET); + * auto x = item->value[0].f32; + * auto y = item->value[1].f32; + * @endcode + * + */ + NODE_SCROLL_OFFSET, + + /** + * @brief Scroll Scroll to the container edge, which supports attribute setting, resetting, and obtaining. + * + * Parameter format of the attribute setting method {@link ArkUI_AttributeItem}:\n + * .value[0].i32: container edge. The parameter type is {@link ArkUI_ScrollEdge}. + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: container edge. The parameter type is {@link ArkUI_ScrollEdge}. + * + * @code {.c} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SCROLL_EDGE_TOP}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SCROLL_EDGE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SCROLL_EDGE); + * auto value = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_EDGE, + + /** + * @brief Indicates whether to support sliding page turning, attribute setting, attribute reset, and attribute obtaining. + * + * If both the enablePaging and limit scrollSnap parameters are set, scrollSnap takes effect first, and enablePaging does not take effect.\n + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: indicates whether to support page turning by page. The default value is false.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: indicates whether to support page turning.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = true}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_SCROLL_ENABLE_PAGING); + * auto nodeScrollEnablePaging = item->value[0].i32; + * @endcode + * + */ + NODE_SCROLL_ENABLE_PAGING, + + /** + * @brief List direction, which supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Indicates the arrangement direction of the List component. The data type is {@link ArkUI_Axis}. The default value is AKUI_AXIS_VERSTIC.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: arrangement direction of the List component, data type {@link ArkUI_Axis}.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_AXIS_VERTICAL}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_LIST_DIRECTION, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_LIST_DIRECTION); + * auto nodeListDirection = item->value[0].i32; + * @endcode + * + */ + NODE_LIST_DIRECTION = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST, + /** + * @brief Set whether the header and footer in ListItemGroup need to be installed on the top or bottom. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: used together with the ListItemGroup component to set whether the header and footer in the ListItemGroup need to be installed on the top or bottom. Data type {@link ArkUI_StickyStyle}. Default value + * AKUI_STICKY_ ??_:00-20:00_NONE.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: used together with the ListItemGroup component to set whether the header and footer in the ListItemGroup need to be installed on the top or bottom. Data type {@link ArkUI_StickyStyle}. + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_STICKY_STYLE_NONE}}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_LIST_STICKY, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_LIST_STICKY); + * auto nodeListSticky = item->value[0].i32; + * @endcode + * + */ + NODE_LIST_STICKY, + + /** + * @brief List item spacing, which supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: interval in the direction of the main axis of the subassembly. Default value: 0.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Interval in the direction of the main axis of the subassembly.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {10}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_LIST_SPACE, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_LIST_SPACE); + * auto nodeListSpace = item->value[0].f32; + * @endcode + * + */ + NODE_LIST_SPACE, + + /** + * @brief Whether to enable the loop function of the swiper. The interface supports the attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: specifies whether to enable the loop. The value 0 indicates no loop, and the value 1 indicates loop. The default value is 1. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: specifies whether to enable the loop. The value 0 indicates no loop, and the value 1 indicates loop. The default value is 1. \n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.i32 = 0}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_LOOP, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_LOOP); + * auto nodeSwiperLoop = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_LOOP = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SWIPER, + /** + * @brief Indicates whether to automatically play the subcomponent of the swiper. The interface supports attribute setting, attribute resetting, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: controls whether to play the subcomponent automatically. The value 0 indicates not to play the subcomponent automatically, and the value 1 indicates to play the subcomponent automatically. The default value is 0. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: controls whether to play the subcomponent automatically. The value 0 indicates not to play the subcomponent automatically, and the value 1 indicates to play the subcomponent automatically. The default value is 0. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = 1}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_AUTO_PLAY); + * auto nodeSwiperLoop = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_AUTO_PLAY, + /** + * @brief Whether to display the navigation point indicator on the swiper. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Indicates whether to display the navigation point indicator. The value 0 indicates that the navigation point indicator is not displayed, and the value 1 indicates that the navigation point indicator is displayed. The default value is 1. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Indicates whether to display the navigation point indicator. The value 0 indicates that the navigation point indicator is not displayed, and the value 1 indicates that the navigation point indicator is displayed. The default value is 1. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = 0}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_INDICATOR); + * auto nodeSwiperShowIndicator = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_SHOW_INDICATOR, + /** + * @brief Set the interval for automatically playing the Swiper. The interface supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: Interval for playing autoplay, in milliseconds.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Interval for playing autoplay, in milliseconds.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {3000}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INTERVAL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_INTERVAL); + * auto nodeSwiperInterval = item->value[0].f32; + * @endcode + * + */ + NODE_SWIPER_INTERVAL, + /** + * @brief This interface is used to set whether the Swiper is swiped vertically. The interface supports attribute setting, attribute reset, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: indicates whether the vertical sliding mode is used. The value 0 indicates horizontal sliding and the value 1 indicates vertical sliding. The default value is 0. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: indicates whether the vertical sliding mode is used. The value 0 indicates horizontal sliding and the value 1 indicates vertical sliding. The default value is 0. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = 1}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_VERTICAL, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_VERTICAL); + * auto nodeSwiperVertical = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_VERTICAL, + + /** + * @brief Set the duration for switching the animation of the Swiper subcomponent. The interface supports attribute setting, attribute resetting, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: animation duration for switching subcomponents, in milliseconds. The default value is 400.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: animation duration for switching subcomponents, in milliseconds. The default value is 400.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {1000}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DURATION, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DURATION); + * auto nodeSwiperVertical = item->value[0].f32; + * @endcode + * + */ + NODE_SWIPER_DURATION, + + /** + * @brief Sets the Swiper animation curve. The APIs for setting, resetting, and obtaining attributes are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Sets the animation curve parameters. The parameter type is {@link ArkUI_AnimationCurve}. The default value is ARKUI_CURVE_LINEAR.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Sets the animation curve parameters. The parameter type is {@link ArkUI_AnimationCurve}. The default value is ARKUI_CURVE_LINEAR.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_CURVE_SHARP}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_CURVE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_CURVE); + * auto nodeSwiperVertical = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_CURVE, + + /** + * @brief Sets the gap between the Swiper subcomponents. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].f32: Value of the gap between subcomponents.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].f32: Value of the gap between subcomponents.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {10}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperVertical = item->value[0].f32; + * @endcode + * + */ + NODE_SWIPER_ITEM_SPACE, + + /** + * @brief Set the index value of the subcomponents displayed in the container of the swiper. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Index value of the subcomponent.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Index value of the subcomponent.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{i32 = 3}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_INDEX, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperIndex = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_INDEX, + + /** + * @brief Set the number of elements to be displayed on a page of the swiper. The interface supports attribute setting, attribute resetting, and attribute obtaining. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: Index value of the subcomponent.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: Index value of the subcomponent.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{i32 = 3}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISPLAY_COUNT, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_ITEM_SPACE); + * auto nodeSwiperDisplayCount = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_DISPLAY_COUNT, + + /** + * @brief Disables the sliding switchover function of the swiper. The interface for setting, resetting, and obtaining attributes is supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: indicates whether to disable the sliding switch function of the component. The value 0 indicates that the sliding switch function is disabled, and the value 1 indicates that the sliding switch function is disabled. The default value is 0. \n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: indicates whether to disable the sliding switch function of the component. The value 0 indicates that the sliding switch function is disabled, and the value 1 indicates that the sliding switch function is disabled. The default value is 0. \n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = 1}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_DISABLE_SWIPE); + * auto nodeSwiperDisplayCount = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_DISABLE_SWIPE, + + /** + * @brief This interface is used to set whether the Swiper displays the navigation point arrow. Attribute setting, attribute reset, and attribute obtaining interfaces are supported. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].i32: indicates whether to display the navigation point arrow. Parameter type: {@link ArkUI_SwiperDisplayArrow}, \n + * The default is ARKUI_SWIPER_ARROW_FALSE.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].i32: indicates whether to display the navigation point arrow. Parameter type: {@link ArkUI_SwiperDisplayArrow}, \n + * The default is ARKUI_SWIPER_ARROW_FALSE.\n + * + * @code {.cpp} + * ArkUI_NativeNodeAPI_1* nativeNodeApi = + * reinterpret_cast(OH_ArkUI_GetNativeAPI(ARKUI_NATIVE_NODE, 1)); + * ArkUI_NumberValue value[] = {{.i32 = ARKUI_SWIPER_ARROW_SHOW_ON_HOVER}}; + * ArkUI_AttributeItem item = {value, sizeof(value)/sizeof(ArkUI_NumberValue)}; + * nativeNodeApi->setAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW, &item); + * auto item = nativeNodeApi->getAttribute(nodeHandle, NODE_SWIPER_SHOW_DISPLAY_ARROW); + * auto nodeSwiperDisplayCount = item->value[0].i32; + * @endcode + * + */ + NODE_SWIPER_SHOW_DISPLAY_ARROW, + + /** + * @brief ListItemGroup header component. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .object: Use the {@link ArkUI_NodeHandle} object as the ListItemGroup header component.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .object: Use the {@link ArkUI_NodeHandle} object as the ListItemGroup header component.\n + * + * @code {.cpp} + * auto header = nodeAPI->createNode(ARKUI_NODE_TEXT); + * ARKUI_AttributeItem item = {.object = header}; + * basicNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_HEADER); + * auto nodeListItemGroupSetHeader = item->object; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_HEADER = MAX_NODE_SCOPE_NUM * ARKUI_NODE_LIST_ITEM_GROUP, + /** + * @brief ListItemGroup tail component. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .object: Use the {@link ArkUI_NodeHandle} object as the ListItemGroup tail component.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .object: Use the {@link ArkUI_NodeHandle} object as the ListItemGroup tail component.\n + * + * @code {.cpp} + * auto footer = nodeAPI->createNode(ARKUI_NODE_TEXT); + * ARKUI_AttributeItem item = {.object = footer}; + * basicNodeApi->setAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_LIST_ITEM_GROUP_SET_FOOTER); + * auto nodeListItemGroupSetFooter = item->value[0].object; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_FOOTER, + /** + * @brief ListItemGroup separator style. By default, there is no separator. Attributes can be set, reset, and obtained. + * + * Attribute setting method parameter {@link ArkUI_AttributeItem} format:\n + * .value[0].u32: color, 0xargb type; \n + * .value[1].f32: width of the split line, in vp.\n + * .value[2].f32: distance between the split line and the start end of the side of the list, in vp.\n + * .value[3].f32: distance between the split line and the end of the list, in vp.\n + * \n + * Return value {@link ArkUI_AttributeItem} format of the attribute obtaining method:\n + * .value[0].u32: color, 0xargb type; \n + * .value[1].f32: width of the split line, in vp.\n + * .value[2].f32: distance between the split line and the start end of the side of the list, in vp.\n + * .value[3].f32: distance between the split line and the end of the list, in vp.\n + * + * @code {.cpp} + * ArkUI_NumberValue value[] = {{.u32 = 0xFFFFFFFF}, 1, 0, 0}; + * ARKUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; + * basicNodeApi->setAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE, &item); + * auto item = basicNodeApi=>getAttribute(nodeHandle, NODE_XCOMPONENT_SURFACE_SIZE); + * auto nodeXcomponentSurfaceSize = item->value[0].i32; + * @endcode + */ + NODE_LIST_ITEM_GROUP_SET_DIVIDER, +} ArkUI_NodeAttributeType; + +#define MAX_COMPONENT_EVENT_ARG_NUM 12 +/** + * @brief Defines the parameter type of the component callback event. + * + * @since 12 + */ +typedef struct { + /** Data array object.*/ + ArkUI_NumberValue data[MAX_COMPONENT_EVENT_ARG_NUM]; +} ArkUI_NodeComponentEvent; + +/** + * @brief Defines the type of the character string parameter used by the component callback event. + * + * @since 12 + */ +typedef struct { + /** String data.*/ +const char* pStr; +} ArkUI_StringAsyncEvent; + +/** + * @brief Provides the definitions of the event types supported by the NativeNode component. + * + * @since 12 + */ +typedef enum { + /** + * @brief Gesture event type. + * + * When an event callback occurs, the union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_TouchEvent}. + */ + NODE_TOUCH_EVENT = 0, + + /** + * @brief Mounting event. + * + * Condition for triggering this event: This callback is triggered when a component is mounted to the display.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurs.\n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_EVENT_ON_APPEAR, + + /** + * @brief Component area change event + * + * Condition for triggering this event: This callback is triggered when the component area changes.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurs.\n + * ::ArkUI_NodeComponentEvent contains 12 parameters.\n + * ArkUI_NodeComponent.data[0].f32 indicates the width of the target element in the old area. The type is number, in vp.\n + * ArkUI_NodeComponent.data[1].f32 indicates the height of the target element in the old area. The type is number and the unit is vp.\n + * ArkUI_NodeComponent.data[2].f32 indicates the x-axis coordinate of the position of the upper left corner of the target element in the old area relative to the upper left corner of the parent element. The type is number, in vp.\n + * ArkUI_NodeComponent.data[3].f32 indicates the y-axis coordinate of the position of the upper left corner of the target element in the old area relative to the upper left corner of the parent element. The type is number, in vp.\n + * ArkUI_NodeComponent.data[4].f32 indicates the x-axis coordinate of the position of the upper left corner of the target element in the old area relative to the upper left corner of the page. The type is number, in vp.\n + * ArkUI_NodeComponent.data[5].f32 indicates the y-axis coordinate of the position of the upper left corner of the target element in the old area relative to the upper left corner of the page. The type is number, in vp.\n + * ArkUI_NodeComponent.data[6].f32 indicates the width of the target element in the new area. The type is number and the unit is vp.\n + * ArkUI_NodeComponent.data[7].f32 indicates the height of the target element in the new area. The type is number and the unit is vp.\n + * ArkUI_NodeComponent.data[8].f32 indicates the x-axis coordinate of the position of the upper left corner of the new Area target element relative to the upper left corner of the parent element. The type is number, in vp.\n + * ArkUI_NodeComponent.data[9].f32 indicates the Y-axis coordinate of the position of the upper left corner of the target element in the new Area relative to the upper left corner of the parent element. The type is number, in vp.\n + * ArkUI_NodeComponent.data[10].f32 indicates the x-axis coordinate of the position of the target element in the upper left corner of the new Area target element relative to the upper left corner of the page. The type is number, in vp.\n + * ArkUI_NodeComponent.data[11].f32 indicates the y-axis coordinate of the position of the target element in the upper left corner of the new Area target element relative to the upper left corner of the page. The type is number, in vp.\n + */ + NODE_EVENT_ON_AREA_CHANGE, + /** + * @brief Focus event. + * + * Condition for triggering this event: This callback is triggered when the component is in focus.\n + * When the event callback occurred, the union type in the {@link ArkUI_NodeEvent} object of the event parameter was {@link ArkUI_NodeComponentEvent}.\n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_ON_FOCUS, + /** + * @brief Focus event. + * + * Condition for triggering this event: This callback is triggered when the component is in focus.\n + * When the event callback occurred, the union type in the {@link ArkUI_NodeEvent} object of the event parameter was {@link ArkUI_NodeComponentEvent}.\n + * {@link ArkUI_NodeComponentEvent} does not contain parameters. + */ + NODE_ON_BLUR, + /** + * @brief Click event type. + * + * When an event callback occurs, the union type in the {@link ArkUI_NodeEvent} object of the event parameter {@link ArkUI_TouchEvent} is {@link ArkUI_TouchEvent}, which contains the touch point information in the hand-lifting phase. + */ + NODE_ON_CLICK, + + /** + * @brief Image loading success event. + * + * This event is triggered when the image data is successfully loaded and decoded.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurred.\n + * ::ArkUI_NodeComponentEvent contains nine parameters:\n + * ArkUI_NodeComponent.data[0].i32 indicates the loading status. The value 0 indicates that the data is loaded successfully, and the value 1 indicates that the decoding succeeds.\n + * ArkUI_NodeComponent.data[1].f32 indicates the width of the image, in px.\n + * ArkUI_NodeComponent.data[2].f32 indicates the image height, in px.\n + * ArkUI_NodeComponent.data[3].f32 indicates the width of the current component, in px.\n + * ArkUI_NodeComponent.data[4].f32 indicates the height of the current component, in px.\n + * ArkUI_NodeComponent.data[5].f32Position of the image drawing area relative to the X axis of the component, in px.\n + * ArkUI_NodeComponent.data[6].f32Position of the drawing area relative to the Y axis of the component, in px.\n + * ArkUI_NodeComponent.data[7].f32 Width of the drawing area, in px.\n + * ArkUI_NodeComponent.data[8].f32: image drawing area height, in px.\n + */ + NODE_IMAGE_ON_COMPLETE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_IMAGE, + /** + * @brief Image loading failure event. + * + * Condition for triggering this event: This callback is triggered when the image loading is abnormal.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurs.\n + * ::ArkUI_NodeComponentEvent contains 1 parameter:\n + * ArkUI_NodeComponent.data[0].i32Error code information:\n + * 401: The image path parameter is abnormal. The image data cannot be obtained.\n + * 103101: Picture format not supported.\n + */ + NODE_IMAGE_ON_ERROR, + + /** + * @brief Image loading failure event. + * + * This event is triggered when the SVG picture animation that drives the effect ends.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurs.\n + * ::ArkUI_NodeComponentEvent does not contain parameters. + * + */ + NODE_IMAGE_ON_SVG_PLAY_FINISH, + + /** + * @brief This event is triggered when the switch status changes. + * + * This event is triggered when the switch status changes.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurs.\n + * ::ArkUI_NodeComponentEvent contains one parameter:\n + * ArkUI_NodeComponent.data[0].i32: status of the current switch. The value 1 indicates that the switch is enabled, and the value 0 indicates that the switch is disabled. + * + */ + NODE_TOGGLE_ON_CHANGE = MAX_NODE_SCOPE_NUM * ARKUI_NODE_TOGGLE, + /** + * @brief Defines the scrolling event enumeration values of the AKUI_NODE_SCROLL scrolling component. + * + * Trigger conditions for this event:\n + * 1. When the scrolling component triggers scrolling, other input settings for triggering scrolling, such as keyboard and mouse operations, are supported.\n + * 2. Invoke the scrolling controller API.\n + * 3. Out-of-bounds rebound.\n + * When the event callback occurred, the union type in the {@link ArkUI_NodeEvent} object of the event parameter was {@link ArkUI_NodeComponentEvent}.\n + * ::ArkUI_NodeComponentEvent contains 2 parameters.\n + * ArkUI_NodeComponent.data[0].f32 indicates the X-axis increment from the last event trigger.\n + * ArkUI_NodeComponent.data[1].f32 indicates the Y-axis increment from the last event trigger.\n + */ + NODE_SCROLL_EVENT_ON_SCROLL = MAX_NODE_SCOPE_NUM * ARKUI_NODE_SCROLL, + /** + * @brief Defines the enumerated value of the scroll frame start event of the RKUI_NODE_SC ROLL scrolling component. + * + * Trigger conditions for this event:\n + * 1. The scrolling component triggers scrolling, including other input settings that trigger scrolling, such as keyboard and mouse operations.\n + * 2. Not triggered when the controller interface is invoked.\n + * 3. Out-of-bounds rebound is not triggered.\n + * The union type in the {@link ArkUI_NodeEvent} object was {@link ArkUI_NodeComponentEvent} when the event callback occurred.\n + * ::ArkUI_NodeComponentEvent contains 2 parameters.\n + * ArkUI_NodeComponent.data[0].f32 indicates the amount of scrolling that will occur.\n + * ArkUI_NodeComponent.data[1].i32 indicates the current scrolling status.\n + * ::ArkUI_NodeComponentEvent contains one return value.\n + * ArkUI_NodeComponent.data[0].f32In the event processing function, the actual scrolling amount can be calculated based on the application scenario and stored in data[0].f32. Scrolling is performed based on the actual scrolling amount of the returned value.\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_FRAME_BEGIN, + /** + * @brief Defines the enumerated values of the scrolling start event of the AKUI_NODE_SCROLL component. + * + * Trigger conditions for this event:\n + * 1. Triggered when the scrolling component starts to scroll. Other input settings for triggering scrolling, such as keyboard and mouse operations, are supported.\n + * 2. Start after calling the scrolling controller API, with transition effect.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurred.\n + * ::ArkUI_NodeComponentEvent contains no parameters.\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_START, + /** + * @brief Defines the enumerated values of the scrolling stop event of the AKUI_NODE_SC ROLL component. + * + * Trigger conditions for this event:\n + * 1. The scrolling component stops after triggering scrolling. Other input settings for triggering scrolling, such as keyboard and mouse operations, are supported.\n + * 2. After the API of the scrolling controller is invoked, stop with the transition effect.\n + * The union type in the {@link ArkUI_NodeEvent} object is {@link ArkUI_NodeComponentEvent} when the event callback occurs.\n + * ::ArkUI_NodeComponentEvent contains no parameters.\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_STOP, + /** + * @brief Defines the enumerated values of the scrolling edge event of the ARKUI_NODE_SCROLL component. + * + * Trigger conditions for this event:\n + * 1. The scrolling component is triggered when the scrolling component scrolls to the edge. Other input settings for triggering scrolling, such as keyboard and mouse operations, are supported.\n + * 2. Invoke the scrolling controller API.\n + * 3. Out-of-bounds rebound.\n + * When the event callback occurred, the union type in the {@link ArkUI_NodeEvent} object of the event parameter was {@link ArkUI_NodeComponentEvent}.\n + * ::ArkUI_NodeComponentEvent contains 1 parameter.\n + * ArkUI_NodeComponent.data[0].i32 indicates the upper, lower, left, and right edges that are touched.\n + */ + NODE_SCROLL_EVENT_ON_SCROLL_EDGE, +} ArkUI_NodeEventType; + +/** + * @brief Defines the common structure type of a component event. + * + * @since 12 + */ +typedef struct { + /** + * @brief Event type. + * + * @see ArkUI_NodeEventType + */ + int32_t kind; + + /** + * @brief Event ID. + * + * The event ID is transferred as a parameter when the {@link registerNodeEvent} function is invoked and can be applied to the same event entry function {@link + * registerNodeEventReceiver} dispatching logic. + */ + int32_t eventId; + /** Component object that triggers the component.*/ + ArkUI_NodeHandle node; + union { + /** Callback parameter of the touch event type.*/ + ArkUI_NodeTouchEvent touchEvent; + /** The common component event uses the callback parameter of the numeric type.*/ + ArkUI_NodeComponentEvent componentEvent; + /** The common component event uses the callback parameter of the string type.*/ + ArkUI_StringAsyncEvent stringEvent; + }; +} ArkUI_NodeEvent; + +/** + * @brief The custom component invokes ::markDirty, which is the type of the passable hide ID. + * + * @since 12 + */ +typedef enum { + /** + * @brief Resize. + * + * When the flag type is triggered, re-layout is also triggered by default. + */ + NODE_NEED_MEASURE = 1, + + /** Relay the position.*/ + NODE_NEED_LAYOUT, + /** Repaint.*/ + NODE_NEED_RENDER, +} ArkUI_NodeDirtyFlag; + +/** + * @brief ArkUI node-type API set on the Native side. + * + * @version 1 + * @since 12 + */ +typedef struct { + /** Structure version.*/ + int32_t version; + + /** + * @brief Generate the corresponding component based on {@link ArkUI_NodeType} and return the component object pointer. + * + * @param type Create a UI component node of a specified type. + * @return Return the pointer to the created component operation. If the creation fails, NULL is returned. + */ + ArkUI_NodeHandle (*createNode)(ArkUI_NodeType type); + + /** + * @brief Destroys the component object pointed to by the component pointer. + * + * @param node Component pointer object. + */ + void (*disposeNode)(ArkUI_NodeHandle node); + + /** + * @brief Mount the component to a parent node. + * + * @param parent Pointer to the parent node. + * @param child Pointer to the child node. + * @return 0: success + * 401 - Function parameter exception. + */ + int32_t (*addChild)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child); + + /** + * @brief Remove the component from the parent node. + * + * @param parent Pointer to the parent node. + * @param child Pointer to the child node. + * @return 0: success + * 401 - Function parameter exception. + */ + int32_t (*removeChild)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child); + + /** + * @brief Mount the component to a parent node after the sibling node. + * + * @param parent Pointer to the parent node. + * @param child Pointer to the child node. + * @param sibling Pointer to the previous sibling node. If the value is empty, the insertion position is at the beginning. + * @return 0: success + * 401 - Function parameter exception. + */ + int32_t (*insertChildAfter)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, ArkUI_NodeHandle sibling); + + /** + * @brief Mount the component to a parent node. The mounting position is before the sibling node. + * + * @param parent Pointer to the parent node. + * @param child Pointer to the child node. + * @param sibling Pointer to the next sibling node. If the value is empty, the insertion position is at the end. + * @return 0: success + * 401 - Function parameter exception. + */ + int32_t (*insertChildBefore)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, ArkUI_NodeHandle sibling); + + /** + * @brief Mount the component to a parent node. The mounting position is specified by position. + * + * @param parent Pointer to the parent node. + * @param child Pointer to the child node. + * @param postion Insertion Position. If the insertion position is a negative number or does not exist, the insertion position is at the end by default. + * @return 0: success + * 401 - Function parameter exception. + */ + int32_t (*insertChildAt)(ArkUI_NodeHandle parent, ArkUI_NodeHandle child, int32_t position); + + /** + * @brief Attribute setting function. + * + * @param node Node object for which attributes need to be set. + * @param attribute Type of the attribute to be set. + * @param item Attribute value to be set. + * @return 0: success. + * 401 - Function parameter exception. + * 106102 - The attribute type is not supported by the current component. + */ + int32_t (*setAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute, const ArkUI_AttributeItem* item); + + /** + * @brief Attribute obtaining function. + * + * The pointer returned by this API is the buffer pointer in the ArkUI framework. Developers do not need to call delete to release memory. However, the pointer must be used before the function is called next time. Otherwise, the pointer may be overwritten by other values. + * + * @param node Node object whose attributes need to be obtained. + * @param attribute Type of the attribute to be obtained. + * @return Attribute value of the current attribute type. If the operation fails, a null pointer is returned. + */ + const ArkUI_AttributeItem* (*getAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute); + + /** + * @brief Reset attribute function. + * + * @param node Node object whose attributes need to be reset. + * @param attribute Type of the attribute to be reset. + * @return 0: success. + * 401 - Function parameter exception. + * 106102 - The attribute type is not supported by the current component. + */ + int32_t (*resetAttribute)(ArkUI_NodeHandle node, ArkUI_NodeAttributeType attribute); + + /** + * @brief Register the node event function. + * + * @param node Node object to register the event. + * @param eventType Event type to be registered. + * @param eventId User-defined event ID, which is carried in the callback parameter <@link ArkUI_NodeEvent> when an event is triggered. + * @return 0: success. + * 401 - Function parameter exception. + * 106102 - This event type is not supported by the current component. + */ + int32_t (*registerNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType, int32_t eventId); + + /** + * @brief Event function for deregistering a node. + * + * @param node Node object whose event needs to be deregistered. + * @param eventType Event type to be deregistered. + */ + void (*unregisterNodeEvent)(ArkUI_NodeHandle node, ArkUI_NodeEventType eventType); + + /** + * @brief Register the unified entry function for event callback. + * + * The ArkUI framework collects component events generated during the process and invokes the registered eventReceiver function to call back the eventReceiver function to developers.\n + * If the function is called repeatedly, the previously registered function will be overwritten. + * + * @param eventReceiver Unified callback entry function. + */ + void (*registerNodeEventReceiver)(void (*eventReceiver)(ArkUI_NodeEvent* event)); + + /** + * @brief Unregister event callback unified entry function. + * + */ + void (*unregisterNodeEventReceiver)(); + + /** + * @brief Forcibly mark the current node that needs to be recalculated, laid out, or drawn. + * + * In the system attribute setting update scenario, the ArkUI framework automatically marks the hidden area and performs calculation, layout, or drawing again. Developers do not need to invoke this function. + * + * @param nodeThe node object that needs to be marked in the hidden area. + * @param dirtyFlag Tibetan area type. + */ + void (*markDirty)(ArkUI_NodeHandle node, ArkUI_NodeDirtyFlag dirtyFlag); +} ArkUI_NativeNodeAPI_1; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_NODE_H +/** @}*/ diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h new file mode 100644 index 000000000..1f2be26f1 --- /dev/null +++ b/arkui/ace_engine/native/native_type.h @@ -0,0 +1,689 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup ArkUI_NativeModule + * @{ + * + * @brief Provides the UI capabilities of the ArkUI on the Native side, such as UI component creation and destruction, tree node operation, attribute setting, and event listening. + * + * @since 12 + */ + +/** + * @file native_type.h + * + * @brief Provides the common type definition of the NativeModule. + * + * @library libace_ndk.z.so + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + +#ifndef ARKUI_NATIVE_TYPE_H +#define ARKUI_NATIVE_TYPE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Provides the definition of the ArkUI native component instance object. + * + * @since 12 + */ +struct ArkUI_Node; + +/** + * @brief Define the object pointer of the ArkUI native component instance. + * + * @since 12 + */ +typedef struct ArkUI_Node* ArkUI_NodeHandle; + +/** + * @brief ArkUI number type definition on the native side. + * + * @since 12 + */ +typedef union { + /** Floating-point type.*/ + float f32; + /** Signed integer.*/ + int32_t i32; + /** Unsigned integer.*/ + uint32_t u32; +} ArkUI_NumberValue; + +/** + * @brief Defines the layout alignment enumerated values. + * + * @since 12 + */ +typedef enum { + /** Start from the top.*/ + ARKUI_ALIGNMENT_TOP_START = 0, + /** Top centered.*/ + ARKUI_ALIGNMENT_TOP, + /** Top and tail ends.*/ + ARKUI_ALIGNMENT_TOP_END, + /** The start end is vertically centered.*/ + ARKUI_ALIGNMENT_START, + /** Center horizontally and vertically.*/ + ARKUI_ALIGNMENT_CENTER, + /** The tail end is centered vertically.*/ + ARKUI_ALIGNMENT_END, + /** Start end at the bottom.*/ + ARKUI_ALIGNMENT_BOTTOM_START, + /** The bottom is horizontally centered.*/ + ARKUI_ALIGNMENT_BOTTOM, + /** Bottom end.*/ + ARKUI_ALIGNMENT_BOTTOM_END, +} ArkUI_Alignment; + +/** + * @brief Defines the enumerated values for repeated image placement. + * + * @since 12 + */ +typedef enum { + /** The value must not be repeated.*/ + ARKUI_IMAGE_REPEAT_NONE = 0, + /** Repeat in the X axis direction.*/ + ARKUI_IMAGE_REPEAT_X, + /** Repeat on the Y axis.*/ + ARKUI_IMAGE_REPEAT_Y, + /** Repeat on the X and Y axes.*/ + ARKUI_IMAGE_REPEAT_XY, +} ArkUI_ImageRepeat; + +/** + * @brief Defines the enumerated values of the font style. + * + * @since 12 + */ +typedef enum { + /** Standard font style.*/ + ARKUI_FONT_STYLE_NORMAL = 0, + /** Italic font style.*/ + ARKUI_FONT_STYLE_ITALIC +} ArkUI_FontStyle; + +/** + * @brief Defines the enumerated values of the font thickness and word weight. + * + * @since 12 + */ +typedef enum { + /** 100 */ + ARKUI_FONT_WEIGHT_W100 = 0, + /** 200 */ + ARKUI_FONT_WEIGHT_W200, + /** 300 */ + ARKUI_FONT_WEIGHT_W300, + /** 400 */ + ARKUI_FONT_WEIGHT_W400, + /** 500 */ + ARKUI_FONT_WEIGHT_W500, + /** 600 */ + ARKUI_FONT_WEIGHT_W600, + /** 700 */ + ARKUI_FONT_WEIGHT_W700, + /** 800 */ + ARKUI_FONT_WEIGHT_W800, + /** 900 */ + ARKUI_FONT_WEIGHT_W900, + /** The font size is thick.*/ + ARKUI_FONT_WEIGHT_BOLD, + /** The font thickness is normal.*/ + ARKUI_FONT_WEIGHT_NORMAL, + /** The font is very thick.*/ + ARKUI_FONT_WEIGHT_BOLDER, + /** The font size is fine.*/ + ARKUI_FONT_WEIGHT_LIGHTER, + /** The font thickness is moderate.*/ + ARKUI_FONT_WEIGHT_MEDIUM, + /** The font thickness is normal.*/ + ARKUI_FONT_WEIGHT_REGULAR, +} ArkUI_FontWeight; + +/** + * @brief Defines the enumerated values of the horizontal alignment style of the font. + * + * @since 12 + */ +typedef enum { + /** Align the header horizontally.*/ + ARKUI_TEXT_ALIGNMENT_START = 0, + /** Align the center horizontally.*/ + ARKUI_TEXT_ALIGNMENT_CENTER, + /** Align the tail horizontally.*/ + ARKUI_TEXT_ALIGNMENT_END, + /** Align the two ends.*/ + ARKUI_TEXT_ALIGNMENT_JUSTIFY, +} ArkUI_TextAlignment; + +typedef enum { + /** Do not use decorative lines.*/ + ARKUI_TEXT_DECORATION_TYPE_NONE = 0, + /** Text underline decoration.*/ + ARKUI_TEXT_DECORATION_TYPE_UNDERLINE, + /** The text is marked with a dash.*/ + ARKUI_TEXT_DECORATION_TYPE_OVERLINE, + /** Decorative line that passes through the text.*/ + ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH, +} ArkUI_TextDecorationType; + +typedef enum { + /** Retain the original case.*/ + ARKUI_TEXT_CASE_NORMAL = 0, + /** The text is in lowercase.*/ + ARKUI_TEXT_CASE_LOWER, + /** The text is in uppercase.*/ + ARKUI_TEXT_CASE_UPPER, +} ArkUI_TextCase; + +typedef enum { + /** Replication is not supported.*/ + ARKUI_COPY_OPTIONS_NONE = 0, + /** Intra-application replication is supported.*/ + ARKUI_COPY_OPTIONS_IN_APP, + /** Intra-device replication is supported.*/ + ARKUI_COPY_OPTIONS_LOCAL_DEVICE, + /** Cross-device replication is supported.*/ + ARKUI_COPY_OPTIONS_CROSS_DEVICE, +} ArkUI_CopyOptions; + +typedef enum { + /** Color.*/ + ARKUI_SHADOW_TYPE_COLOR = 0, + /** Blur.*/ + ARKUI_SHADOW_TYPE_BLUR +} ArkUI_ShadowType; + +/** + * @brief Defines the enumerated values of the edge sliding effect. +* + * @since 12 + */ +typedef enum { + /** Elastic physical dynamic effect. After sliding to the edge, you can continue to slide for a certain distance according to the initial speed or through touch events. After releasing your hand, you can bounce back.*/ + ARKUI_EDGE_EFFECT_SPRING = 0, + /** Shadow effect. When the camera slides to the edge, a circular shadow is displayed.*/ + ARKUI_EDGE_EFFECT_FADE, + /** No effect after sliding to the edge.*/ + ARKUI_EDGE_EFFECT_NONE, +} ArkUI_EdgeEffect; + +/** + * @brief Defines the end alignment effect of list items. + * + * @since 12 + */ +typedef enum { + /** By default, there is no project scrolling alignment effect.*/ + ARKUI_SCROLL_SNAP_ALIGN_NONE = 0, + /** The first item in the view is aligned at the beginning of the list.*/ + ARKUI_SCROLL_SNAP_ALIGN_START, + /** Intermediate items in the view will be aligned in the center of the list.*/ + ARKUI_SCROLL_SNAP_ALIGN_CENTER, + /** The last item in the view is aligned at the end of the list.*/ + ARKUI_SCROLL_SNAP_ALIGN_END, +} ArkUI_ScrollSnapAlign; + +/** + * @brief Defines the enumerated values of the scroll bar status. + * + * @since 12 + */ +typedef enum { + /** Not displayed.*/ + ARKUI_SCROLL_BAR_DISPLAY_MODE_OFF = 0, + /** On-demand display (displayed when touched and disappears after 2s)*/ + ARKUI_SCROLL_BAR_DISPLAY_MODE_AUTO, + /** Resident display.*/ + ARKUI_SCROLL_BAR_DISPLAY_MODE_ON, +} ArkUI_ScrollBarDisplayMode; +/** + * @brief Defines the scrolling direction and list component arrangement direction. + * + * @since 12 + */ +typedef enum { + /** Only vertical scrolling is supported.*/ + ARKUI_AXIS_VERTICAL = 0, + /** Only horizontal scrolling is supported.*/ + ARKUI_AXIS_HORIZONTAL, +} ArkUI_Axis; + +/** + * @brief Defines the enumerated values of whether the list is ceiling-mounted and bottom-mounted. + * + * @since 12 + */ +typedef enum { + /** The header of ListItemGroup does not absorb the top, and the footer does not absorb the bottom.*/ + ARKUI_STICKY_STYLE_NONE = 0, + /** The header of the ListItemGroup is ceiling-mounted, and the footer is not bottom-mounted.*/ + ARKUI_STICKY_STYLE_HEADER, + /** The footer of ListItemGroup is bottomed, and the header is not topped.*/ + ARKUI_STICKY_STYLE_FOOTER, + /** The footer and header of ListItemGroup are installed at the bottom and the top.*/ + ARKUI_STICKY_STYLE_BOTH, +} ArkUI_StickyStyle; + + +/** + * @brief Enumerated value of the border line style. + * + * @since 12 + */ +typedef enum { + /** Displayed as a solid line.*/ + ARKUI_BORDER_STYLE_SOLID = 0, + /** Displayed as a series of short square dashed lines.*/ + ARKUI_BORDER_STYLE_DASHED, + /** Displayed as a series of dots.*/ + ARKUI_BORDER_STYLE_DOTTED, +} ArkUI_BorderStyle; + +/** + * @brief Touch test control enumerated value. + * + * @since 12 + */ +typedef enum { + /** Default touch test effect.*/ + ARKUI_HIT_TEST_MODE_DEFAULT = 0, + /** Self-response touch test.*/ + ARKUI_HIT_TEST_MODE_BLOCK, + /** Both itself and child nodes respond to the touch test.*/ + ARKUI_HIT_TEST_MODE_TRANSPARENT, + /** Does not respond to the touch test.*/ + ARKUI_HIT_TEST_MODE_NONE +} ArkUI_HitTestMode; + +/** + * @brief Shadow effect enumerated value. + * + * @since 12 + */ +typedef enum { + /** Super small shadow.*/ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS = 0, + /** Small shadow.*/ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_SM, + /** Medium shadow.*/ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_MD, + /** Big shadow.*/ + ARKUI_SHADOW_STYLE_OUTER_DEFAULT_LG, + /** Floating small shadow.*/ + ARKUI_SHADOW_STYLE_OUTER_FLOATING_SM, + /** Floating medium shadow.*/ + ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD, +} ArkUI_ShadowStyle; + +/** + * @brief Enumerated value of the animation curve. + * + * @since 12 + */ +typedef enum { + /** The animation speed is the same from start to finish.*/ + ARKUI_CURVE_LINEAR = 0, + /** The animation starts at a low speed, then speeds up, and slows down before ending.*/ + ARKUI_CURVE_EASE, + /** The animation starts at low speed.*/ + ARKUI_CURVE_EASE_IN, + /** The animation ends at low speed.*/ + ARKUI_CURVE_EASE_OUT, + /** The animation starts and ends at a low speed.*/ + ARKUI_CURVE_EASE_IN_OUT, + /** Animation standard curve.*/ + ARKUI_CURVE_FAST_OUT_SLOW_IN, + /** Animate the deceleration curve.*/ + ARKUI_CURVE_LINEAR_OUT_SLOW_IN, + /** Animation acceleration curve.*/ + ARKUI_CURVE_FAST_OUT_LINEAR_IN, + /** Animate the sharp curve.*/ + ARKUI_CURVE_EXTREME_DECELERATION, + /** Animate the sharp curve.*/ + ARKUI_CURVE_SHARP, + /** Animated rhythm curve.*/ + ARKUI_CURVE_RHYTHM, + /** Smooth the animation curve.*/ + ARKUI_CURVE_SMOOTH, + /** Animated damping curve.*/ + ARKUI_CURVE_FRICTION, +} ArkUI_AnimationCurve; + +/** + * @brief Defines whether text can be copied and pasted. + * + * @since 12 + */ +typedef enum { + /** Replication is not supported.*/ + ARKUI_TEXT_COPY_OPTIONS_NONE = 0, + /** Intra-application replication is supported.*/ + ARKUI_TEXT_COPY_OPTIONS_IN_APP, + /** Intra-device replication is supported.*/ + ARKUI_TEXT_COPY_OPTIONS_LOCAL_DEVICE, + /** Cross-device replication is supported.*/ + ARKUI_TEXT_COPY_OPTIONS_CROSS_DEVICE, +} ArkUI_TextCopyOptions; + +/** + * @brief Defines the mode in which the text adapts to the height. + * + * @since 12 + */ +typedef enum { + /** Set the text height adaptation mode to MaxLines first.*/ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST = 0, + /** Set the adaptive mode of the text height to zoom out the font first.*/ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MIN_FONT_SIZE_FIRST, + /** Set the text height adaptation mode to layout constraint (height) first.*/ + ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_LAYOUT_CONSTRAINT_FIRST, +} ArkUI_TextHeightAdaptivePolicy; + +/** + * @brief Define nested scrolling options. + * + * @since 12 + */ +typedef enum { + /** Only scrolls by itself and does not associate with the parent component.*/ + ARKUI_SCROLL_NESTED_MODE_SELF_ONLY = 0, + /** Scroll itself first. After the parent component scrolls to the edge, the parent component scrolls. After the parent component scrolls to the edge + If the parent component has the edge effect, the parent component triggers the edge effect. Otherwise, the child component triggers the edge effect.*/ + ARKUI_SCROLL_NESTED_MODE_SELF_FIRST, + /** The parent component scrolls first. After the parent component scrolls to the edge, it scrolls itself. + After the body scrolls to the edge, if the edge effect exists, the edge effect of the body is triggered. Otherwise, the edge effect of the parent component is triggered. */ + ARKUI_SCROLL_NESTED_MODE_PARENT_FIRST, + /** Scrolling itself and parent components at the same time, after both themselves and parent components reach the edge + If the component has the edge effect, the component triggers the edge effect. Otherwise, the parent component triggers the edge effect.*/ + ARKUI_SCROLL_NESTED_MODE_PARALLEL, +} ArkUI_ScrollNestedMode; + +/** + * @brief Define the edge position to which the scrolling is performed. + * + * @since 12 + */ +typedef enum { + /** Upside edge in the vertical direction.*/ + ARKUI_SCROLL_EDGE_TOP = 0, + /** Vertical center position.*/ + ARKUI_SCROLL_EDGE_CENTER, + /** Lower vertical edge.*/ + ARKUI_SCROLL_EDGE_BOTTOM, + /** Baseline position of the text in the cross axis direction.*/ + ARKUI_SCROLL_EDGE_BASELINE, + /** Start position in the horizontal direction.*/ + ARKUI_SCROLL_EDGE_START, + /** Center the position in the horizontal direction.*/ + ARKUI_SCROLL_EDGE_MIDDLE, + /** End position in the horizontal direction.*/ + ARKUI_SCROLL_EDGE_END, +} ArkUI_ScrollEdge; + +/** + * @brief Enumerated value of the mixed mode. + * + * @since 12 + */ +typedef enum { + /** Overwrite the upper-layer image with the lower-layer image without performing any blending operation.*/ + ARKUI_BLEND_MODE_NONE, + /** Clear the target pixel covered by the source pixel to be completely transparent.*/ + ARKUI_BLEND_MODE_CLEAR, + /** r = s. Only the source pixel is displayed.*/ + ARKUI_BLEND_MODE_SRC, + /** r = d. Only the target pixel is displayed.*/ + ARKUI_BLEND_MODE_DST, + /** r = s + (1 - sa) * d. Blend the source pixel based on the transparency and overwrite the target pixel.*/ + ARKUI_BLEND_MODE_SRC_OVER, + /** r = d + (1 - da) * s. Blend the target pixel based on the transparency and overwrite the source pixel. */ + ARKUI_BLEND_MODE_DST_OVER, + /** r = s * da. Only the part of the source pixel that overlaps the destination pixel is displayed. */ + ARKUI_BLEND_MODE_SRC_IN, + /** r = d * sa. Only the part that overlaps the source pixel in the target pixel is displayed. */ + ARKUI_BLEND_MODE_DST_IN, + /** r = s * (1 - da): Only the part that does not overlap the destination pixel in the source pixel is displayed. */ + ARKUI_BLEND_MODE_SRC_OUT, + /** r = d * (1 - sa). Only the part that does not overlap the source pixel in the target pixel is displayed. */ + ARKUI_BLEND_MODE_DST_OUT, + /** r = s * da + d * (1 - sa): Draw the source pixel where the source pixel overlaps the target pixel, and draw the target pixel where the source pixel does not overlap the target pixel. + */ + ARKUI_BLEND_MODE_SRC_ATOP, + /** r = d * sa + s * (1 - da): Draw the target pixel where the source pixel and the target pixel overlap and draw the source pixel where the source pixel and the target pixel do not overlap. + */ + ARKUI_BLEND_MODE_DST_ATOP, + /** r = s * (1 - da) + d * (1 - sa). Only the part that does not overlap the source pixel and the target pixel is displayed. */ + ARKUI_BLEND_MODE_XOR, + /** r = min(s + d, 1). Add the source pixel value and the target pixel value and use the result as the new pixel value.*/ + ARKUI_BLEND_MODE_PLUS, + /** r = s * d: Multiplies the source pixel by the target pixel and uses the result as the new pixel value.*/ + ARKUI_BLEND_MODE_MODULATE, + /** r = s + d - s * d. Add the pixel values of two images and subtract their product to achieve blending. */ + ARKUI_BLEND_MODE_SCREEN, + /** Determine whether the MULTIPLY or SCREEN blending mode is used based on the target pixel.*/ + ARKUI_BLEND_MODE_OVERLAY, + /** rc = s + d - max(s * da, d * sa), ra = kSrcOver. When two colors overlap, the darker color overwrites the lighter color. */ + ARKUI_BLEND_MODE_DARKEN, + /** rc = s + d - min(s * da, d * sa), ra = + kSrcOver: Compares the pixels in the source image and the target image, and selects the brightest pixel as the final mixing result.*/ + ARKUI_BLEND_MODE_LIGHTEN, + /** Make the target pixel brighter to reflect the source pixel.*/ + ARKUI_BLEND_MODE_COLOR_DODGE, + /** Makes the target pixel darker to reflect the source pixel.*/ + ARKUI_BLEND_MODE_COLOR_BURN, + /** Determine whether the target pixel becomes brighter or darker based on the value of the source pixel. The source pixel determines whether to use the MULTIPLY blending mode or DISCREEN blending mode.*/ + ARKUI_BLEND_MODE_HARD_LIGHT, + /** Determine whether the LIGHTEN blending mode or DARKEN blending mode is used based on the source pixel.*/ + ARKUI_BLEND_MODE_SOFT_LIGHT, + /** rc = s + d - 2 * (min(s * da, d * sa)), ra = + kSrcOver: Compares the source pixel and target pixel, and subtracts the pixel with the lower brightness from the higher brightness to generate a high contrast effect.*/ + ARKUI_BLEND_MODE_DIFFERENCE, + /** rc = s + d - two(s * d), ra = kSrcOver. Compare the source pixel with the target pixel, and subtract the lower pixel from the higher pixel to produce a soft effect. + */ + ARKUI_BLEND_MODE_EXCLUSION, + /** r = s * (1 - da) + d * (1 - sa) + s * d. Multiplies the source image and the target image to obtain a new image.*/ + ARKUI_BLEND_MODE_MULTIPLY, + /** Retains the brightness and saturation of the source image, but replaces the hue of the source image with the hue of the target image.*/ + ARKUI_BLEND_MODE_HUE, + /** Retains the luminance and hue of the target pixel, but replaces the saturation of the target pixel with the saturation of the source pixel.*/ + ARKUI_BLEND_MODE_SATURATION, + /** Retains the saturation and hue of the source pixel, but replaces the luminance of the source pixel with the luminance of the target pixel.*/ + ARKUI_BLEND_MODE_COLOR, + /** The hue and saturation of the target pixel are retained, but the luminance of the target pixel is replaced by the luminance of the source pixel.*/ + ARKUI_BLEND_MODE_LUMINOSITY, +} ArkUI_BlendMode; + +/** + * @brief Sets the layout enumeration value in the axis direction of the container element. + * + * @since 12 + */ +typedef enum { + /** Layout elements from left to right.*/ + ARKUI_DIRECTION_LTR = 0, + /** Layout elements from right to left.*/ + ARKUI_DIRECTION_RTL, + /** Use the default layout direction.*/ + ARKUI_DIRECTION_AUTO = 3, +} ArkUI_Direction; + +/** + * @brief Enumerated value of the foreground color. + * + * @since 12 + */ +typedef enum { + /** The foreground color is the inverted color of the control background color.*/ + ARKUI_COLOR_STRATEGY_INVERT = 0, + /** The control background shadow color is the average color of the control background shadow area.*/ + ARKUI_COLOR_STRATEGY_AVERAGE, + /** The background shadow color of the control is the main color of the background shadow area of the control.*/ + ARKUI_COLOR_STRATEGY_PRIMARY, +} ArkUI_ColorStrategy; + +/** + * @brief Defines the horizontal alignment mode. + * + * @since 12 + */ +typedef enum { + /** Align the start end according to the language direction.*/ + ARKUI_HORIZONTAL_ALIGNMENT_START = 0, + /** Center alignment, which is the default alignment mode.*/ + ARKUI_HORIZONTAL_ALIGNMENT_CENTER, + /** Align the end according to the language direction.*/ + ARKUI_HORIZONTAL_ALIGNMENT_END, +} ArkUI_HorizontalAlignment; + +/** + * @brief Defines the animation playback mode. + * + * @since 12 + */ +typedef enum { + /** The animation is played in the forward direction.*/ + ARKUI_ANIMATION_PLAY_MODE_NORMAL = 0, + /** Reversely play the animation.*/ + ARKUI_ANIMATION_PLAY_MODE_REVERSE, + /** The animation is played backwards for odd times (1, 3, 5...) and forwards for even times (2, 4, 6...).*/ + ARKUI_ANIMATION_PLAY_MODE_ALTERNATE_REVERSE, +} ArkUI_AnimationPlayMode; + +/** + * @brief Defines the image width and height. + * + * @since 12 + */ +typedef enum { + /** Retain the scale of the original image.*/ + ARKUI_IMAGE_SIZE_AUTO = 0, + /** Default value. Use the aspect ratio to zoom out or zoom in so that the two sides of the image are greater than or equal to the display boundary.*/ + ARKUI_IMAGE_SIZE_COVER, + /** Retain the aspect ratio and zoom in or zoom out the image so that the image can be completely displayed within the display boundary.*/ + ARKUI_IMAGE_SIZE_CONTAIN, +} ArkUI_ImageSize; + +/** + * @brief Defines the color obtaining mode. + * + * @since 12 + */ +typedef enum { + /** Do not use the color blur.*/ + ARKUI_ADAPTIVE_COLOR_DEFAULT = 0, + /** Use the color blur.*/ + ARKUI_ADAPTIVE_COLOR_AVERAGE, +} ArkUI_AdaptiveColor; + +/** + * @brief Defines the dark and light color mode. + * + * @since 12 + */ +typedef enum { + /** Follow the dark and light color mode of the system.*/ + ARKUI_COLOR_MODE_SYSTEM = 0, + /** The light color mode is fixed.*/ + ARKUI_COLOR_MODE_LIGHT, + /** The dark color mode is fixed.*/ + ARKUI_COLOR_MODE_DARK, +} ArkUI_ColorMode; + +/** + * @brief Defines the background blur style. + * + * @since 12 + */ +typedef enum { + /** Light and thin materials are blurred.*/ + ARKUI_BLUR_STYLE_THIN = 0, + /** The common thickness material is blurred.*/ + ARKUI_BLUR_STYLE_REGULAR, + /** Thick material blurs.*/ + ARKUI_BLUR_STYLE_THICK, + /** The depth of field (DOF) is blurred at close distance.*/ + ARKUI_BLUR_STYLE_BACKGROUND_THIN, + /** The mid-range depth of field is blurred.*/ + ARKUI_BLUR_STYLE_BACKGROUND_REGULAR, + /** The far-range depth of field is blurred.*/ + ARKUI_BLUR_STYLE_BACKGROUND_THICK, + /** DFO blurs at the ultra-far distance.*/ + ARKUI_BLUR_STYLE_BACKGROUND_ULTRA_THICK, + /** Disable blurring.*/ + ARKUI_BLUR_STYLE_NONE, + /** Component ultra-light and thin material blurs.*/ + ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THIN, + /** The light and thin material of the component is blurred.*/ + ARKUI_BLUR_STYLE_COMPONENT_THIN, + /** Common materials of the component are blurred.*/ + ARKUI_BLUR_STYLE_COMPONENT_REGULAR, + /** The component thickness is blurred.*/ + ARKUI_BLUR_STYLE_COMPONENT_THICK, + /** The super thick material of the component is blurred.*/ + ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK, +} ArkUI_BlurStyle; + +/** + * @brief Defines the image filling effect. + * ImageSpanAlignment + * @since 12 + */ +typedef enum { + /** Retain the aspect ratio and zoom in or zoom out the image so that the image can be completely displayed within the display boundary.*/ + ARKUI_OBJECT_FIT_CONTAIN = 0, + /** Retain the aspect ratio and zoom in or zoom out the image so that both sides of the image are larger than or equal to the display boundary.*/ + ARKUI_OBJECT_FIT_COVER, + /** Adaptive display.*/ + ARKUI_OBJECT_FIT_AUTO, + /** The aspect ratio is not retained, so that the image is full of the display boundary.*/ + ARKUI_OBJECT_FIT_FILL, + /** The aspect ratio is retained, and the image is zoomed out or retained.*/ + ARKUI_OBJECT_FIT_SCALE_DOWN, + /** Retain the original size.*/ + ARKUI_OBJECT_FIT_NONE, +} ArkUI_ObjectFit; + +/** + * @brief Defines the image interpolation effect. + * + * @since 12 + */ +typedef enum { + /** Do not use image interpolation.*/ + ARKUI_IMAGE_INTERPOLATION_NONE = 0, + /** Low image interpolation.*/ + ARKUI_IMAGE_INTERPOLATION_LOW, + /** Interpolate the image in.*/ + ARKUI_IMAGE_INTERPOLATION_MEDIUM, + /** High image interpolation, with the highest interpolation quality.*/ + ARKUI_IMAGE_INTERPOLATION_HIGH, +} ArkUI_ImageInterpolation; + +#ifdef __cplusplus +}; +#endif + +#endif // ARKUI_NATIVE_TYPE_H +/** @} */ diff --git a/build-tools/capi_parser/src/coreImpl/parser/parse_include.py b/build-tools/capi_parser/src/coreImpl/parser/parse_include.py index f6272aa9b..c5825cfea 100644 --- a/build-tools/capi_parser/src/coreImpl/parser/parse_include.py +++ b/build-tools/capi_parser/src/coreImpl/parser/parse_include.py @@ -263,11 +263,7 @@ def ast_to_dict(cursor, current_file, gn_path=None, comment=None, key=0): # 解 "comment": '', "syscap": '' } - if cursor.raw_comment: # 是否有注释信息,有就取,没有过 - data["comment"] = cursor.raw_comment - else: - data["comment"] = 'none_comment' - + get_comment(cursor, data) if key == 0: data["kind"] = CursorKind.TRANSLATION_UNIT.name if comment: @@ -281,13 +277,7 @@ def ast_to_dict(cursor, current_file, gn_path=None, comment=None, key=0): # 解 data["kind"] = cursor.kind.name if cursor.kind.name == CursorKind.MACRO_DEFINITION.name: define_comment(cursor, current_file, data) - - if 'none_comment' != data["comment"]: - pattern = r'@([Ss]yscap).*?(?=\n)' - matches = re.search(pattern, data['comment']) - if matches: - data["syscap"] = matches.group(0) - + get_syscap_value(data) processing_special_node(cursor, data, key, gn_path) # 节点处理 children = list(cursor.get_children()) # 判断是否有子节点,有就追加children,没有根据情况来 if len(children) > 0: @@ -314,6 +304,21 @@ def ast_to_dict(cursor, current_file, gn_path=None, comment=None, key=0): # 解 return data +def get_syscap_value(data: dict): + if 'none_comment' != data["comment"]: + pattern = r'@([Ss]yscap).*?(?=\n)' + matches = re.search(pattern, data['comment']) + if matches: + data["syscap"] = matches.group(0) + + +def get_comment(cursor, data: dict): + if cursor.raw_comment: # 是否有注释信息,有就取,没有过 + data["comment"] = cursor.raw_comment + else: + data["comment"] = 'none_comment' + + def processing_ast_node(child, current_file, data, name, gn_path): child_data = ast_to_dict(child, current_file, gn_path, key=1) if child.kind == CursorKind.TYPE_REF: diff --git a/distributeddatamgr/relational_store/include/relational_store.h b/distributeddatamgr/relational_store/include/relational_store.h index 1079b1d60..fcd70f2eb 100644 --- a/distributeddatamgr/relational_store/include/relational_store.h +++ b/distributeddatamgr/relational_store/include/relational_store.h @@ -556,6 +556,89 @@ typedef enum Rdb_SubscribeType { RDB_SUBSCRIBE_TYPE_CLOUD_DETAILS, } Rdb_SubscribeType; +/** + * @brief The callback function of cloud data change event. + * + * @param context Represents the context of data observer. + * @param values Indicates the cloud accounts that changed. + * @param count The count of changed cloud accounts. + * @since 11 + */ +typedef void (*Rdb_BriefObserver)(void *context, const char *values[], uint32_t count); + +/** + * @brief The callback function of cloud data change details event. + * + * @param context Represents the context of data observer. + * @param changeInfo Indicates the {@link Rdb_ChangeInfo} of changed tables. + * @param count The count of changed tables. + * @see Rdb_ChangeInfo. + * @since 11 + */ +typedef void (*Rdb_DetailsObserver)(void *context, const Rdb_ChangeInfo **changeInfo, uint32_t count); + +/** + * @brief Indicates the callback functions. + * + * @since 11 + */ +typedef union Rdb_SubscribeCallback { + /** + * The callback function of cloud data change details event. + */ + Rdb_DetailsObserver detailsObserver; + + /** + * The callback function of cloud data change event. + */ + Rdb_BriefObserver briefObserver; +} Rdb_SubscribeCallback; + +/** + * @brief Indicates the observer of data. + * + * @since 11 + */ +typedef struct Rdb_DataObserver { + /** + * The context of data observer. + */ + void *context; + + /** + * The callback of data observer. + */ + Rdb_SubscribeCallback callback; +} Rdb_DataObserver; + +/** + * @brief Registers an observer for the database. + * When data in the distributed database changes, the callback will be invoked. + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. + * @param type Indicates the subscription type, which is defined in {@link Rdb_SubscribeType}. + * @param observer The {@link Rdb_DataObserver} of change events in the database. + * @return Returns the status code of the execution. See {@link OH_Rdb_ErrCode}. + * @see OH_Rdb_Store. + * @see Rdb_DataObserver. + * @since 11 + */ +int OH_Rdb_Subscribe(OH_Rdb_Store *store, Rdb_SubscribeType type, const Rdb_DataObserver *observer); + +/** + * @brief Remove specified observer of specified type from the database. + * + * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. + * @param type Indicates the subscription type, which is defined in {@link Rdb_SubscribeType}. + * @param observer The {@link Rdb_DataObserver} of change events in the database. + * If this is nullptr, remove all observers of the type. + * @return Returns the status code of the execution. See {@link OH_Rdb_ErrCode}. + * @see OH_Rdb_Store. + * @see Rdb_DataObserver. + * @since 11 + */ +int OH_Rdb_Unsubscribe(OH_Rdb_Store *store, Rdb_SubscribeType type, const Rdb_DataObserver *observer); + /** * @brief Indicates the database synchronization mode. * @@ -737,6 +820,15 @@ typedef struct Rdb_ProgressDetails { */ Rdb_TableDetails *OH_Rdb_GetTableDetails(Rdb_ProgressDetails *progress, int32_t version); +/** + * @brief The callback function of progress. + * + * @param progressDetails The details of the sync progress. + * @see Rdb_ProgressDetails. + * @since 11 + */ +typedef void (*Rdb_ProgressCallback)(void *context, Rdb_ProgressDetails *progressDetails); + /** * @brief The callback function of sync. * @@ -746,6 +838,23 @@ Rdb_TableDetails *OH_Rdb_GetTableDetails(Rdb_ProgressDetails *progress, int32_t */ typedef void (*Rdb_SyncCallback)(Rdb_ProgressDetails *progressDetails); +/** + * @brief The observer of progress. + * + * @since 11 + */ +typedef struct Rdb_ProgressObserver { + /** + * The context of progress observer. + */ + void *context; + + /** + * The callback function of progress observer. + */ + Rdb_ProgressCallback callback; +} Rdb_ProgressObserver; + /** * @brief Sync data to cloud. * @@ -753,14 +862,41 @@ typedef void (*Rdb_SyncCallback)(Rdb_ProgressDetails *progressDetails); * @param mode Represents the {@link Rdb_SyncMode} of sync progress. * @param tables Indicates the names of tables to sync. * @param count The count of tables to sync. If value equals 0, sync all tables of the store. - * @param callback The {@link Rdb_SyncCallback} of cloud sync progress. + * @param observer The {@link Rdb_ProgressObserver} of cloud sync progress. * @return Returns the status code of the execution. See {@link OH_Rdb_ErrCode}. * @see OH_Rdb_Store. - * @see Rdb_SyncCallback. + * @see Rdb_ProgressObserver. * @since 11 */ int OH_Rdb_CloudSync(OH_Rdb_Store *store, Rdb_SyncMode mode, const char *tables[], uint32_t count, - Rdb_SyncCallback *callback); + const Rdb_ProgressObserver *observer); + +/** + * @brief Subscribes to the automatic synchronization progress of an RDB store. + * A callback will be invoked when there is a notification of the automatic synchronization progress. + * + * @param store Indicates the pointer to the target {@Link OH_Rdb_Store} instance. + * @param observer The {@link Rdb_ProgressObserver} for the automatic synchornizaiton progress. + * Indicates the callback invoked to return the automatic synchronization progress. + * @return Returns the status code of the execution. See {@link OH_Rdb_ErrCode}. + * @see OH_Rdb_Store. + * @see Rdb_ProgressObserver. + * @since 11 + **/ +int OH_Rdb_SubscribeAutoSyncProgress(OH_Rdb_Store *store, const Rdb_ProgressObserver *observer); + +/** + * @brief Unsubscribes from the automatic synchronziation progress of an RDB store. + * + * @param store Indicates the pointer to the target {@Link OH_Rdb_Store} instance. + * @param observer Indicates the {@link Rdb_ProgressObserver} callback for the automatic synchornizaiton progress. + * If it is a null pointer, all callbacks for the automatic synchornizaiton progress will be unregistered. + * @return Returns the status code of the execution. See {@link OH_Rdb_ErrCode}. + * @see OH_Rdb_Store. + * @see Rdb_ProgressObserver. + * @since 11 + */ +int OH_Rdb_UnsubscribeAutoSyncProgress(OH_Rdb_Store *store, const Rdb_ProgressObserver *observer); #ifdef __cplusplus }; #endif diff --git a/distributeddatamgr/relational_store/libnative_rdb.ndk.json b/distributeddatamgr/relational_store/libnative_rdb.ndk.json index 190d3cbb0..3ca54056f 100644 --- a/distributeddatamgr/relational_store/libnative_rdb.ndk.json +++ b/distributeddatamgr/relational_store/libnative_rdb.ndk.json @@ -41,5 +41,9 @@ {"name":"OH_Data_Asset_CreateOne"}, {"name":"OH_Data_Asset_DestroyOne"}, {"name":"OH_Data_Asset_CreateMultiple"}, - {"name":"OH_Data_Asset_DestroyMultiple"} + {"name":"OH_Data_Asset_DestroyMultiple"}, + {"name":"OH_Rdb_Subscribe"}, + {"name":"OH_Rdb_Unsubscribe"}, + {"name":"OH_Rdb_SubscribeAutoSyncProgress"}, + {"name":"OH_Rdb_UnsubscribeAutoSyncProgress"} ] \ No newline at end of file diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn index 44f9f3218..60e24af8d 100644 --- a/graphic/graphic_2d/native_drawing/BUILD.gn +++ b/graphic/graphic_2d/native_drawing/BUILD.gn @@ -25,14 +25,18 @@ ohos_ndk_headers("native_drawing_header") { "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_filter.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_font.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_font_collection.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_image.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_mask_filter.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_matrix.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_memory_stream.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_path.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_path_effect.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_pen.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_point.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_rect.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_register_font.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_round_rect.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_sampling_options.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_shader_effect.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_blob.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_declaration.h", @@ -58,12 +62,16 @@ ohos_ndk_library("libnative_drawing_ndk") { "native_drawing/drawing_font_collection.h", "native_drawing/drawing_mask_filter.h", "native_drawing/drawing_matrix.h", + "native_drawing/drawing_memory_stream.h", "native_drawing/drawing_path.h", + "native_drawing/drawing_path_effect.h", "native_drawing/drawing_pen.h", "native_drawing/drawing_point.h", "native_drawing/drawing_rect.h", "native_drawing/drawing_register_font.h", "native_drawing/drawing_round_rect.h", + "native_drawing/drawing_image.h", + "native_drawing/drawing_sampling_options.h", "native_drawing/drawing_shader_effect.h", "native_drawing/drawing_text_blob.h", "native_drawing/drawing_text_declaration.h", diff --git a/graphic/graphic_2d/native_drawing/drawing_bitmap.h b/graphic/graphic_2d/native_drawing/drawing_bitmap.h index 52b083412..89f5fcdca 100644 --- a/graphic/graphic_2d/native_drawing/drawing_bitmap.h +++ b/graphic/graphic_2d/native_drawing/drawing_bitmap.h @@ -76,6 +76,20 @@ OH_Drawing_Bitmap* OH_Drawing_BitmapCreate(void); */ void OH_Drawing_BitmapDestroy(OH_Drawing_Bitmap*); +/** + * @brief Creates an OH_Drawing_Bitmap object with OH_Drawing_Image_Info object + * and sets the mem address or pixel storage. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @param pixels the pointer to memory address or pixel storage. + * @param rowBytes size of pixel row or larger. + * @return Returns the pointer to the OH_Drawing_Bitmap object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Bitmap* OH_Drawing_BitmapCreateFromPixels(OH_Drawing_Image_Info*, void* pixels, uint32_t rowBytes); + /** * @brief Initializes the width and height of an OH_Drawing_Bitmap object * and sets the pixel format for the bitmap. diff --git a/graphic/graphic_2d/native_drawing/drawing_brush.h b/graphic/graphic_2d/native_drawing/drawing_brush.h index 215a3ee39..dca333f2d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_brush.h +++ b/graphic/graphic_2d/native_drawing/drawing_brush.h @@ -21,7 +21,7 @@ * @{ * * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. - * + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -81,7 +81,7 @@ bool OH_Drawing_BrushIsAntiAlias(const OH_Drawing_Brush*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. - * @param bool Specifies whether to enable anti-aliasing. The value true means + * @param bool Specifies whether to enable anti-aliasing. The value true means * to enable anti-aliasing, and false means the opposite. * @since 8 * @version 1.0 @@ -154,6 +154,17 @@ void OH_Drawing_BrushSetShaderEffect(OH_Drawing_Brush*, OH_Drawing_ShaderEffect* */ void OH_Drawing_BrushSetFilter(OH_Drawing_Brush*, OH_Drawing_Filter*); +/** + * @brief Sets a blender that implements the specified blendmode enum for a brush. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Brush object. + * @param OH_Drawing_BlendMode Indicates the blend mode. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_BrushSetBlendMode(OH_Drawing_Brush*, OH_Drawing_BlendMode); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_canvas.h b/graphic/graphic_2d/native_drawing/drawing_canvas.h index cc3781589..c65f1a813 100644 --- a/graphic/graphic_2d/native_drawing/drawing_canvas.h +++ b/graphic/graphic_2d/native_drawing/drawing_canvas.h @@ -21,7 +21,7 @@ * @{ * * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. - * + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -64,7 +64,7 @@ OH_Drawing_Canvas* OH_Drawing_CanvasCreate(void); void OH_Drawing_CanvasDestroy(OH_Drawing_Canvas*); /** - * @brief Binds a bitmap to a canvas so that the content drawn on the canvas + * @brief Binds a bitmap to a canvas so that the content drawn on the canvas * is output to the bitmap (this process is called CPU rendering). * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing @@ -87,7 +87,7 @@ void OH_Drawing_CanvasBind(OH_Drawing_Canvas*, OH_Drawing_Bitmap*); void OH_Drawing_CanvasAttachPen(OH_Drawing_Canvas*, const OH_Drawing_Pen*); /** - * @brief Detaches the pen from a canvas so that the canvas will not use the style + * @brief Detaches the pen from a canvas so that the canvas will not use the style * and color of the pen to outline a shape. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing @@ -129,6 +129,19 @@ void OH_Drawing_CanvasDetachBrush(OH_Drawing_Canvas*); */ void OH_Drawing_CanvasSave(OH_Drawing_Canvas*); +/** + * @brief Saves matrix and clip, and allocates a bitmap for subsequent drawing. + * Calling restore discards changes to matrix and clip, and draws the bitmap. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasSaveLayer(OH_Drawing_Canvas*, const OH_Drawing_Rect*, const OH_Drawing_Brush*); + /** * @brief Restores the canvas status (canvas matrix) saved on the top of the stack. * @@ -199,6 +212,21 @@ void OH_Drawing_CanvasDrawPath(OH_Drawing_Canvas*, const OH_Drawing_Path*); */ void OH_Drawing_CanvasDrawBitmap(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, float left, float top); +/** + * @brief Draw the specified area of the bitmap to the specified area of the canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param src the area of source bitmap, can be nullptr. + * @param dst the area of destination canvas. + * @param OH_Drawing_SamplingOptions the sampling mode. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawBitmapRect(OH_Drawing_Canvas*, const OH_Drawing_Bitmap*, const OH_Drawing_Rect* src, + const OH_Drawing_Rect* dst, const OH_Drawing_SamplingOptions*); + /** * @brief Draws a rect. * @@ -272,7 +300,7 @@ void OH_Drawing_CanvasDrawTextBlob(OH_Drawing_Canvas*, const OH_Drawing_TextBlob /** * @brief Enumerates clip op. - * + * * @since 11 * @version 1.0 */ @@ -352,6 +380,105 @@ void OH_Drawing_CanvasTranslate(OH_Drawing_Canvas*, float dx, float dy); */ void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); +/** + * @brief Get the width of a canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_CanvasGetWidth(OH_Drawing_Canvas*); + +/** + * @brief Get the height of a canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_CanvasGetHeight(OH_Drawing_Canvas*); + +/** + * @brief Get the bounds of clip of a canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasGetLocalClipBounds(OH_Drawing_Canvas*, OH_Drawing_Rect*); + +/** + * @brief Get a 3x3 matrix of the transform from local coordinates to 'device'. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasGetTotalMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief Use the passed matrix to transforming the geometry, then use existing matrix. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object, + * represents the matrix which is passed. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasConcatMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief Enumerates of shadow flags. + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** + * Use no shadow flags. + */ + SHADOW_FLAGS_NONE, + /** + * The occluding object is transparent. + */ + SHADOW_FLAGS_TRANSPARENT_OCCLUDER, + /** + * No need to analyze shadows. + */ + SHADOW_FLAGS_GEOMETRIC_ONLY, + /** + * Use all shadow falgs. + */ + SHADOW_FLAGS_ALL, +} OH_Drawing_CanvasShadowFlags; + +/** + * @brief Use circular light to draw an offset spot shadow and outlining ambient shadow for the given path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object, use to generate shadows. + * @param planeParams Represents the value of the function which returns Z offset of the occluder from the + * canvas based on x and y. + * @param devLightPos Represents the position of the light relative to the canvas. + * @param lightRadius The radius of the circular light. + * @param ambientColor Ambient shadow's color. + * @param spotColor Spot shadow's color. + * @param flag Indicates the flag to control opaque occluder, shadow, and light position. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawShadow(OH_Drawing_Canvas*, OH_Drawing_Path*, OH_Drawing_Point3D planeParams, + OH_Drawing_Point3D devLightPos, float lightRadius, uint32_t ambientColor, uint32_t spotColor, + OH_Drawing_CanvasShadowFlags flag); + /** * @brief Clears a canvas by using a specified color. * @@ -363,6 +490,63 @@ void OH_Drawing_CanvasScale(OH_Drawing_Canvas*, float sx, float sy); */ void OH_Drawing_CanvasClear(OH_Drawing_Canvas*, uint32_t color); +/** + * @brief Sets matrix of canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasSetMatrix(OH_Drawing_Canvas*, OH_Drawing_Matrix*); + +/** + * @brief Draws the specified source rectangle of the image onto the canvas, + * scaled and translated to the destination rectangle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_CanvasDrawImageRect(OH_Drawing_Canvas*, OH_Drawing_Image*, + OH_Drawing_Rect* dst, OH_Drawing_SamplingOptions*); + +/** + * @brief Read pixels data from canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Image_Info width, height, colorType, and alphaType of dstPixels. + * @param dstPixels destination pixel storage. + * @param dstRowBytes size of one row of pixels. + * @param srcX offset into canvas writable pixels on x-axis. + * @param srcY offset into canvas writable pixels on y-axis. + * @return true if pixels are copied to dstPixels. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasReadPixels(OH_Drawing_Canvas*, OH_Drawing_Image_Info*, + void* dstPixels, uint32_t dstRowBytes, int32_t srcX, int32_t srcY); + +/** + * @brief Read pixels data to a bitmap from canvas. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object. + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @param srcX offset into canvas writable pixels on x-axis. + * @param srcY offset into canvas writable pixels on y-axis. + * @return true if pixels are copied to dstBitmap. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_CanvasReadPixelsToBitmap(OH_Drawing_Canvas*, OH_Drawing_Bitmap*, int32_t srcX, int32_t srcY); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h index 5c02a704d..06aa4323b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_font.h @@ -64,6 +64,17 @@ OH_Drawing_Font* OH_Drawing_FontCreate(void); */ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); +/** + * @brief Gets an OH_Drawing_Typeface object from the OH_Drawing_Typeface object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @return OH_Drawing_Typeface Indicates the pointer to an OH_Drawing_Typeface object. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_FontGetTypeface(OH_Drawing_Font*); + /** * @brief Sets text size for an OH_Drawing_Font object. * @@ -75,6 +86,20 @@ void OH_Drawing_FontSetTypeface(OH_Drawing_Font*, OH_Drawing_Typeface*); */ void OH_Drawing_FontSetTextSize(OH_Drawing_Font*, float textSize); +/** + * @brief Calculate number of glyphs represented by text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param text Indicates the character storage encoded with text encoding. + * @param byteLength Indicates the text length in bytes. + * @param encoding Indicates the text encoding. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_FontCountText(OH_Drawing_Font*, const void* text, size_t byteLength, + OH_Drawing_TextEncoding encoding); + /** * @brief Enables or disables linearly scalable font for an OH_Drawing_Font object. * @@ -118,6 +143,37 @@ void OH_Drawing_FontSetFakeBoldText(OH_Drawing_Font*, bool isFakeBoldText); */ void OH_Drawing_FontDestroy(OH_Drawing_Font*); +/** + * @brief Defines a run, supplies storage for the metrics of an SkFont. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** storage for top in font metrics */ + float top; + /** storage for ascent in font metrics */ + float ascent; + /** storage for descent in font metrics */ + float descent; + /** storage for bottom in font metrics */ + float bottom; + /** storage for leading in font metrics */ + float leading; +} OH_Drawing_Font_Metrics; + +/** + * @brief Obtains the metrics of a font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param OH_Drawing_Font_Metrics Indicates the pointer to an OH_Drawing_Font_Metrics object. + * @return Returns a float variable that recommended spacing between lines. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_FontGetMetrics(OH_Drawing_Font*, OH_Drawing_Font_Metrics*); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_image.h b/graphic/graphic_2d/native_drawing/drawing_image.h new file mode 100644 index 000000000..ed2f1f491 --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_image.h @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef C_INCLUDE_DRAWING_IMAGE_H +#define C_INCLUDE_DRAWING_IMAGE_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 12 + * @version 1.0 + */ + +/** + * @file drawing_image.h + * + * @brief Declares functions related to the image object in the drawing module. + * + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_Image object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_Image object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Image* OH_Drawing_ImageCreate(void); + +/** + * @brief Destroys an OH_Drawing_Image object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_ImageDestroy(OH_Drawing_Image*); + +/** + * @brief Rebuilds an OH_Drawing_Image object, sharing or copying bitmap pixels. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param OH_Drawing_Bitmap Indicates the pointer to an OH_Drawing_Bitmap object. + * @return Returns true if successed. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_ImageBuildFromBitmap(OH_Drawing_Image*, OH_Drawing_Bitmap*); + +/** + * @brief Gets pixel count in each row of image. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @return Returns the width. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_ImageGetWidth(OH_Drawing_Image*); + +/** + * @brief Gets pixel row count of image. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @return Returns the height. + * @since 12 + * @version 1.0 + */ +int32_t OH_Drawing_ImageGetHeight(OH_Drawing_Image*); + +/** + * @brief Gets the image info. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Image Indicates the pointer to an OH_Drawing_Image object. + * @param OH_Drawing_Image_Info Indicates the pointer to an OH_Drawing_Image_Info object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_ImageGetImageInfo(OH_Drawing_Image*, OH_Drawing_Image_Info*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif \ No newline at end of file diff --git a/graphic/graphic_2d/native_drawing/drawing_matrix.h b/graphic/graphic_2d/native_drawing/drawing_matrix.h index 8ae3da4c2..89548745b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_matrix.h +++ b/graphic/graphic_2d/native_drawing/drawing_matrix.h @@ -53,6 +53,49 @@ extern "C" { */ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); +/** + * @brief Creates an OH_Drawing_Matrix object with rotation. Sets matrix to + * rotate by degrees about a pivot point at (px, py). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param deg angle of axes relative to upright axes + * @param x pivot on x-axis. + * @param y pivot on y-axis. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateRotation(float deg, float x, float y); + +/** + * @brief Creates an OH_Drawing_Matrix object with scale. Sets matrix to scale + * by sx and sy, about a pivot point at (px, py). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param sx horizontal scale factor. + * @param sy vertical scale factor. + * @param px pivot on x-axis. + * @param py pivot on y-axis. + * @return Returns the pointer to the OH_Drawing_Matrix object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateScale(float sx, float sy, float px, float py); + +/** + * @brief Creates an OH_Drawing_Matrix object with translation. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param dx horizontal translation. + * @param dy vertical translation. + * @return Returns the pointer to the OH_Drawing_Matrix object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Matrix* OH_Drawing_MatrixCreateTranslation(float dx, float dy); + /** * @brief Sets the params for a matrix. * @@ -73,6 +116,115 @@ OH_Drawing_Matrix* OH_Drawing_MatrixCreate(void); void OH_Drawing_MatrixSetMatrix(OH_Drawing_Matrix*, float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2); +/** + * @brief Sets matrix total to matrix a multiplied by matrix b. + * Given: + * | A B C | | J K L | + * a = | D E F |, b = | M N O | + * | G H I | | P Q R | + * sets Matrix total to: + * | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | + * total = a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | + * | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param total Indicates the pointer to an OH_Drawing_Matrix object that a * b. + * @param a Indicates the pointer to an OH_Drawing_Matrix object. + * @param b Indicates the pointer to an OH_Drawing_Matrix object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixConcat(OH_Drawing_Matrix* total, const OH_Drawing_Matrix* a, + const OH_Drawing_Matrix* b); + +/** + * @brief Get one matrix value. Index is between the range of 0-8. + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param index one of 0-8. + * @return Returns value corresponding to index.Returns 0 if out of range. + * @since 12 + * @version 1.0 + */ +float OH_Drawing_MatrixGetValue(OH_Drawing_Matrix*, int index); + +/** + * @brief Sets matrix to rotate by degrees about a pivot point at (px, py). The pivot point is unchanged + * when mapped with matrix. Positive degrees rotates clockwise. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param degree Indicates the angle of axes relative to upright axes. + * @param px Indicates the pivot on x-axis. + * @param py Indicates the pivot on y-axis. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixRotate(OH_Drawing_Matrix*, float degree, float px, float py); + +/** + * @brief Sets matrix to translate by (dx, dy) + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param dx Indicates the horizontal translation. + * @param dy Indicates the vertical translation. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixTranslate(OH_Drawing_Matrix*, float dx, float dy); + +/** + * @brief Sets matrix to scale by sx and sy, about a pivot point at (px, py). + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param sx Indicates the horizontal scale factor. + * @param sy Indicates the vertical scale factor. + * @param px Indicates the pivot on x-axis. + * @param py Indicates the pivot on y-axis. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MatrixScale(OH_Drawing_Matrix*, float sx, float sy, float px, float py); + +/** + * @brief Sets inverse to reciprocal matrix, returning true if matrix can be inverted. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param inverse Indicates the pointer to an OH_Drawing_Matrix object. + * @return Returns true if matrix can be inverted, or flase. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixInvert(OH_Drawing_Matrix*, OH_Drawing_Matrix* inverse); + +/** + * @brief Returns true if the first matrix equals the second matrix. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @param other Indicates the pointer to an OH_Drawing_Matrix object. + * @return Returns true if the two matrices are equal, or flase. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixIsEqual(OH_Drawing_Matrix*, OH_Drawing_Matrix* other); + +/** + * @brief Returns true if matrix is identity. + * Identity matrix is : | 1 0 0 | + * | 0 1 0 | + * | 0 0 1 | + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @return Returns true if matrix is identity, or flase. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_MatrixIsIdentity(OH_Drawing_Matrix*); + /** * @brief Destroys an OH_Drawing_Matrix object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_memory_stream.h b/graphic/graphic_2d/native_drawing/drawing_memory_stream.h new file mode 100644 index 000000000..4abafe9fe --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_memory_stream.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef C_INCLUDE_DRAWING_MEMORY_STREAM_H +#define C_INCLUDE_DRAWING_MEMORY_STREAM_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 12 + * @version 1.0 + */ + +/** + * @file drawing_memory_stream.h + * + * @brief Declares functions related to the memoryStream object in the drawing module. + * + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates a OH_Drawing_MemoryStream object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_MemoryStream object created. + * @param data file path. + * @param length Data length. + * @param copyData Copy data or not. + * @since 12 + * @version 1.0 + */ +OH_Drawing_MemoryStream* OH_Drawing_MemoryStreamCreate(const void* data, size_t length, bool copyData); + +/** + * @brief Destroys an OH_Drawing_MemoryStream object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MemoryStream Indicates the pointer to an OH_Drawing_MemoryStream object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_MemoryStreamDestroy(OH_Drawing_MemoryStream*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/graphic/graphic_2d/native_drawing/drawing_path.h b/graphic/graphic_2d/native_drawing/drawing_path.h index 5f5e34a1a..968f65c17 100644 --- a/graphic/graphic_2d/native_drawing/drawing_path.h +++ b/graphic/graphic_2d/native_drawing/drawing_path.h @@ -43,6 +43,36 @@ extern "C" { #endif +/** + * @brief Direction for adding closed contours. + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** clockwise direction for adding closed contours */ + PATH_DIRECTION_CW, + /** counter-clockwise direction for adding closed contours */ + PATH_DIRECTION_CCW, +} OH_Drawing_PathDirection; + +/** + * @brief FillType of path + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings */ + PATH_FILL_TYPE_WINDING, + /** Specifies that "inside" is computed by an odd number of edge crossings */ + PATH_FILL_TYPE_EVEN_ODD, + /** Same as Winding, but draws outside of the path, rather than inside */ + PATH_FILL_TYPE_INVERSE_WINDING, + /** Same as EvenOdd, but draws outside of the path, rather than inside */ + PATH_FILL_TYPE_INVERSE_EVEN_ODD, +} OH_Drawing_PathFillType; + /** * @brief Creates an OH_Drawing_Path object. * @@ -53,6 +83,17 @@ extern "C" { */ OH_Drawing_Path* OH_Drawing_PathCreate(void); +/** + * @brief Creates an OH_Drawing_Path copy object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Rect object. + * @return Returns the pointer to the OH_Drawing_Path object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Path* OH_Drawing_PathCopy(OH_Drawing_Path*); + /** * @brief Destroys an OH_Drawing_Path object and reclaims the memory occupied by the object. * @@ -139,6 +180,99 @@ void OH_Drawing_PathQuadTo(OH_Drawing_Path*, float ctrlX, float ctrlY, float end void OH_Drawing_PathCubicTo( OH_Drawing_Path*, float ctrlX1, float ctrlY1, float ctrlX2, float ctrlY2, float endX, float endY); +/** + * @brief Adds a new contour to the path, defined by the rect, and wound in the specified direction. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param left Indicates the left coordinate of the upper left corner of the rectangle. + * @param top Indicates the top coordinate of the upper top corner of the rectangle. + * @param right Indicates the right coordinate of the lower right corner of the rectangle. + * @param bottom Indicates the bottom coordinate of the lower bottom corner of the rectangle. + * @param OH_Drawing_PathDirection Indicates the path direction. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddRect(OH_Drawing_Path*, float left, float top, float right, float bottom, OH_Drawing_PathDirection); + +/** + * @brief Adds a new contour to the path, defined by the round rect, and wound in the specified direction. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param OH_Drawing_RoundRect Indicates the pointer to an OH_Drawing_RoundRect object. + * @param OH_Drawing_PathDirection Indicates the path direction. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddRoundRect(OH_Drawing_Path*, const OH_Drawing_RoundRect* roundRect, OH_Drawing_PathDirection); + +/** + * @brief Appends arc to path, as the start of new contour.Arc added is part of ellipse bounded by oval, + * from startAngle through sweepAngle. Both startAngle and sweepAngle are measured in degrees, where zero degrees + * is aligned with the positive x-axis, and positive sweeps extends arc clockwise.If sweepAngle <= -360, or + * sweepAngle >= 360; and startAngle modulo 90 is nearly zero, append oval instead of arc. Otherwise, sweepAngle + * values are treated modulo 360, and arc may or may not draw depending on numeric rounding. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @param startAngle Indicates the starting angle of arc in degrees. + * @param sweepAngle Indicates the sweep, in degrees. Positive is clockwise. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddArc(OH_Drawing_Path*, const OH_Drawing_Rect*, float startAngle, float sweepAngle); + +/** + * @brief Appends src path to path, transformed by matrix. Transformed curves may have different verbs, + * point, and conic weights. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param src Indicates the pointer to an OH_Drawing_Path object. + * @param OH_Drawing_Matrix Indicates the length of the OH_Drawing_Matrix object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathAddPath(OH_Drawing_Path*, const OH_Drawing_Path* src, const OH_Drawing_Matrix*); + +/** + * @brief Return the status that point (x, y) is contained by path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param x Indicates the x-axis value of containment test. + * @param y Indicates the y-axis value of containment test. + * @return Returns true if the point (x, y) is contained by path. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_PathContains(OH_Drawing_Path*, float x, float y); + +/** + * @brief Transforms verb array, point array, and weight by matrix. transform may change verbs + * and increase their number. path is replaced by transformed data. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param OH_Drawing_Matrix Indicates the pointer to an OH_Drawing_Matrix object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathTransform(OH_Drawing_Path*, const OH_Drawing_Matrix*); + +/** + * @brief Sets FillType, the rule used to fill path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Path Indicates the pointer to an OH_Drawing_Path object. + * @param OH_Drawing_PathFillType Indicates the add path's fill type. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathSetFillType(OH_Drawing_Path*, OH_Drawing_PathFillType); + /** * @brief Closes a path. A line segment from the start point to the last point of the path is added. * diff --git a/graphic/graphic_2d/native_drawing/drawing_path_effect.h b/graphic/graphic_2d/native_drawing/drawing_path_effect.h new file mode 100644 index 000000000..90aee6f3a --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_path_effect.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef C_INCLUDE_DRAWING_PATH_EFFECT_H +#define C_INCLUDE_DRAWING_PATH_EFFECT_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 12 + * @version 1.0 + */ + +/** + * @file drawing_path_effect.h + * + * @brief Declares functions related to the pathEffect object in the drawing module. + * + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates an OH_Drawing_PathEffect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param intervals Indicates a array which contain an even number of entries. + * @param count Indicates the number of elements of the intervals array. + * @param phase Indicates the offset into intervals array. + * @return Returns the pointer to the OH_Drawing_PathEffect object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_PathEffect* OH_Drawing_CreateDashPathEffect(float* intervals, int count, float phase); + +/** + * @brief Destroys an OH_Drawing_PathEffect object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PathEffect Indicates the pointer to an OH_Drawing_PathEffect object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PathEffectDestroy(OH_Drawing_PathEffect*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/graphic/graphic_2d/native_drawing/drawing_pen.h b/graphic/graphic_2d/native_drawing/drawing_pen.h index 220e5723d..e94fcb24b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_pen.h +++ b/graphic/graphic_2d/native_drawing/drawing_pen.h @@ -21,7 +21,7 @@ * @{ * * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. - * + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -183,9 +183,9 @@ float OH_Drawing_PenGetMiterLimit(const OH_Drawing_Pen*); void OH_Drawing_PenSetMiterLimit(OH_Drawing_Pen*, float miter); /** - * @brief Enumerates line cap styles of a pen. The line cap style defines + * @brief Enumerates line cap styles of a pen. The line cap style defines * the style of both ends of a line segment drawn by the pen. - * + * * @since 8 * @version 1.0 */ @@ -231,7 +231,7 @@ void OH_Drawing_PenSetCap(OH_Drawing_Pen*, OH_Drawing_PenLineCapStyle); /** * @brief Enumerates pen line join styles. The line join style defines * the shape of the joints of a polyline segment drawn by the pen. - * + * * @since 8 * @version 1.0 */ @@ -291,6 +291,17 @@ void OH_Drawing_PenSetShaderEffect(OH_Drawing_Pen*, OH_Drawing_ShaderEffect*); */ void OH_Drawing_PenSetFilter(OH_Drawing_Pen*, OH_Drawing_Filter*); +/** + * @brief Sets a blender that implements the specified blendmode enum for a pen. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Pen Indicates the pointer to an OH_Drawing_Pen object. + * @param OH_Drawing_BlendMode Indicates the blend mode. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_PenSetBlendMode(OH_Drawing_Pen*, OH_Drawing_BlendMode); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_sampling_options.h b/graphic/graphic_2d/native_drawing/drawing_sampling_options.h new file mode 100644 index 000000000..d29649408 --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_sampling_options.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H +#define C_INCLUDE_DRAWING_SAMPLING_OPTIONS_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 12 + * @version 1.0 + */ + +/** + * @file drawing_sampling_options.h + * + * @brief Declares functions related to the sampling options object in the drawing module. + * + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates storage filter mode. + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** single sample point (nearest neighbor) */ + FILTER_MODE_NEAREST, + /** interporate between 2x2 sample points (bilinear interpolation) */ + FILTER_MODE_LINEAR, +} OH_Drawing_FilterMode; + +/** + * @brief Enumerates storage formats mipmap mode. + * + * @since 12 + * @version 1.0 + */ +typedef enum { + /** ignore mipmap levels, sample from the "base" */ + MIPMAP_MODE_NONE, + /** sample from the nearest level */ + MIPMAP_MODE_NEAREST, + /** interpolate between the two nearest levels */ + MIPMAP_MODE_LINEAR, +} OH_Drawing_MipmapMode; + +/** + * @brief Creates an OH_Drawing_SamplingOptions object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FilterMode sampling filter mode. + * @param OH_Drawing_MipmapMode sampling mipmap mode.. + * @return Returns the pointer to the OH_Drawing_SamplingOptions object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_SamplingOptions* OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode, OH_Drawing_MipmapMode); + +/** + * @brief Destroys an OH_Drawing_SamplingOptions object and reclaims the memory occupied by the object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_SamplingOptions Indicates the pointer to an OH_Drawing_SamplingOptions object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SamplingOptionsDestroy(OH_Drawing_SamplingOptions*); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_blob.h b/graphic/graphic_2d/native_drawing/drawing_text_blob.h index 73325b032..1ba92f61b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_blob.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_blob.h @@ -53,6 +53,62 @@ extern "C" { */ OH_Drawing_TextBlobBuilder* OH_Drawing_TextBlobBuilderCreate(void); +/** + * @brief Creates an OH_Drawing_TextBlob object from text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param text Indicates the the pointer to text. + * @param byteLength Indicates the text length. + * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param OH_Drawing_TextEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. + * @return Returns the pointer to the OH_Drawing_TextBlob object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromText(const void* text, size_t byteLength, + const OH_Drawing_Font*, OH_Drawing_TextEncoding); + +/** + * @brief Creates an OH_Drawing_TextBlob object from pos text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param text Indicates the the pointer to text. + * @param byteLength Indicates the text length. + * @param OH_Drawing_Point2D Indicates the pointer to an OH_Drawing_Point2D array object. + * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param OH_Drawing_TextEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. + * @return Returns the pointer to the OH_Drawing_TextBlob object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromPosText(const void* text, size_t byteLength, + OH_Drawing_Point2D*, const OH_Drawing_Font*, OH_Drawing_TextEncoding); + +/** + * @brief Creates an OH_Drawing_TextBlob object from pos text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param str Indicates the the pointer to text. + * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object. + * @param OH_Drawing_TextEncoding Indicates the pointer to an OH_Drawing_TextEncoding object. + * @return Returns the pointer to the OH_Drawing_TextBlob object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextBlob* OH_Drawing_TextBlobCreateFromString(const char* str, + const OH_Drawing_Font*, OH_Drawing_TextEncoding); + +/** + * @brief Gets the bounds of textblob, assigned to the pointer to an OH_Drawing_Rect object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBlob Indicates the pointer to an OH_Drawing_TextBlob object. + * @param OH_Drawing_Rect Indicates the pointer to an OH_Drawing_Rect object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextBlobGetBounds(OH_Drawing_TextBlob*, OH_Drawing_Rect*); + /** * @brief Defines a run, supplies storage for glyphs and positions. * diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 3a5e5ef58..ce73be523 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1001,6 +1001,19 @@ double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); */ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); +/** + * @brief get line text range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param int Indicates the line number. + * @param bool Indicates whether spaces are contained. + * @return Returns line text range. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool); + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_typeface.h b/graphic/graphic_2d/native_drawing/drawing_typeface.h index a484d70f2..9498b5a1c 100644 --- a/graphic/graphic_2d/native_drawing/drawing_typeface.h +++ b/graphic/graphic_2d/native_drawing/drawing_typeface.h @@ -53,6 +53,32 @@ extern "C" { */ OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); +/** + * @brief Creates a OH_Drawing_Typeface object by file. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path file path. + * @param index file index. + * @return Returns the pointer to the OH_Drawing_Typeface object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile(const char* path, int index); + +/** + * @brief Creates a OH_Drawing_Typeface object by given a stream. If the stream is not a valid + * font file, returns nullptr. Ownership of the stream is transferred, so the caller must not reference + * it or free it again. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_MemoryStream Indicates the pointer to an OH_Drawing_MemoryStream object. + * @param index memory stream index. + * @return Returns the pointer to the OH_Drawing_Typeface object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream*, int32_t index); + /** * @brief Destroys an OH_Drawing_Typeface object and reclaims the memory occupied by the object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h index cdf7f35cc..23e50f38d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_types.h +++ b/graphic/graphic_2d/native_drawing/drawing_types.h @@ -21,7 +21,7 @@ * @{ * * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. - * + * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * * @since 8 @@ -38,6 +38,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { @@ -92,6 +93,37 @@ typedef struct OH_Drawing_Bitmap OH_Drawing_Bitmap; */ typedef struct OH_Drawing_Point OH_Drawing_Point; +/** + * @brief Defines a point of 2d. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + float x; + float y; +} OH_Drawing_Point2D; + +/** + * @brief Defines a point of 3d, which is used to describe the coordinate point. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + float x; + float y; + float z; +} OH_Drawing_Point3D; + +/** + * @brief Defines a pathEffect, which is used to affects stroked paths. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect; + /** * @brief Defines a rect, which is used to describe the rectangle. * @@ -156,6 +188,14 @@ typedef struct OH_Drawing_ColorFilter OH_Drawing_ColorFilter; */ typedef struct OH_Drawing_Font OH_Drawing_Font; +/** + * @brief Defines a memoryStream, which is used to describe the memory stream. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_MemoryStream OH_Drawing_MemoryStream; + /** * @brief Defines a typeface, which is used to describe the typeface. * @@ -173,6 +213,22 @@ typedef struct OH_Drawing_Typeface OH_Drawing_Typeface; */ typedef struct OH_Drawing_TextBlob OH_Drawing_TextBlob; +/** + * @brief Defines a image, which is used to describe a two dimensional array of pixels to draw. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_Image OH_Drawing_Image; + +/** + * @brief Defines a sampling options, which is used to describe the sampling mode. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_SamplingOptions OH_Drawing_SamplingOptions; + /** * @brief Defines a textBlobBuilder, which is used to build the textBlob. * @@ -232,7 +288,7 @@ typedef enum { } OH_Drawing_AlphaFormat; /** - * @brief The blending operation generates a new color for the two colors (source, target). + * @brief The blending operation generates a new color for the two colors (source, destination). * These operations are the same on the 4 color channels: red, green, blue, alpha. * For these, we use alpha channel as an example, rather than naming each channel individually. * @@ -311,6 +367,39 @@ typedef enum { BLEND_MODE_LUMINOSITY, } OH_Drawing_BlendMode; +/** + * @brief Defines image info struct. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** storage for width of image */ + int32_t width; + /** storage for height of image */ + int32_t height; + /** storage for color formats */ + OH_Drawing_ColorFormat colorType; + /** storage for alpha formats */ + OH_Drawing_AlphaFormat alphaType; +} OH_Drawing_Image_Info; + +/** + * @brief Enumerates text encoding types. + * @since 12 + * @version 1.0 + */ +typedef enum { + /** uses bytes to represent UTF-8 or ASCII */ + TEXT_ENCODING_UTF8, + /** uses two byte words to represent most of Unicode */ + TEXT_ENCODING_UTF16, + /** uses four byte words to represent all of Unicode */ + TEXT_ENCODING_UTF32, + /** uses two byte words to represent glyph indices */ + TEXT_ENCODING_GLYPH_ID, +} OH_Drawing_TextEncoding; + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 314e98b41..9fc2693f1 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -2,6 +2,7 @@ { "name": "OH_Drawing_BitmapCreate" }, { "name": "OH_Drawing_BitmapDestroy" }, { "name": "OH_Drawing_BitmapBuild" }, + { "name": "OH_Drawing_BitmapCreateFromPixels" }, { "name": "OH_Drawing_BitmapGetWidth" }, { "name": "OH_Drawing_BitmapGetHeight" }, { "name": "OH_Drawing_BitmapGetPixels" }, @@ -9,6 +10,7 @@ { "name": "OH_Drawing_BrushDestroy" }, { "name": "OH_Drawing_BrushGetAlpha" }, { "name": "OH_Drawing_BrushSetAlpha" }, + { "name": "OH_Drawing_BrushSetBlendMode" }, { "name": "OH_Drawing_BrushIsAntiAlias" }, { "name": "OH_Drawing_BrushSetAntiAlias" }, { "name": "OH_Drawing_BrushGetColor" }, @@ -23,11 +25,13 @@ { "name": "OH_Drawing_CanvasAttachBrush" }, { "name": "OH_Drawing_CanvasDetachBrush" }, { "name": "OH_Drawing_CanvasSave" }, + { "name": "OH_Drawing_CanvasSaveLayer" }, { "name": "OH_Drawing_CanvasRestore" }, { "name": "OH_Drawing_CanvasGetSaveCount" }, { "name": "OH_Drawing_CanvasRestoreToCount" }, { "name": "OH_Drawing_CanvasDrawArc" }, { "name": "OH_Drawing_CanvasDrawBitmap" }, + { "name": "OH_Drawing_CanvasDrawBitmapRect" }, { "name": "OH_Drawing_CanvasDrawCircle" }, { "name": "OH_Drawing_CanvasDrawLine" }, { "name": "OH_Drawing_CanvasDrawOval" }, @@ -41,6 +45,18 @@ { "name": "OH_Drawing_CanvasTranslate" }, { "name": "OH_Drawing_CanvasScale" }, { "name": "OH_Drawing_CanvasClear" }, + { "name": "OH_Drawing_CanvasSetMatrix" }, + { "name": "OH_Drawing_CanvasDrawImageRect" }, + { "name": "OH_Drawing_CanvasReadPixels" }, + { "name": "OH_Drawing_CanvasReadPixelsToBitmap" }, + { "name": "OH_Drawing_CanvasGetWidth" }, + { "name": "OH_Drawing_CanvasGetHeight" }, + { "name": "OH_Drawing_CanvasGetLocalClipBounds" }, + { "name": "OH_Drawing_CanvasGetTotalMatrix" }, + { "name": "OH_Drawing_CanvasConcatMatrix" }, + { "name": "OH_Drawing_CanvasDrawShadow" }, + { "name": "OH_Drawing_CreateDashPathEffect" }, + { "name": "OH_Drawing_PathEffectDestroy" }, { "name": "OH_Drawing_ColorFilterCreateBlendMode" }, { "name": "OH_Drawing_ColorFilterCreateCompose" }, { "name": "OH_Drawing_ColorFilterCreateLinearToSrgbGamma" }, @@ -57,26 +73,49 @@ { "name": "OH_Drawing_FontSetFakeBoldText" }, { "name": "OH_Drawing_FontSetLinearText" }, { "name": "OH_Drawing_FontSetTextSize" }, + { "name": "OH_Drawing_FontCountText" }, { "name": "OH_Drawing_FontSetTextSkewX" }, { "name": "OH_Drawing_FontSetTypeface" }, + { "name": "OH_Drawing_FontGetMetrics" }, + { "name": "OH_Drawing_FontGetTypeface" }, { "name": "OH_Drawing_MaskFilterCreateBlur" }, { "name": "OH_Drawing_MaskFilterDestroy" }, { "name": "OH_Drawing_MatrixCreate" }, + { "name": "OH_Drawing_MatrixCreateRotation" }, + { "name": "OH_Drawing_MatrixCreateScale" }, + { "name": "OH_Drawing_MatrixCreateTranslation" }, { "name": "OH_Drawing_MatrixSetMatrix" }, + { "name": "OH_Drawing_MatrixConcat" }, + { "name": "OH_Drawing_MatrixGetValue" }, + { "name": "OH_Drawing_MatrixRotate" }, + { "name": "OH_Drawing_MatrixTranslate" }, + { "name": "OH_Drawing_MatrixScale" }, + { "name": "OH_Drawing_MatrixInvert" }, + { "name": "OH_Drawing_MatrixIsEqual" }, + { "name": "OH_Drawing_MatrixIsIdentity" }, { "name": "OH_Drawing_MatrixDestroy" }, { "name": "OH_Drawing_PathCreate" }, + { "name": "OH_Drawing_PathCopy" }, { "name": "OH_Drawing_PathDestroy" }, { "name": "OH_Drawing_PathMoveTo" }, { "name": "OH_Drawing_PathLineTo" }, { "name": "OH_Drawing_PathArcTo" }, { "name": "OH_Drawing_PathQuadTo" }, { "name": "OH_Drawing_PathCubicTo" }, + { "name": "OH_Drawing_PathAddRect" }, + { "name": "OH_Drawing_PathAddRoundRect" }, + { "name": "OH_Drawing_PathAddArc" }, + { "name": "OH_Drawing_PathAddPath" }, + { "name": "OH_Drawing_PathContains" }, + { "name": "OH_Drawing_PathTransform" }, + { "name": "OH_Drawing_PathSetFillType" }, { "name": "OH_Drawing_PathClose" }, { "name": "OH_Drawing_PathReset" }, { "name": "OH_Drawing_PenCreate" }, { "name": "OH_Drawing_PenDestroy" }, { "name": "OH_Drawing_PenGetAlpha" }, { "name": "OH_Drawing_PenSetAlpha" }, + { "name": "OH_Drawing_PenSetBlendMode" }, { "name": "OH_Drawing_PenIsAntiAlias" }, { "name": "OH_Drawing_PenSetAntiAlias" }, { "name": "OH_Drawing_PenGetColor" }, @@ -121,12 +160,20 @@ { "name": "OH_Drawing_ShaderEffectCreateRadialGradient" }, { "name": "OH_Drawing_ShaderEffectCreateSweepGradient" }, { "name": "OH_Drawing_ShaderEffectDestroy" }, + { "name": "OH_Drawing_TextBlobCreateFromText" }, + { "name": "OH_Drawing_TextBlobCreateFromPosText" }, + { "name": "OH_Drawing_TextBlobCreateFromString" }, + { "name": "OH_Drawing_TextBlobGetBounds" }, { "name": "OH_Drawing_TextBlobBuilderAllocRunPos" }, { "name": "OH_Drawing_TextBlobBuilderCreate" }, { "name": "OH_Drawing_TextBlobBuilderDestroy" }, { "name": "OH_Drawing_TextBlobBuilderMake" }, { "name": "OH_Drawing_TextBlobDestroy" }, + { "name": "OH_Drawing_MemoryStreamCreate" }, + { "name": "OH_Drawing_MemoryStreamDestroy" }, { "name": "OH_Drawing_TypefaceCreateDefault" }, + { "name": "OH_Drawing_TypefaceCreateFromFile" }, + { "name": "OH_Drawing_TypefaceCreateFromStream" }, { "name": "OH_Drawing_TypefaceDestroy" }, { "name": "OH_Drawing_CreateTypographyHandler" }, { "name": "OH_Drawing_DestroyTypographyHandler" }, @@ -144,6 +191,17 @@ { "name": "OH_Drawing_TypographyGetMaxIntrinsicWidth" }, { "name": "OH_Drawing_TypographyGetAlphabeticBaseline" }, { "name": "OH_Drawing_TypographyGetIdeographicBaseline" }, + { "name": "OH_Drawing_ImageCreate" }, + { "name": "OH_Drawing_ImageDestroy" }, + { "name": "OH_Drawing_ImageBuildFromBitmap" }, + { "name": "OH_Drawing_ImageGetWidth" }, + { "name": "OH_Drawing_ImageGetHeight" }, + { + "first_introduced": "12", + "name": "OH_Drawing_ImageGetImageInfo" + }, + { "name": "OH_Drawing_SamplingOptionsCreate" }, + { "name": "OH_Drawing_SamplingOptionsDestroy" }, { "first_introduced": "11", "name": "OH_Drawing_TypographyHandlerAddPlaceholder" @@ -271,5 +329,9 @@ { "first_introduced": "11", "name": "OH_Drawing_RegisterFontBuffer" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyGetLineTextRange" } ] \ No newline at end of file diff --git a/multimedia/audio_framework/ohaudio.ndk.json b/multimedia/audio_framework/ohaudio.ndk.json index daff64a64..3294a8a93 100644 --- a/multimedia/audio_framework/ohaudio.ndk.json +++ b/multimedia/audio_framework/ohaudio.ndk.json @@ -186,5 +186,13 @@ { "first_introduced": "10", "name": "OH_AudioCapturer_GetFramesRead" + }, + { + "first_introduced": "11", + "name": "OH_AudioRenderer_GetSpeed" + }, + { + "first_introduced": "11", + "name": "OH_AudioRenderer_SetSpeed" } -] \ No newline at end of file +] diff --git a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json index 0f1551246..2a3cb212f 100644 --- a/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json +++ b/multimedia/av_codec/avdemuxer/libnative_media_avdemuxer.ndk.json @@ -26,5 +26,13 @@ { "first_introduced": "11", "name": "OH_AVDemuxer_ReadSampleBuffer" + }, + { + "first_introduced": "11", + "name": "OH_AVDemuxer_SetMediaKeySystemInfoCallback" + }, + { + "first_introduced": "11", + "name": "OH_AVDemuxer_GetMediaKeySystemInfo" } ] diff --git a/multimedia/av_codec/native_avcodec_videodecoder.h b/multimedia/av_codec/native_avcodec_videodecoder.h index 46dc45b8c..6c41bb599 100644 --- a/multimedia/av_codec/native_avcodec_videodecoder.h +++ b/multimedia/av_codec/native_avcodec_videodecoder.h @@ -24,6 +24,8 @@ extern "C" { #endif +typedef struct MediaKeySession MediaKeySession; + /** * @brief Creates a video decoder instance from the mime type, which is recommended in most cases. * @syscap SystemCapability.Multimedia.Media.VideoDecoder @@ -300,8 +302,23 @@ OH_AVErrCode OH_VideoDecoder_FreeOutputBuffer(OH_AVCodec *codec, uint32_t index) */ OH_AVErrCode OH_VideoDecoder_IsValid(OH_AVCodec *codec, bool *isValid); +/** + * @brief Set decryption info. + * + * @syscap SystemCapability.Multimedia.Media.VideoDecoder + * @param codec Pointer to an OH_AVCodec instance + * @param mediaKeySession A media key session instance with decryption function. + * @param secureVideoPath Require secure decoder or not. + * @return Returns AV_ERR_OK if the execution is successful, + * otherwise returns a specific error code, refer to {@link OH_AVErrCode} + * @since 11 + * @version 1.0 +*/ +OH_AVErrCode OH_VideoDecoder_SetDecryptionConfig(OH_AVCodec *codec, MediaKeySession *mediaKeySession, + bool secureVideoPath); + #ifdef __cplusplus } #endif -#endif // NATIVE_AVCODEC_VIDEODECODER_H \ No newline at end of file +#endif // NATIVE_AVCODEC_VIDEODECODER_H diff --git a/multimedia/av_codec/native_avdemuxer.h b/multimedia/av_codec/native_avdemuxer.h index c5935a2e0..84634687e 100644 --- a/multimedia/av_codec/native_avdemuxer.h +++ b/multimedia/av_codec/native_avdemuxer.h @@ -25,6 +25,8 @@ extern "C" { #endif typedef struct OH_AVDemuxer OH_AVDemuxer; +typedef struct DRM_MediaKeySystemInfo DRM_MediaKeySystemInfo; +typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo* mediaKeySystemInfo); /** * @brief Creates an OH_AVDemuxer instance for getting samples from source. @@ -125,6 +127,32 @@ OH_AVErrCode OH_AVDemuxer_ReadSampleBuffer(OH_AVDemuxer *demuxer, uint32_t track */ OH_AVErrCode OH_AVDemuxer_SeekToTime(OH_AVDemuxer *demuxer, int64_t millisecond, OH_AVSeekMode mode); +/** + * @brief Method to set player media key system info callback. + * @syscap SystemCapability.Multimedia.Media.Spliter + * @param demuxer Pointer to an OH_AVDemuxer instance + * @param callback object pointer. + * @return Returns {@link AV_ERR_OK} if the drm info callback is set; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVDemuxer_SetMediaKeySystemInfoCallback(OH_AVDemuxer *demuxer, + DRM_MediaKeySystemInfoCallback callback); + +/** + * @brief Obtains media key system info to create media key session. + * @syscap SystemCapability.Multimedia.Media.Spliter + * @param demuxer Pointer to an OH_AVDemuxer instance + * @param mediaKeySystemInfo Indicates the media key system info which ram space allocated by callee and + released by caller. + * @return Returns {@link AV_ERR_OK} if the current position is get; returns an error code defined + * in {@link native_averrors.h} otherwise. + * @since 11 + * @version 1.0 + */ +OH_AVErrCode OH_AVDemuxer_GetMediaKeySystemInfo(OH_AVDemuxer *demuxer, DRM_MediaKeySystemInfo *mediaKeySystemInfo); + #ifdef __cplusplus } #endif diff --git a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json index e39821e1a..f6b521476 100644 --- a/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json +++ b/multimedia/av_codec/video_decoder/libnative_media_vdec.ndk.json @@ -82,5 +82,10 @@ { "first_introduced": "11", "name": "OH_VideoDecoder_RenderOutputBuffer" + }, + { + "first_introduced": "11", + "name": "OH_VideoDecoder_SetDecryptionConfig" } + ] diff --git a/multimedia/camera_framework/camera.ndk.json b/multimedia/camera_framework/camera.ndk.json index 0e19285a3..a840a259b 100644 --- a/multimedia/camera_framework/camera.ndk.json +++ b/multimedia/camera_framework/camera.ndk.json @@ -31,10 +31,18 @@ "first_introduced": "11", "name": "OH_CameraManager_GetSupportedCameras" }, + { + "first_introduced": "11", + "name": "OH_CameraManager_DeleteSupportedCameras" + }, { "first_introduced": "11", "name": "OH_CameraManager_GetSupportedCameraOutputCapability" }, + { + "first_introduced": "11", + "name": "OH_CameraManager_DeleteSupportedCameraOutputCapability" + }, { "first_introduced": "11", "name": "OH_CameraManager_IsCameraMuted" @@ -71,6 +79,10 @@ "first_introduced": "11", "name": "OH_Camera_GetCameraManager" }, + { + "first_introduced": "11", + "name": "OH_Camera_DeleteCameraManager" + }, { "first_introduced": "11", "name": "OH_CaptureSession_RegisterCallback" diff --git a/multimedia/drm_framework/BUILD.gn b/multimedia/drm_framework/BUILD.gn new file mode 100644 index 000000000..82d1da325 --- /dev/null +++ b/multimedia/drm_framework/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (C) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//build/ohos/ndk/ndk.gni") +ohos_ndk_headers("native_drm_header") { + dest_dir = "$ndk_headers_out_dir/multimedia/drm_framework" + sources = [ + "./common/native_drm_common.h", + "./common/native_drm_err.h", + "./native_mediakeysession.h", + "./native_mediakeysystem.h", + ] +} + +ohos_ndk_library("libnative_drm") { + ndk_description_file = "./libnative_drm.ndk.json" + min_compact_version = "11" + output_name = "native_drm" + output_extension = "so" + + system_capability = "SystemCapability.Multimedia.Drm.Core" + system_capability_headers = [ + "multimedia/drm_framework/native_drm_common.h", + "multimedia/drm_framework/native_drm_err.h", + "multimedia/drm_framework/native_mediakeysession.h", + "multimedia/drm_framework/native_mediakeysystem.h", + ] +} diff --git a/multimedia/drm_framework/common/native_drm_common.h b/multimedia/drm_framework/common/native_drm_common.h new file mode 100644 index 000000000..f634ebf10 --- /dev/null +++ b/multimedia/drm_framework/common/native_drm_common.h @@ -0,0 +1,509 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief Provides APIs of Drm. + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_drm_common.h + * + * @brief Defines the Drm common struct. + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_DRM_COMMON_H +#define NATIVE_DRM_COMMON_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * @brief Enumerates event types of listener. + * @since 11 + * @version 1.0 +*/ +typedef enum DRM_EventType { + /** + * DRM event base. + */ + EVENT_DRM_BASE = 200, + /** + * Provision required event. + */ + EVENT_PROVISION_REQUIRED = 201, + /** + * Media key required event. + */ + EVENT_KEY_REQUIRED = 202, + /** + * Media key expired event. + */ + EVENT_KEY_EXPIRED = 203, + /** + * Vendor defined event. + */ + EVENT_VENDOR_DEFINED = 204, + /** + * Expiration update event. + */ + EVENT_EXPIRATION_UPDATE = 206, + } DRM_EventType; + +/** + * @brief Content potection level. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_ContentProtectionLevel { + /** + * Content potection level unknown. + */ + CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, + /** + * Content potection level software crypto. + */ + CONTENT_PROTECTION_LEVEL_SW_CRYPTO, + /** + * Content potection level hardware crypto. + */ + CONTENT_PROTECTION_LEVEL_HW_CRYPTO, + /** + * Content potection level enhanced hardware crypto. + */ + CONTENT_PROTECTION_LEVEL_ENHANCED_HW_CRYPTO, + /** + * Content potection level max stub. + */ + CONTENT_PROTECTION_LEVEL_MAX, +} DRM_ContentProtectionLevel; + +/** + * @brief Media key type. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_MediaKeyType { + /** + * Media key type offline. + */ + MEDIA_KEY_TYPE_OFFLINE = 0, + /** + * Media key type online + */ + MEDIA_KEY_TYPE_ONLINE, +} DRM_MediaKeyType; + +/** + * @brief Media key request type. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_MediaKeyRequestType { + /** + * Media key request type unknown. + */ + MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, + /** + * Media key request type initial. + */ + MEDIA_KEY_REQUEST_TYPE_INITIAL, + /** + * Media key request type renewal. + */ + MEDIA_KEY_REQUEST_TYPE_RENEWAL, + /** + * Media key request type release. + */ + MEDIA_KEY_REQUEST_TYPE_RELEASE, + /** + * Media key request type none. + */ + MEDIA_KEY_REQUEST_TYPE_NONE, + /** + * Media key request type update. + */ + MEDIA_KEY_REQUEST_TYPE_UPDATE, +} DRM_MediaKeyRequestType; + +/** + * @brief Offline media key status. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_OfflineMediaKeyStatus { + /** + * Offline media key status unknown. + */ + OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, + /** + * Offline media key status usable. + */ + OFFLINE_MEDIA_KEY_STATUS_USABLE, + /** + * Offline media key status inactive. + */ + OFFLINE_MEDIA_KEY_STATUS_INACTIVE, +} DRM_OfflineMediaKeyStatus; + +/** + * @brief Certificate status. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum DRM_CertificateStatus { + /** + * Device already provisioned. + */ + CERT_STATUS_PROVISIONED = 0, + /** + * Device not provisioned. + */ + CERT_STATUS_NOT_PROVISIONED, + /** + * Cert already expired. + */ + CERT_STATUS_EXPIRED, + /** + * Certs are invalid. + */ + CERT_STATUS_INVALID, + /** + * Get certs status failed. + */ + CERT_STATUS_UNAVAILABLE, +} DRM_CertificateStatus; + +/** + * @brief Max count of media key request option. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_REQUEST_OPTION_COUNT 16 +/** + * @brief Max len of media key request option name. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN 64 +/** + * @brief Max len of media key request option data. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN 128 +/** + * @brief Max len of media key request init data. + * @since 11 + * @version 1.0 + */ +#define MAX_INIT_DATA_LEN 2048 +/** + * @brief Max len of media mimetype. + * @since 11 + * @version 1.0 + */ +#define MAX_MIMETYPE_LEN 64 + +/** + * @brief Media key request info. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyRequestInfo { + /** + * Offline or online media key type. + */ + DRM_MediaKeyType type; + /** + * Initial data len. + */ + int32_t initDataLen; + /** + * Initial data format as PSSH after base64 encoding. + */ + uint8_t initData[MAX_INIT_DATA_LEN]; + /** + * Media content mime type. + */ + char mimeType[MAX_MIMETYPE_LEN]; + /** + * OptionsData count. + */ + uint32_t optionsCount; + /** + * Options name the application set to drm framework. + */ + char optionName[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_NAME_LEN]; + /** + * Options data the application set to drm framework. + */ + char optionData[MAX_MEDIA_KEY_REQUEST_OPTION_COUNT][MAX_MEDIA_KEY_REQUEST_OPTION_DATA_LEN]; +} DRM_MediaKeyRequestInfo; + +/** + * @brief Max len of media key request. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_REQUEST_DATA_LEN 8192 +/** + * @brief Max len of URL. + * @since 11 + * @version 1.0 + */ +#define MAX_DEFAULT_URL_LEN 2048 +/** + * @brief Media key request. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyRequest { + /** + * Media key request type. + */ + DRM_MediaKeyRequestType type; + /** + * Media key request data len. + */ + int32_t dataLen; + /** + * Media key request data sent to media key server. + */ + uint8_t data[MAX_MEDIA_KEY_REQUEST_DATA_LEN]; + /** + * Media key server URL. + */ + char defaultUrl[MAX_DEFAULT_URL_LEN]; +} DRM_MediaKeyRequest; + +/** + * @brief Max count of statistics item. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_COUNT 10 +/** + * @brief Max len of statistics item name. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_NAME_LEN 64 +/** + * @brief Max len of statistics item buffer. + * @since 11 + * @version 1.0 + */ +#define MAX_STATISTICS_BUFFER_LEN 256 + +/** + * @brief Statistics of MediaKeySystem. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_Statistics { + /* Statistics count. */ + uint32_t statisticsCount; + /* Statistics name. */ + char statisticsName[MAX_STATISTICS_COUNT][MAX_STATISTICS_NAME_LEN]; + /* Statistics description. */ + char statisticsDescription[MAX_STATISTICS_COUNT][MAX_STATISTICS_BUFFER_LEN]; +} DRM_Statistics; + +/** + * @brief Max count of offline media key id. + * @since 11 + * @version 1.0 + */ +#define MAX_OFFLINE_MEDIA_KEY_ID_COUNT 512 +/** + * @brief Max len of offline media key id. + * @since 11 + * @version 1.0 + */ +#define MAX_OFFLINE_MEDIA_KEY_ID_LEN 64 + +/** + * @brief Offline media key ids array. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_OfflineMediakeyIdArray { + /* Ids count. */ + uint32_t idsCount; + /* Ids len. */ + int32_t idsLen[MAX_OFFLINE_MEDIA_KEY_ID_COUNT]; + /* Ids. */ + uint8_t ids[MAX_OFFLINE_MEDIA_KEY_ID_COUNT][MAX_OFFLINE_MEDIA_KEY_ID_LEN]; +} DRM_OfflineMediakeyIdArray; + +/** + * @brief Max count of key info. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_INFO_COUNT 64 +/** + * @brief Max len of key id. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_ID_LEN 16 +/** + * @brief Max len of key status value. + * @since 11 + * @version 1.0 + */ +#define MAX_KEY_STATUS_VALUE_LEN 128 + +/** + * @brief Media key info. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_KeysInfo { + /* Keys count. */ + uint32_t keysInfoCount; + /* Key id. */ + uint8_t keyId[MAX_KEY_INFO_COUNT][MAX_KEY_ID_LEN]; + /* Key status value. */ + char statusValue[MAX_KEY_INFO_COUNT][MAX_KEY_STATUS_VALUE_LEN]; +} DRM_KeysInfo; + +/** + * @brief Max count of media key status. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_STATUS_COUNT 64 +/** + * @brief Max len of media key status name. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_STATUS_NAME_LEN 64 +/** + * @brief Max len of media key status value. + * @since 11 + * @version 1.0 + */ +#define MAX_MEDIA_KEY_STATUS_VALUE_LEN 256 + +/** + * @brief Media key status like pocily etc. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeyStatus { + /* Status count. */ + uint32_t statusCount; + /* Status name. */ + char statusName[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_NAME_LEN]; + /* Status value. */ + char statusValue[MAX_MEDIA_KEY_STATUS_COUNT][MAX_MEDIA_KEY_STATUS_VALUE_LEN]; +} DRM_MediaKeyStatus; + +/** + * @brief Drm system uuid len. + * @since 11 + * @version 1.0 + */ +#define DRM_UUID_LEN 16 +/** + * @brief Max len of PSSH data. + * @since 11 + * @version 1.0 + */ +#define MAX_PSSH_DATA_LEN 2048 + +/** + * @brief PSSH info by uuid. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_PsshInfo { + /** + * Uuid. + */ + uint8_t uuid[DRM_UUID_LEN]; + /** + * PSSH data len. + */ + int32_t dataLen; + /** + * uint8_t PSSH data. + */ + uint8_t data[MAX_PSSH_DATA_LEN]; +} DRM_PsshInfo; + +/** + * @brief Max count of PSSH info. + * @since 11 + * @version 1.0 + */ +#define MAX_PSSH_INFO_COUNT 8 + +/** + * @brief MediaKeySystemInfo used for player to get media key system info from media source. + * @since 11 + * @version 1.0 + */ +typedef struct DRM_MediaKeySystemInfo { + /* PSSH count. */ + uint32_t psshCount; + /* PSSH info. */ + DRM_PsshInfo psshInfo[MAX_PSSH_INFO_COUNT]; +} DRM_MediaKeySystemInfo; + +typedef void (*DRM_MediaKeySystemInfoCallback)(DRM_MediaKeySystemInfo *mediaKeySystemInfo); + +/** + * @brief Media key system struct. + * @since 11 + * @version 1.0 + */ +typedef struct MediaKeySystem MediaKeySystem; + +/** + * @brief Media key session struct. + * @since 11 + * @version 1.0 + */ +typedef struct MediaKeySession MediaKeySession; + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_DRM_COMMON_H \ No newline at end of file diff --git a/multimedia/drm_framework/common/native_drm_err.h b/multimedia/drm_framework/common/native_drm_err.h new file mode 100644 index 000000000..a2f0db88b --- /dev/null +++ b/multimedia/drm_framework/common/native_drm_err.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief Provides APIs of Drm. + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_drm_err.h + * @brief Defines the Drm errors. + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef NATIVE_DRM_ERR_H +#define NATIVE_DRM_ERR_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief DRM error code + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ +typedef enum Drm_ErrCode { + /** + * the operation completed successfully. + */ + DRM_ERR_OK = 0, + /** + * DRM CAPI ERROR BASE. + */ + DRM_CAPI_ERR_BASE = 24700500, + /** + * no memory. + */ + DRM_ERR_NO_MEMORY = DRM_CAPI_ERR_BASE + 1, + /** + * opertation not be permitted. + */ + DRM_ERR_OPERATION_NOT_PERMITTED = DRM_CAPI_ERR_BASE + 2, + /** + * invalid argument. + */ + DRM_ERR_INVALID_VAL = DRM_CAPI_ERR_BASE + 3, + /** + * IO error. + */ + DRM_ERR_IO = DRM_CAPI_ERR_BASE + 4, + /** + * network timeout. + */ + DRM_ERR_TIMEOUT = DRM_CAPI_ERR_BASE + 5, + /** + * unknown error. + */ + DRM_ERR_UNKNOWN = DRM_CAPI_ERR_BASE + 6, + /** + * drm service died. + */ + DRM_ERR_SERVICE_DIED = DRM_CAPI_ERR_BASE + 7, + /** + * not support this operation in this state. + */ + DRM_ERR_INVALID_STATE = DRM_CAPI_ERR_BASE + 8, + /** + * unsupport interface. + */ + DRM_ERR_UNSUPPORTED = DRM_CAPI_ERR_BASE + 9, + /** + * Meet max MediaKeySystem num limit. + */ + DRM_ERR_MAX_SYSTEM_NUM_REACHED = DRM_CAPI_ERR_BASE + 10, + /** + * Meet max MediaKeySession num limit. + */ + DRM_ERR_MAX_SESSION_NUM_REACHED = DRM_CAPI_ERR_BASE + 11, + /** + * extend err start. + */ + DRM_ERR_EXTEND_START = DRM_CAPI_ERR_BASE + 100, +} Drm_ErrCode; + +#ifdef __cplusplus +} +#endif + +#endif // NATIVE_DRM_ERR_H diff --git a/multimedia/drm_framework/libnative_drm.ndk.json b/multimedia/drm_framework/libnative_drm.ndk.json new file mode 100644 index 000000000..185f5e08d --- /dev/null +++ b/multimedia/drm_framework/libnative_drm.ndk.json @@ -0,0 +1,122 @@ +[ + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_IsSupported" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_IsSupported2" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_IsSupported3" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_Create" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_SetConfigurationString" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GetConfigurationString" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_SetConfigurationByteArray" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GetConfigurationByteArray" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GetStatistics" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GetMaxContentProtectionLevel" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_SetMediaKeySystemCallback" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_CreateMediaKeySession" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GenerateKeySystemRequest" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_ProcessKeySystemResponse" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GetOfflineMediaKeyIds" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GetOfflineMediaKeyStatus" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_ClearOfflineMediaKeys" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_GetCertificateStatus" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySystem_Destroy" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_GenerateMediaKeyRequest" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_ProcessMediaKeyResponse" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_CheckMediaKeyStatus" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_ClearMediaKeys" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_GenerateOfflineReleaseRequest" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_ProcessOfflineReleaseResponse" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_RestoreOfflineMediaKeys" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_GetContentProtectionLevel" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_RequireSecureDecoderModule" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_SetMediaKeySessionCallback" + }, + { + "first_introduced": "11", + "name": "OH_MediaKeySession_Destroy" + } +] \ No newline at end of file diff --git a/multimedia/drm_framework/native_mediakeysession.h b/multimedia/drm_framework/native_mediakeysession.h new file mode 100644 index 000000000..999aa04e1 --- /dev/null +++ b/multimedia/drm_framework/native_mediakeysession.h @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief Provides APIs of Drm. + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_mediakeysession.h + * @brief Defines the Drm MediaKeySession APIs. Provide following function: + * generate media key request, process media key response, event listening, + * get content protection level, check media key status, remove media key etc.. + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef OHOS_DRM_NATIVE_MEDIA_KEY_SESSION_H +#define OHOS_DRM_NATIVE_MEDIA_KEY_SESSION_H + +#include +#include +#include "native_drm_err.h" +#include "native_drm_common.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/** + * @brief Call back will be invoked when event triggers. + * @param eventType Event type. + * @param info Event info gotten from media key session. + * @param infoLen Event info len. + * @param extra Extra info gotten from media key session. + * @return Drm_ErrCode. + * @since 11 + * @version 1.0 + */ +typedef Drm_ErrCode (*MediaKeySession_EventCallback)(DRM_EventType eventType, uint8_t *info, + int32_t infoLen, char *extra); + +/** + * @brief Call back will be invoked when key changes. + * @param keysInfo Key info gotten from media key system. + * @param newKeysAvailable Whether new keys available. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +typedef Drm_ErrCode (*MediaKeySession_KeyChangeCallback)(DRM_KeysInfo *keysInfo, bool newKeysAvailable); + +/** + * @brief MediaKeySession_Callback struct, used to listen event like key expired and key change etc.. + * @since 11 + * @version 1.0 + */ +typedef struct MediaKeySession_Callback { + /** + * Normal event callback like key expired etc.. + */ + MediaKeySession_EventCallback eventCallback; + /** + * Key change callback for keys change event. + */ + MediaKeySession_KeyChangeCallback keyChangeCallback; +} MediaKeySession_Callback; + +/** + * @brief Generate media key request. + * @param mediaKeySession Media key session instance. + * @param info Media key request info. + * @param mediaKeyRequest Media key request. + * @return Drm_ErrCode. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_GenerateMediaKeyRequest(MediaKeySession *mediaKeySession, + DRM_MediaKeyRequestInfo *info, DRM_MediaKeyRequest *mediaKeyRequest); + +/** + * @brief Process media key response. + * @param mediaKeySession Media key session instance. + * @param response Media Key resposne. + * @param responseLen Media Key resposne len. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len for in buffer and out data. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_ProcessMediaKeyResponse(MediaKeySession *mediaKeySession, + uint8_t *response, int32_t responseLen, uint8_t *offlineMediaKeyId, int32_t *offlineMediaKeyIdLen); + +/** + * @brief Check media key status. + * @param mediaKeySession Media key session instance. + * @param mediaKeyStatus Media key status. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_CheckMediaKeyStatus(MediaKeySession *mediaKeySessoin, + DRM_MediaKeyStatus *mediaKeyStatus); + +/** + * @brief Clear media keys of the current session . + * @param mediaKeySession Media key session instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_ClearMediaKeys(MediaKeySession *mediaKeySessoin); + +/** + * @brief Generate offline media key release request. + * @param mediaKeySession Media key session instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @param releaseRequest Media Key release request. + * @param releaseRequestLen Media Key release request len for in buffer and out data. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_GenerateOfflineReleaseRequest(MediaKeySession *mediaKeySessoin, + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseRequest, + int32_t *releaseRequestLen); + +/** + * @brief Process offline media key release response. + * @param mediaKeySession Media key session instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @param releaseReponse Media Key resposne. + * @param releaseReponseLen Media Key resposne len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_ProcessOfflineReleaseResponse(MediaKeySession *mediaKeySessoin, + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, uint8_t *releaseReponse, + int32_t releaseReponseLen); + +/** + * @brief Restore offline media keys by ID. + * @param mediaKeySession Media key session instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_RestoreOfflineMediaKeys(MediaKeySession *mediaKeySessoin, + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); + +/** + * @brief Get content protection level of the session. + * @param mediaKeySession Media key session instance. + * @param contentProtectionLevel Content protection level. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_GetContentProtectionLevel(MediaKeySession *mediaKeySessoin, + DRM_ContentProtectionLevel *contentProtectionLevel); + +/** + * @brief Whether the encrypted content require a secure decoder or not. + * @param mediaKeySession Media key session instance. + * @param mimeType The media type. + * @param status Whether secure decoder is required. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_RequireSecureDecoderModule(MediaKeySession *mediaKeySessoin, + const char *mimeType, bool *status); + +/** + * @brief Set media key session event callback. + * @param mediaKeySession Media key session instance. + * @param callback Callback to be set to the media key session. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_SetMediaKeySessionCallback(MediaKeySession *mediaKeySessoin, + MediaKeySession_Callback *callback); + +/** + * @brief Release the resource before the session gonna be unused. + * @param mediaKeySession Media key session instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySession_Destroy(MediaKeySession *mediaKeySessoin); + +#ifdef __cplusplus +} +#endif + +#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H \ No newline at end of file diff --git a/multimedia/drm_framework/native_mediakeysystem.h b/multimedia/drm_framework/native_mediakeysystem.h new file mode 100644 index 000000000..463e50e0b --- /dev/null +++ b/multimedia/drm_framework/native_mediakeysystem.h @@ -0,0 +1,281 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drm + * @{ + * + * @brief Provides APIs of Drm. + * @kit Drm. + * @since 11 + * @version 1.0 + */ + +/** + * @file native_mediakeysystem.h + * @brief Defines the Drm MediaKeySystem APIs. Provide following function: + * query if specific drm supported or not, create media key session, + * get and set configurations, get statistics, get content protection level, + * generate provision request, process provision response, event listening, + * get content protection level, manage offline media key etc.. + * @library libnative_drm.z.so + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * @version 1.0 + */ + +#ifndef OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H +#define OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H + +#include +#include +#include +#include "native_drm_err.h" +#include "native_drm_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Call back will be invoked when event triggers. + * @param eventType Event type. + * @param info Event info gotten from media key system. + * @param infoLen Event info len. + * @param extra Extra info gotten from media key system. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +typedef Drm_ErrCode (*MediaKeySystem_Callback)(DRM_EventType eventType, uint8_t *info, + int32_t infoLen, char *extra); + +/** + * @brief Query if media key system is supported. + * @param name Used to point a Digital Right Management solution. + * @return Supported or not in boolean. + * @since 11 + * @version 1.0 + */ +bool OH_MediaKeySystem_IsSupported(const char *name); +/** + * @brief Query if media key system is supported. + * @param name Used to point a Digital Right Management solution. + * @param mimeType Used to specifies the media type. + * @return Supported or not in boolean. + * @since 11 + * @version 1.0 + */ +bool OH_MediaKeySystem_IsSupported2(const char *name, const char *mimeType); +/** + * @brief Query if media key system is supported. + * @param name Used to point a Digital Right Management solution. + * @param mimeType Used to specifies the media type. + * @param contentProtectionLevel Used to specifies the ContentProtectionLevel. + * @return Supported or not in boolean. + * @since 11 + * @version 1.0 + */ +bool OH_MediaKeySystem_IsSupported3(const char *name, const char *mimeType, + DRM_ContentProtectionLevel contentProtectionLevel); + +/** + * @brief Creates a media key system instance from the name. + * @param name Secifies which drm system will be created by name. + * @param mediaKeySystem Media key system instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully, + * return DRM_ERR_MAX_SYSTEM_NUM_REACHED when max num media key system reached. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_Create(const char *name, MediaKeySystem **mediaKeySystem); +/** + * @brief Set media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule string to be set. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_SetConfigurationString(MediaKeySystem *mediaKeySystem, + const char *configName, const char *value); +/** + * @brief Get media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule string to be get. + * @param valueLen Configuration vaule string len for in buffer. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetConfigurationString(MediaKeySystem *mediaKeySystem, + const char *configName, char *value, int32_t valueLen); +/** + * @brief Set media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule in byte array to be set. + * @param valueLen Value array len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_SetConfigurationByteArray(MediaKeySystem *mediaKeySystem, + const char *configName, uint8_t *value, int32_t valueLen); +/** + * @brief Get media key system configuration value by name. + * @param mediaKeySystem Media key system instance. + * @param configName Configuration name string. + * @param value Configuration vaule in byte array to be get. + * @param valueLen Configuration vaule len for in buffer and out data. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetConfigurationByteArray(MediaKeySystem *mediaKeySystem, + const char *configName, uint8_t *value, int32_t *valueLen); +/** + * @brief Get media key system statistics info. + * @param mediaKeySystem Media key system instance. + * @param statistics Statistic info gotten. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetStatistics(MediaKeySystem *mediaKeySystem, DRM_Statistics *statistics); +/** + * @brief Get the max content protection level media key system supported. + * @param mediaKeySystem Media key system instance. + * @param contentProtectionLevel Content protection level. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetMaxContentProtectionLevel(MediaKeySystem *mediaKeySystem, + DRM_ContentProtectionLevel *contentProtectionLevel); +/** + * @brief Set media key system event callback. + * @param mediaKeySystem Media key system instance. + * @param callback Callback to be set to the media key system. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_SetMediaKeySystemCallback(MediaKeySystem *mediaKeySystem, + MediaKeySystem_Callback callback); + +/** + * @brief Create a media key session instance. + * @param mediaKeySystem Media key system instance which will create the media key session. + * @param level Specifies the content protection level. + * @param mediaKeySession Media key session instance. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully, + * return DRM_ERR_MAX_SESSION_NUM_REACHED when max num media key system reached. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_CreateMediaKeySession(MediaKeySystem *mediaKeySystem, + DRM_ContentProtectionLevel *level, MediaKeySession **mediaKeySession); + +/** + * @brief Generate a media key system provision request. + * @param mediaKeySystem Media key system instance. + * @param request Provision request data sent to provision server. + * @param requestLen Provision request data len for in buffer and out data. + * @param defaultUrl Provision server URL. + * @param defaultUrlLen Provision server URL len for in buffer. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GenerateKeySystemRequest(MediaKeySystem *mediaKeySystem, uint8_t *request, + int32_t *requestLen, char *defaultUrl, int32_t defaultUrlLen); + +/** + * @brief Process a media key system provision response. + * @param mediaKeySystem Media key system instance. + * @param response The provision reponse will be processed. + * @param responseLen The response len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_ProcessKeySystemResponse(MediaKeySystem *mediaKeySystem, + uint8_t *response, int32_t responseLen); + +/** + * @brief Get offline media key ids . + * @param mediaKeySystem Media key system instance. + * @param offlineMediaKeyIds Media key ids of all offline media keys. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyIds(MediaKeySystem *mediaKeySystem, + DRM_OfflineMediakeyIdArray *offlineMediaKeyIds); + +/** + * @brief Get offline media key status. + * @param mediaKeySystem Media key system instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @param status The media key status gotten. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetOfflineMediaKeyStatus(MediaKeySystem *mediaKeySystem, + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen, DRM_OfflineMediaKeyStatus *status); + +/** + * @brief Clear an offline media key by id. + * @param mediaKeySystem Media key system instance. + * @param offlineMediaKeyId Offline media key identifier. + * @param offlineMediaKeyIdLen Offline media key identifier len. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_ClearOfflineMediaKeys(MediaKeySystem *mediaKeySystem, + uint8_t *offlineMediaKeyId, int32_t offlineMediaKeyIdLen); + +/** + * @brief Get certificate status of media key system. + * @param mediaKeySystem Media key system instance. + * @param certStatus Status will be gotten. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_GetCertificateStatus(MediaKeySystem *mediaKeySystem, + DRM_CertificateStatus *certStatus); + +/** + * @brief Destroy a media key system instance. + * @param mediaKeySystem Secifies which media key system instance will be destroyed. + * @return DRM_ERR_INVALID_VAL when the params checked failure, return DRM_ERR_OK when function called successfully. + * @since 11 + * @version 1.0 + */ +Drm_ErrCode OH_MediaKeySystem_Destroy(MediaKeySystem *mediaKeySystem); + + +#ifdef __cplusplus +} +#endif + +#endif // OHOS_DRM_NATIVE_MEDIA_KEY_SYSTEM_H \ No newline at end of file diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index 32a883a55..e8db017f0 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -42,6 +42,7 @@ #include #include "native_averrors.h" #include "avplayer_base.h" +#include "native_window/external_window.h" #ifdef __cplusplus extern "C" { diff --git a/multimedia/player_framework/avplayer_base.h b/multimedia/player_framework/avplayer_base.h index 98b1f4080..197f29a56 100644 --- a/multimedia/player_framework/avplayer_base.h +++ b/multimedia/player_framework/avplayer_base.h @@ -42,7 +42,6 @@ extern "C" { #endif typedef struct OH_AVPlayer OH_AVPlayer; -typedef struct NativeWindow OHNativeWindow; /** * @brief Player States diff --git a/sensors/miscdevice/vibrator/include/vibrator.h b/sensors/miscdevice/vibrator/include/vibrator.h index 0dd94c320..e01fe0e8a 100644 --- a/sensors/miscdevice/vibrator/include/vibrator.h +++ b/sensors/miscdevice/vibrator/include/vibrator.h @@ -39,8 +39,6 @@ extern "C" { #endif -namespace OHOS { -namespace Sensors { /** * @brief Controls the vibrator to vibrate continuously for a given duration. * @@ -80,10 +78,8 @@ int32_t OH_Vibrator_PlayVibrationCustom(Vibrator_FileDescription fileDescription * @since 11 */ int32_t OH_Vibrator_Cancel(); -} // namespace Sensors -} // namespace OHOS #ifdef __cplusplus -}; +} #endif /** @} */ #endif // endif VIBRATOR_H \ No newline at end of file diff --git a/sensors/miscdevice/vibrator/include/vibrator_type.h b/sensors/miscdevice/vibrator/include/vibrator_type.h index 9be871278..991a6bf14 100644 --- a/sensors/miscdevice/vibrator/include/vibrator_type.h +++ b/sensors/miscdevice/vibrator/include/vibrator_type.h @@ -16,7 +16,7 @@ #ifndef VIBRATOR_TYPE_H #define VIBRATOR_TYPE_H -#include +#include #ifdef __cplusplus extern "C" { @@ -83,9 +83,8 @@ typedef struct Vibrator_FileDescription { /**< Total length of the custom vibration sequence. */ int64_t length; } Vibrator_FileDescription; -/** @} */ #ifdef __cplusplus -}; +} #endif #endif // endif VIBRATOR_TYPE_H \ No newline at end of file diff --git a/sensors/sensor/oh_sensor.h b/sensors/sensor/oh_sensor.h index ee0d78c6a..2f63c2197 100644 --- a/sensors/sensor/oh_sensor.h +++ b/sensors/sensor/oh_sensor.h @@ -96,4 +96,5 @@ Sensor_Result OH_Sensor_Unsubscribe(const Sensor_SubscriptionId *id, const Senso #ifdef __cplusplus } #endif +/** @} */ #endif // OH_SENSOR_H \ No newline at end of file diff --git a/sensors/sensor/oh_sensor_type.h b/sensors/sensor/oh_sensor_type.h index f8ca2c4db..51c232af6 100644 --- a/sensors/sensor/oh_sensor_type.h +++ b/sensors/sensor/oh_sensor_type.h @@ -34,7 +34,7 @@ #ifndef OH_SENSOR_TYPE_H #define OH_SENSOR_TYPE_H -#include +#include #ifdef __cplusplus extern "C" { @@ -493,4 +493,5 @@ int32_t OH_SensorSubscriber_GetCallback(Sensor_Subscriber* subscriber, Sensor_Ev #ifdef __cplusplus } #endif +/** @} */ #endif // OH_SENSOR_TYPE_H \ No newline at end of file diff --git a/third_party/libuv/README.OpenSource b/third_party/libuv/README.OpenSource index a62892ff4..0be037157 100644 --- a/third_party/libuv/README.OpenSource +++ b/third_party/libuv/README.OpenSource @@ -3,7 +3,7 @@ "Name": "libuv", "License": "MIT License", "License File": "LICENSE", - "Version Number": "v1.44.1", + "Version Number": "v1.44.2", "Owner": "sunbingxin@huawei.com", "Upstream URL": "https://github.com/libuv/libuv", "Description": "libuv is a multi-platform support library with a focus on asynchronous I/O." diff --git a/third_party/mindspore/README.OpenSource b/third_party/mindspore/README.OpenSource index 212d67dc5..bd6c7775a 100644 --- a/third_party/mindspore/README.OpenSource +++ b/third_party/mindspore/README.OpenSource @@ -3,9 +3,9 @@ "Name": "MindSpore", "License": "Apache License 2.0", "License File": "LICENSE.txt", - "Version Number": "1.8.1", - "Owner": "zhuguodong0001@163.com", - "Upstream URL": "https://gitee.com/mindspore/mindspore/repository/archive/v1.8.1", + "Version Number": "2.1.0", + "Owner": "chengfeng27@huawei.com", + "Upstream URL": "https://gitee.com/mindspore/mindspore/repository/archive/v2.1.0", "Description": "MindSpore is a new open source deep learning training/inference framework that could be used for mobile, edge and cloud scenarios." } ] diff --git a/third_party/mindspore/kits/model.h b/third_party/mindspore/kits/model.h index 5281a8608..ee7eed7d4 100644 --- a/third_party/mindspore/kits/model.h +++ b/third_party/mindspore/kits/model.h @@ -181,7 +181,7 @@ OH_AI_API OH_AI_TensorHandle OH_AI_ModelGetOutputByTensorName(const OH_AI_ModelH * @return TrainCfg object handle. * @since 11 */ -OH_AI_API OH_AI_TrainCfgHandle OH_AI_TrainCfgCreate(void); +OH_AI_API OH_AI_TrainCfgHandle OH_AI_TrainCfgCreate(); /** * @brief Destroy the train_cfg object. Only valid for Lite Train. diff --git a/third_party/musl/ndk_script/BUILD.gn b/third_party/musl/ndk_script/BUILD.gn index bbca1b91e..6853fabf2 100644 --- a/third_party/musl/ndk_script/BUILD.gn +++ b/third_party/musl/ndk_script/BUILD.gn @@ -17,7 +17,9 @@ import("//third_party/musl/musl_config.gni") import("//third_party/musl/musl_src.gni") import("//third_party/musl/musl_template.gni") -toolchains_dir = "//prebuilts/clang/ohos" +declare_args() { + toolchains_dir = "//prebuilts/clang/ohos" +} musl_target_out_dir = "${root_out_dir}/obj/third_party/musl" ndk_musl_include = "ndk_musl_include" interface_musl_dir = "//interface/sdk_c/third_party/musl" diff --git a/third_party/node/README.OpenSource b/third_party/node/README.OpenSource index 4679c4961..19eb392ef 100644 --- a/third_party/node/README.OpenSource +++ b/third_party/node/README.OpenSource @@ -3,7 +3,7 @@ "Name": "node", "License": "ISC License,Public Domain,MIT License,Free Software Foundation - MIT License,Apache License V2.0,ICU License,zlib/libpng License,BSD 2-Clause License,BSD 3-Clause License", "License File": "LICENSE", - "Version Number": "14.21.2", + "Version Number": "18.18.2", "Owner": "sunbingxin@huawei.com", "Upstream URL": "http://www.nodejs.org/", "Description": "Node.js is an open-source, cross-platform, JavaScript runtime environment. It executes JavaScript code outside of a browser." diff --git a/web/webview/interfaces/native/BUILD.gn b/web/webview/interfaces/native/BUILD.gn index e65141da7..ad0a8e96a 100644 --- a/web/webview/interfaces/native/BUILD.gn +++ b/web/webview/interfaces/native/BUILD.gn @@ -18,10 +18,20 @@ ohos_ndk_library("libohweb") { output_name = "ohweb" output_extension = "so" ndk_description_file = "./libohweb.ndk.json" + system_capability = "SystemCapability.Web.Webview.Core" + system_capability_headers = [ + "web/arkweb_net_error_list.h", + "web/arkweb_scheme_handler.h", + "web/native_interface_arkweb.h", + ] min_compact_version = "11" } ohos_ndk_headers("web_header") { dest_dir = "$ndk_headers_out_dir/web/" - sources = [ "native_interface_arkweb.h" ] + sources = [ + "arkweb_net_error_list.h", + "arkweb_scheme_handler.h", + "native_interface_arkweb.h", + ] } diff --git a/web/webview/interfaces/native/arkweb_net_error_list.h b/web/webview/interfaces/native/arkweb_net_error_list.h new file mode 100644 index 000000000..e43687661 --- /dev/null +++ b/web/webview/interfaces/native/arkweb_net_error_list.h @@ -0,0 +1,2139 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Web + * @{ + * + * @brief Provides APIs for the ArkWeb net errors. + * @since 12 + */ +/** + * @file arkweb_net_error_list.h + * + * @brief Declares the APIs for the ArkWeb net errors. + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +#ifndef ARKWEB_NET_ERROR_LIST_H +#define ARKWEB_NET_ERROR_LIST_H + +enum ArkWeb_NetError { + /* + * @brief Invalid param. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_NET_INVALID_PARAM = 2, + + /* + * @brief Unknown error. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_NET_UNKNOWN = 1, + + /* + * @brief Normal. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_NET_OK = 0, + + /* + * @brief An asynchronous IO operation is not yet complete. This usually does not + * indicate a fatal error. Typically this error will be generated as a + * notification to wait for some external notification that the IO operation + * finally completed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IO_PENDING = -1, + + /* + * @brief A generic failure occurred. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FAILED = -2, + + /* + * @brief An operation was aborted. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ABORTED = -3, + + /* + * @brief An argument to the function is incorrect. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_ARGUMENT = -4, + + /* + * @brief The handle or file descriptor is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_HANDLE = -5, + + /* + * @brief The file or directory cannot be found. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_NOT_FOUND = -6, + + /* + * @brief An operation timed out. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TIMED_OUT = -7, + + /* + * @brief The file is too large. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_TOO_LARGE = -8, + + /* + * @brief An unexpected error. This may be caused by a programming mistake or an + * invalid assumption. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNEXPECTED = -9, + + /* + * @brief Permission to access a resource, other than the network, was denied. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ACCESS_DENIED = -10, + + /* + * @brief The operation failed because of unimplemented functionality. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NOT_IMPLEMENTED = -11, + + /* + * @brief There were not enough resources to complete the operation. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INSUFFICIENT_RESOURCES = -12, + + /* + * @brief Memory allocation failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_OUT_OF_MEMORY = -13, + + /* + * @brief The file upload failed because the file's modification time was different + * from the expectation. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UPLOAD_FILE_CHANGED = -14, + + /* + * @brief The socket is not connected. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_NOT_CONNECTED = -15, + + /* + * @brief The file already exists. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_EXISTS = -16, + + /* + * @brief The path or file name is too long. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_PATH_TOO_LONG = -17, + + /* + * @brief Not enough room left on the disk. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_NO_SPACE = -18, + + /* + * @brief The file has a virus. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FILE_VIRUS_INFECTED = -19, + + /* + * @brief The client chose to block the request. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_CLIENT = -20, + + /* + * @brief The network changed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NETWORK_CHANGED = -21, + + /* + * @brief The request was blocked by the URL block list configured by the domain + * administrator. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_ADMINISTRATOR = -22, + + /* + * @brief The socket is already connected. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_CONNECTED = -23, + + /* + * @brief The upload failed because the upload stream needed to be re-read, due to a + * retry or a redirect, but the upload stream doesn't support that operation. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UPLOAD_STREAM_REWIND_NOT_SUPPORTED = -25, + + /* + * @brief The request failed because the URLRequestContext is shutting down, or has + * been shut down. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTEXT_SHUT_DOWN = -26, + + /* + * @brief The request failed because the response was delivered along with requirements + * which are not met ('X-Frame-Options' and 'Content-Security-Policy' ancestor + * checks and 'Cross-Origin-Resource-Policy' for instance,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_RESPONSE = -27, + + /* + * @brief The request was blocked by system policy disallowing some or all cleartext + * requests. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CLEARTEXT_NOT_PERMITTED = -29, + + /* + * @brief The request was blocked by a Content Security Policy. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_CSP = -30, + + /* + * @brief The request was blocked because of no H/2 or QUIC session. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_H2_OR_QUIC_REQUIRED = -31, + + /* + * @brief The request was blocked by CORB or ORB. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BLOCKED_BY_ORB = -32, + + /* + * @brief A connection was closed (corresponding to a TCP FIN,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_CLOSED = -100, + + /* + * @brief A connection was reset (corresponding to a TCP RST,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_RESET = -101, + + /* + * @brief A connection attempt was refused. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_REFUSED = -102, + + /* + * @brief A connection timed out as a result of not receiving an ACK for data sent. + * This can include a FIN packet that did not get ACK'd. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_ABORTED = -103, + + /* + * @brief A connection attempt failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_FAILED = -104, + + /* + * @brief The host name could not be resolved. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NAME_NOT_RESOLVED = -105, + + /* + * @brief The Internet connection has been lost. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INTERNET_DISCONNECTED = -106, + + /* + * @brief An SSL protocol error occurred. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_PROTOCOL_ERROR = -107, + + /* + * @brief The IP address or port number is invalid (e.g., cannot connect to the IP + * address 0 or the port 0,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADDRESS_INVALID = -108, + + /* + * @brief The IP address is unreachable. This usually means that there is no route to + * the specified host or network. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADDRESS_UNREACHABLE = -109, + + /* + * @brief The server requested a client certificate for SSL client authentication. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110, + + /* + * @brief A tunnel connection through the proxy could not be established. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TUNNEL_CONNECTION_FAILED = -111, + + /* + * @brief No SSL protocol versions are enabled. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_SSL_VERSIONS_ENABLED = -112, + + /* + * @brief The client and server don't support a common SSL protocol version or + * cipher suite. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113, + + /* + * @brief The server requested a renegotiation (rehandshake,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_RENEGOTIATION_REQUESTED = -114, + + /* + * @brief The proxy requested authentication (for tunnel establishment, with an + * unsupported method. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_AUTH_UNSUPPORTED = -115, + + /* + * @brief The SSL handshake failed because of a bad or missing client certificate. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_BAD_SSL_CLIENT_AUTH_CERT = -117, + + /* + * @brief A connection attempt timed out. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONNECTION_TIMED_OUT = -118, + + /* + * @brief There are too many pending DNS resolves, so a request in the queue was + * aborted. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HOST_RESOLVER_QUEUE_TOO_LARGE = -119, + + /* + * @brief Failed establishing a connection to the SOCKS proxy server for a target host. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKS_CONNECTION_FAILED = -120, + + /* + * @brief The SOCKS proxy server failed establishing connection to the target host + * because that host is unreachable. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKS_CONNECTION_HOST_UNREACHABLE = -121, + + /* + * @brief The request to negotiate an alternate protocol failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ALPN_NEGOTIATION_FAILED = -122, + + /* + * @brief The peer sent an SSL no_renegotiation alert message. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_NO_RENEGOTIATION = -123, + + /* + * @brief Winsock sometimes reports more data written than passed. This is probably + * due to a broken LSP. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES = -124, + + /* + * @brief An SSL peer sent us a fatal decompression_failure alert. This typically + * occurs when a peer selects DEFLATE compression in the mistaken belief that + * it supports it. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_DECOMPRESSION_FAILURE_ALERT = -125, + + /* + * @brief An SSL peer sent us a fatal bad_record_mac alert. This has been observed + * from servers with buggy DEFLATE support. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_BAD_RECORD_MAC_ALERT = -126, + + /* + * @brief The proxy requested authentication (for tunnel establishment,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_AUTH_REQUESTED = -127, + + /* + * @brief Could not create a connection to the proxy server. An error occurred + * either in resolving its name, or in connecting a socket to it. + * Note that this does NOT include failures during the actual "CONNECT" method + * of an HTTP proxy. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_CONNECTION_FAILED = -130, + + /* + * @brief A mandatory proxy configuration could not be used. Currently this means + * that a mandatory PAC script could not be fetched, parsed or executed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MANDATORY_PROXY_CONFIGURATION_FAILED = -131, + + /* + * @brief We've hit the max socket limit for the socket pool while preconnecting. We + * don't bother trying to preconnect more sockets. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PRECONNECT_MAX_SOCKET_LIMIT = -133, + + /* + * @brief The permission to use the SSL client certificate's private key was denied. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED = -134, + + /* + * @brief The SSL client certificate has no private key. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY = -135, + + /* + * @brief The certificate presented by the HTTPS Proxy was invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_CERTIFICATE_INVALID = -136, + + /* + * @brief An error occurred when trying to do a name resolution (DNS,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NAME_RESOLUTION_FAILED = -137, + + /* + * @brief Permission to access the network was denied. This is used to distinguish + * errors that were most likely caused by a firewall from other access denied + * errors. See also ERR_ACCESS_DENIED. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NETWORK_ACCESS_DENIED = -138, + + /* + * @brief The request throttler module cancelled this request to avoid DDOS. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TEMPORARILY_THROTTLED = -139, + + /* + * @brief A request to create an SSL tunnel connection through the HTTPS proxy + * received a 302 (temporary redirect, response. The response body might + * include a description of why the request failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTPS_PROXY_TUNNEL_RESPONSE_REDIRECT = -140, + + /* + * @brief We were unable to sign the CertificateVerify data of an SSL client auth + * handshake with the client certificate's private key. + * Possible causes for this include the user implicitly or explicitly + * denying access to the private key, the private key may not be valid for + * signing, the key may be relying on a cached handle which is no longer + * valid, or the CSP won't allow arbitrary data to be signed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED = -141, + + /* + * @brief The message was too large for the transport. (for example a UDP message + * which exceeds size threshold,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MSG_TOO_BIG = -142, + + /* + * @brief Websocket protocol error. Indicates that we are terminating the connection + * due to a malformed frame or other protocol violation. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WS_PROTOCOL_ERROR = -145, + + /* + * @brief Returned when attempting to bind an address that is already in use. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADDRESS_IN_USE = -147, + + /* + * @brief An operation failed because the SSL handshake has not completed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_HANDSHAKE_NOT_COMPLETED = -148, + + /* + * @brief SSL peer's public key is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_BAD_PEER_PUBLIC_KEY = -149, + + /* + * @brief The certificate didn't match the built-in public key pins for the host name. + * The pins are set in net/http/transport_security_state.cc and require that + * one of a set of public keys exist on the path from the leaf to the root. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN = -150, + + /* + * @brief Server request for client certificate did not contain any types we support. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CLIENT_AUTH_CERT_TYPE_UNSUPPORTED = -151, + + /* + * @brief An SSL peer sent us a fatal decrypt_error alert. This typically occurs when + * a peer could not correctly verify a signature (in CertificateVerify or + * ServerKeyExchange, or validate a Finished message. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_DECRYPT_ERROR_ALERT = -153, + + /* + * @brief There are too many pending WebSocketJob instances, so the new job was not + * pushed to the queue. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WS_THROTTLE_QUEUE_TOO_LARGE = -154, + + /* + * @brief The SSL server certificate changed in a renegotiation. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_SERVER_CERT_CHANGED = -156, + + /* + * @brief The SSL server sent us a fatal unrecognized_name alert. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_UNRECOGNIZED_NAME_ALERT = -159, + + /* + * @brief Failed to set the socket's receive buffer size as requested. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_SET_RECEIVE_BUFFER_SIZE_ERROR = -160, + + /* + * @brief Failed to set the socket's send buffer size as requested. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_SET_SEND_BUFFER_SIZE_ERROR = -161, + + /* + * @brief Failed to set the socket's receive buffer size as requested, despite success + * return code from setsockopt. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_RECEIVE_BUFFER_SIZE_UNCHANGEABLE = -162, + + /* + * @brief Failed to set the socket's send buffer size as requested, despite success + * return code from setsockopt. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SOCKET_SEND_BUFFER_SIZE_UNCHANGEABLE = -163, + + /* + * @brief Failed to import a client certificate from the platform store into the SSL + * library. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_CERT_BAD_FORMAT = -164, + + /* + * @brief Resolving a hostname to an IP address list included the IPv4 address + * "127.0.53.53". This is a special IP address which ICANN has recommended to + * indicate there was a name collision, and alert admins to a potential + * problem. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ICANN_NAME_COLLISION = -166, + + /* + * @brief The SSL server presented a certificate which could not be decoded. This is + * not a certificate error code as no X509Certificate object is available. This + * error is fatal. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_SERVER_CERT_BAD_FORMAT = -167, + + /* + * @brief Certificate Transparency: Received a signed tree head that failed to parse. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CT_STH_PARSING_FAILED = -168, + + /* + * @brief Certificate Transparency: Received a signed tree head whose JSON parsing was + * OK but was missing some of the fields. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CT_STH_INCOMPLETE = -169, + + /* + * @brief The attempt to reuse a connection to send proxy auth credentials failed + * before the AuthController was used to generate credentials. The caller should + * reuse the controller with a new connection. This error is only used + * internally by the network stack. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNABLE_TO_REUSE_CONNECTION_FOR_PROXY_AUTH = -170, + + /* + * @brief Certificate Transparency: Failed to parse the received consistency proof. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CT_CONSISTENCY_PROOF_PARSING_FAILED = -171, + + /* + * @brief The SSL server required an unsupported cipher suite that has since been + * removed. This error will temporarily be signaled on a fallback for one or two + * releases immediately following a cipher suite's removal, after which the + * fallback will be removed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_OBSOLETE_CIPHER = -172, + + /* + * @brief When a WebSocket handshake is done successfully and the connection has been + * upgraded, the URLRequest is cancelled with this error code. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WS_UPGRADE = -173, + + /* + * @brief Socket ReadIfReady support is not implemented. This error should not be user + * visible, because the normal Read(, method is used as a fallback. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_READ_IF_READY_NOT_IMPLEMENTED = -174, + + /* + * @brief No socket buffer space is available. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_BUFFER_SPACE = -176, + + /* + * @brief There were no common signature algorithms between our client certificate + * private key and the server's preferences. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_CLIENT_AUTH_NO_COMMON_ALGORITHMS = -177, + + /* + * @brief TLS 1.3 early data was rejected by the server. This will be received before + * any data is returned from the socket. The request should be retried with + * early data disabled. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_EARLY_DATA_REJECTED = -178, + + /* + * @brief TLS 1.3 early data was offered, but the server responded with TLS 1.2 or + * earlier. This is an internal error code to account for a + * backwards-compatibility issue with early data and TLS 1.2. It will be + * received before any data is returned from the socket. The request should be + * retried with early data disabled. + * See https://tools.ietf.org/html/rfc8446#appendix-D.3 for details. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_WRONG_VERSION_ON_EARLY_DATA = -179, + + /* + * @brief TLS 1.3 was enabled, but a lower version was negotiated and the server + * returned a value indicating it supported TLS 1.3. This is part of a security + * check in TLS 1.3, but it may also indicate the user is behind a buggy + * TLS-terminating proxy which implemented TLS 1.2 incorrectly. (See + * rhttps://crbug.com/boringssl/226., + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TLS13_DOWNGRADE_DETECTED = -180, + + /* + * @brief The server's certificate has a keyUsage extension incompatible with the + * negotiated TLS key exchange method. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_KEY_USAGE_INCOMPATIBLE = -181, + + /* + * @brief The ECHConfigList fetched over DNS cannot be parsed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_ECH_CONFIG_LIST = -182, + + /* + * @brief ECH was enabled, but the server was unable to decrypt the encrypted + * ClientHello. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ECH_NOT_NEGOTIATED = -183, + + /* + * @brief ECH was enabled, the server was unable to decrypt the encrypted ClientHello, + * and additionally did not present a certificate valid for the public name. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ECH_FALLBACK_CERTIFICATE_INVALID = -184, + + /* + * @brief The server responded with a certificate whose common name did not match + * the host name. This could mean: + * 1. An attacker has redirected our traffic to their server and is + * presenting a certificate for which they know the private key. + * 2. The server is misconfigured and responding with the wrong cert. + * 3. The user is on a wireless network and is being redirected to the + * network's login page. + * 4. The OS has used a DNS search suffix and the server doesn't have + * a certificate for the abbreviated name in the address bar. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_COMMON_NAME_INVALID = -200, + + /* + * @brief The server responded with a certificate that, by our clock, appears to + * either not yet be valid or to have expired. This could mean: + * 1. An attacker is presenting an old certificate for which they have + * managed to obtain the private key. + * 2. The server is misconfigured and is not presenting a valid cert. + * 3. Our clock is wrong. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_DATE_INVALID = -201, + + /* + * @brief The server responded with a certificate that is signed by an authority + * we don't trust. The could mean: + * 1. An attacker has substituted the real certificate for a cert that + * contains their public key and is signed by their cousin. + * 2. The server operator has a legitimate certificate from a CA we don't + * know about, but should trust. + * 3. The server is presenting a self-signed certificate, providing no + * defense against active attackers (but foiling passive attackers,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_AUTHORITY_INVALID = -202, + + /* + * @brief The server responded with a certificate that contains errors. + * This error is not recoverable. + * MSDN describes this error as follows: + * "The SSL certificate contains errors." + * NOTE: It's unclear how this differs from ERR_CERT_INVALID. For consistency, + * use that code instead of this one from now on. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_CONTAINS_ERRORS = -203, + + /* + * @brief The certificate has no mechanism for determining if it is revoked. In + * effect, this certificate cannot be revoked. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_NO_REVOCATION_MECHANISM = -204, + + /* + * @brief Revocation information for the security certificate for this site is not + * available. This could mean: + * 1. An attacker has compromised the private key in the certificate and is + * blocking our attempt to find out that the cert was revoked. + * 2. The certificate is unrevoked, but the revocation server is busy or + * unavailable. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205, + + /* + * @brief The server responded with a certificate has been revoked. + * We have the capability to ignore this error, but it is probably not the + * thing to do. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_REVOKED = -206, + + /* + * @brief The server responded with a certificate that is invalid. + * This error is not recoverable. + * MSDN describes this error as follows: + * "The SSL certificate is invalid." + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_INVALID = -207, + + /* + * @brief The server responded with a certificate that is signed using a weak + * signature algorithm. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_WEAK_SIGNATURE_ALGORITHM = -208, + + /* + * @brief The host name specified in the certificate is not unique. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_NON_UNIQUE_NAME = -210, + + /* + * @brief The server responded with a certificate that contains a weak key (e.g. + * a too-small RSA key,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_WEAK_KEY = -211, + + /* + * @brief The certificate claimed DNS names that are in violation of name constraints. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_NAME_CONSTRAINT_VIOLATION = -212, + + /* + * @brief The certificate's validity period is too long. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_VALIDITY_TOO_LONG = -213, + + /* + * @brief Certificate Transparency was required for this connection, but the server + * did not provide CT information that complied with the policy. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERTIFICATE_TRANSPARENCY_REQUIRED = -214, + + /* + * @brief The certificate chained to a legacy Symantec root that is no longer trusted. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_SYMANTEC_LEGACY = -215, + + /* + * @brief The certificate is known to be used for interception by an entity other + * the device owner. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_KNOWN_INTERCEPTION_BLOCKED = -217, + + /* + * @brief The connection uses an obsolete version of SSL/TLS or cipher. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SSL_OBSOLETE_VERSION_OR_CIPHER = -218, + + /* + * @brief The value immediately past the last certificate error code. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_END = -219, + + /* + * @brief The URL is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_URL = -300, + + /* + * @brief The scheme of the URL is disallowed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DISALLOWED_URL_SCHEME = -301, + + /* + * @brief The scheme of the URL is unknown. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNKNOWN_URL_SCHEME = -302, + + /* + * @brief Attempting to load an URL resulted in a redirect to an invalid URL. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_REDIRECT = -303, + + /* + * @brief Attempting to load an URL resulted in too many redirects. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TOO_MANY_REDIRECTS = -310, + + /* + * @brief Attempting to load an URL resulted in an unsafe redirect (e.g., a redirect + * to file:// is considered unsafe,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNSAFE_REDIRECT = -311, + + /* + * @brief Attempting to load an URL with an unsafe port number. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNSAFE_PORT = -312, + + /* + * @brief The server's response was invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_RESPONSE = -320, + + /* + * @brief Error in chunked transfer encoding. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_CHUNKED_ENCODING = -321, + + /* + * @brief The server did not support the request method. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_METHOD_UNSUPPORTED = -322, + + /* + * @brief The response was 407 (Proxy Authentication Required,, yet we did not send + * the request to a proxy. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNEXPECTED_PROXY_AUTH = -323, + + /* + * @brief The server closed the connection without sending any data. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_EMPTY_RESPONSE = -324, + + /* + * @brief The headers section of the response is too large. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_TOO_BIG = -325, + + /* + * @brief The evaluation of the PAC script failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PAC_SCRIPT_FAILED = -327, + + /* + * @brief The response was 416 (Requested range not satisfiable, and the server cannot + * satisfy the range requested. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_REQUEST_RANGE_NOT_SATISFIABLE = -328, + + /* + * @brief The identity used for authentication is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MALFORMED_IDENTITY = -329, + + /* + * @brief Content decoding of the response body failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTENT_DECODING_FAILED = -330, + + /* + * @brief An operation could not be completed because all network IO + * is suspended. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NETWORK_IO_SUSPENDED = -331, + + /* + * @brief FLIP data received without receiving a SYN_REPLY on the stream. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SYN_REPLY_NOT_RECEIVED = -332, + + /* + * @brief Converting the response to target encoding failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ENCODING_CONVERSION_FAILED = -333, + + /* + * @brief The server sent an FTP directory listing in a format we do not understand. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT = -334, + + /* + * @brief There are no supported proxies in the provided list. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_SUPPORTED_PROXIES = -336, + + /* + * @brief There is an HTTP/2 protocol error. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PROTOCOL_ERROR = -337, + + /* + * @brief Credentials could not be established during HTTP Authentication. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_AUTH_CREDENTIALS = -338, + + /* + * @brief An HTTP Authentication scheme was tried which is not supported on this + * machine. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNSUPPORTED_AUTH_SCHEME = -339, + + /* + * @brief Detecting the encoding of the response failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ENCODING_DETECTION_FAILED = -340, + + /* + * @brief (GSSAPI, No Kerberos credentials were available during HTTP Authentication. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MISSING_AUTH_CREDENTIALS = -341, + + /* + * @brief An unexpected, but documented, SSPI or GSSAPI status code was returned. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNEXPECTED_SECURITY_LIBRARY_STATUS = -342, + + /* + * @brief The environment was not set up correctly for authentication (for + * example, no KDC could be found or the principal is unknown. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_MISCONFIGURED_AUTH_ENVIRONMENT = -343, + + /* + * @brief An undocumented SSPI or GSSAPI status code was returned. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_UNDOCUMENTED_SECURITY_LIBRARY_STATUS = -344, + + /* + * @brief The HTTP response was too big to drain. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_BODY_TOO_BIG_TO_DRAIN = -345, + + /* + * @brief The HTTP response contained multiple distinct Content-Length headers. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH = -346, + + /* + * @brief HTTP/2 headers have been received, but not all of them - status or version + * headers are missing, so we're expecting additional frames to complete them. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INCOMPLETE_HTTP2_HEADERS = -347, + + /* + * @brief No PAC URL configuration could be retrieved from DHCP. This can indicate + * either a failure to retrieve the DHCP configuration, or that there was no + * PAC URL configured in DHCP. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PAC_NOT_IN_DHCP = -348, + + /* + * @brief The HTTP response contained multiple Content-Disposition headers. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION = -349, + + /* + * @brief The HTTP response contained multiple Location headers. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION = -350, + + /* + * @brief HTTP/2 server refused the request without processing, and sent either a + * GOAWAY frame with error code NO_ERROR and Last-Stream-ID lower than the + * stream id corresponding to the request indicating that this request has not + * been processed yet, or a RST_STREAM frame with error code REFUSED_STREAM. + * Client MAY retry (on a different connection,. See RFC7540 Section 8.1.4. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_SERVER_REFUSED_STREAM = -351, + + /* + * @brief HTTP/2 server didn't respond to the PING message. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PING_FAILED = -352, + + /* + * @brief The HTTP response body transferred fewer bytes than were advertised by the + * Content-Length header when the connection is closed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTENT_LENGTH_MISMATCH = -354, + + /* + * @brief The HTTP response body is transferred with Chunked-Encoding, but the + * terminating zero-length chunk was never sent when the connection is closed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INCOMPLETE_CHUNKED_ENCODING = -355, + + /* + * @brief There is a QUIC protocol error. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_PROTOCOL_ERROR = -356, + + /* + * @brief The HTTP headers were truncated by an EOF. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_RESPONSE_HEADERS_TRUNCATED = -357, + + /* + * @brief The QUIC crypto handshake failed. This means that the server was unable + * to read any requests sent, so they may be resent. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_HANDSHAKE_FAILED = -358, + + /* + * @brief Transport security is inadequate for the HTTP/2 version. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY = -360, + + /* + * @brief The peer violated HTTP/2 flow control. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_FLOW_CONTROL_ERROR = -361, + + /* + * @brief The peer sent an improperly sized HTTP/2 frame. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_FRAME_SIZE_ERROR = -362, + + /* + * @brief Decoding or encoding of compressed HTTP/2 headers failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_COMPRESSION_ERROR = -363, + + /* + * @brief Proxy Auth Requested without a valid Client Socket Handle. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_AUTH_REQUESTED_WITH_NO_CONNECTION = -364, + + /* + * @brief HTTP_1_1_REQUIRED error code received on HTTP/2 session. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP_1_1_REQUIRED = -365, + + /* + * @brief HTTP_1_1_REQUIRED error code received on HTTP/2 session to proxy. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PROXY_HTTP_1_1_REQUIRED = -366, + + /* + * @brief The PAC script terminated fatally and must be reloaded. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PAC_SCRIPT_TERMINATED = -367, + + /* + * @brief The server was expected to return an HTTP/1.x response, but did not. Rather + * than treat it as HTTP/0.9, this error is returned. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_HTTP_RESPONSE = -370, + + /* + * @brief Initializing content decoding failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CONTENT_DECODING_INIT_FAILED = -371, + + /* + * @brief Received HTTP/2 RST_STREAM frame with NO_ERROR error code. This error should + * be handled internally by HTTP/2 code, and should not make it above the + * SpdyStream layer. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_RST_STREAM_NO_ERROR_RECEIVED = -372, + + /* + * @brief The pushed stream claimed by the request is no longer available. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PUSHED_STREAM_NOT_AVAILABLE = -373, + + /* + * @brief A pushed stream was claimed and later reset by the server. When this happens, + * the request should be retried. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_CLAIMED_PUSHED_STREAM_RESET_BY_SERVER = -374, + + /* + * @brief An HTTP transaction was retried too many times due for authentication or + * invalid certificates. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TOO_MANY_RETRIES = -375, + + /* + * @brief Received an HTTP/2 frame on a closed stream. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_STREAM_CLOSED = -376, + + /* + * @brief Client is refusing an HTTP/2 stream. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_CLIENT_REFUSED_STREAM = -377, + + /* + * @brief A pushed HTTP/2 stream was claimed by a request based on matching URL and + * request headers, but the pushed response headers do not match the request. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP2_PUSHED_RESPONSE_DOES_NOT_MATCH = -378, + + /* + * @brief The server returned a non-2xx HTTP response code. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_HTTP_RESPONSE_CODE_FAILURE = -379, + + /* + * @brief The certificate presented on a QUIC connection does not chain to a known root + * and the origin connected to is not on a list of domains where unknown roots + * are allowed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_UNKNOWN_CERT_ROOT = -380, + + /* + * @brief A GOAWAY frame has been received indicating that the request has not been + * processed and is therefore safe to retry on a different connection. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_QUIC_GOAWAY_REQUEST_CAN_BE_RETRIED = -381, + + /* + * @brief The ACCEPT_CH restart has been triggered too many times. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TOO_MANY_ACCEPT_CH_RESTARTS = -382, + + /* + * @brief The IP address space of the remote endpoint differed from the previous + * observed value during the same request. Any cache entry for the affected + * request should be invalidated. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INCONSISTENT_IP_ADDRESS_SPACE = -383, + + /* + * @brief The IP address space of the cached remote endpoint is blocked by local + * network access check. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHED_IP_ADDRESS_SPACE_BLOCKED_BY_LOCAL_NETWORK_ACCESS_POLICY = -384, + + /* + * @brief The cache does not have the requested entry. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_MISS = -400, + + /* + * @brief Unable to read from the disk cache. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_READ_FAILURE = -401, + + /* + * @brief Unable to write to the disk cache. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_WRITE_FAILURE = -402, + + /* + * @brief The operation is not supported for this entry. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_OPERATION_UNSUPPORTED = -403, + + /* + * @brief The disk cache is unable to open this entry. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_OPEN_FAILURE = -404, + + /* + * @brief The disk cache is unable to create this entry. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_CREATE_FAILURE = -405, + + /* + * @brief Multiple transactions are racing to create disk cache entries. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_RACE = -406, + + /* + * @brief The cache was unable to read a checksum record on an entry. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_CHECKSUM_READ_FAILURE = -407, + + /* + * @brief The cache found an entry with an invalid checksum. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_CHECKSUM_MISMATCH = -408, + + /* + * @brief Internal error code for the HTTP cache. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_LOCK_TIMEOUT = -409, + + /* + * @brief Received a challenge after the transaction has read some data, and the + * credentials aren't available. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_AUTH_FAILURE_AFTER_READ = -410, + + /* + * @brief Internal not-quite error code for the HTTP cache. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_ENTRY_NOT_SUITABLE = -411, + + /* + * @brief The disk cache is unable to doom this entry. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_DOOM_FAILURE = -412, + + /* + * @brief The disk cache is unable to open or create this entry. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CACHE_OPEN_OR_CREATE_FAILURE = -413, + + /* + * @brief The server's response was insecure (e.g. there was a cert error,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INSECURE_RESPONSE = -501, + + /* + * @brief An attempt to import a client certificate failed, as the user's key + * database lacked a corresponding private key. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_NO_PRIVATE_KEY_FOR_CERT = -502, + + /* + * @brief An error adding a certificate to the OS certificate database. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_ADD_USER_CERT_FAILED = -503, + + /* + * @brief An error occurred while handling a signed exchange. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_SIGNED_EXCHANGE = -504, + + /* + * @brief An error occurred while handling a Web Bundle source. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_INVALID_WEB_BUNDLE = -505, + + /* + * @brief A Trust Tokens protocol operation-executing request failed for one of a + * number of reasons (precondition failure, internal error, bad response,. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TRUST_TOKEN_OPERATION_FAILED = -506, + + /* + * @brief When handling a Trust Tokens protocol operation-executing request, the system + * was able to execute the request's Trust Tokens operation without sending the + * request to its destination. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_TRUST_TOKEN_OPERATION_SUCCESS_WITHOUT_SENDING_REQUEST = -507, + + /* + * @brief A generic error for failed FTP control connection command. + * If possible, please use or add a more specific error code. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_FAILED = -601, + + /* + * @brief The server cannot fulfill the request at this point. This is a temporary error. + * FTP response code 421. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_SERVICE_UNAVAILABLE = -602, + + /* + * @brief The server has aborted the transfer. + * FTP response code 426. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_TRANSFER_ABORTED = -603, + + /* + * @brief The file is busy, or some other temporary error condition on opening the file. + * FTP response code 450. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_FILE_BUSY = -604, + + /* + * @brief Server rejected our command because of syntax errors. + * FTP response codes 500, 501. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_SYNTAX_ERROR = -605, + + /* + * @brief Server does not support the command we issued. + * FTP response codes 502, 504. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_COMMAND_UNSUPPORTED = -606, + + /* + * @brief Server rejected our command because we didn't issue the commands in right order. + * FTP response code 503. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_FTP_BAD_COMMAND_SEQUENCE = -607, + + /* + * @brief PKCS #12 import failed due to incorrect password. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_BAD_PASSWORD = -701, + + /* + * @brief PKCS #12 import failed due to other error. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_FAILED = -702, + + /* + * @brief CA import failed - not a CA cert. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_CA_CERT_NOT_CA = -703, + + /* + * @brief Import failed - certificate already exists in database. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_CERT_ALREADY_EXISTS = -704, + + /* + * @brief CA import failed due to some other error. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_CA_CERT_FAILED = -705, + + /* + * @brief Server certificate import failed due to some internal error. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_IMPORT_SERVER_CERT_FAILED = -706, + + /* + * @brief PKCS #12 import failed due to invalid MAC. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_INVALID_MAC = -707, + + /* + * @brief PKCS #12 import failed due to invalid/corrupt file. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_INVALID_FILE = -708, + + /* + * @brief PKCS #12 import failed due to unsupported features. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PKCS12_IMPORT_UNSUPPORTED = -709, + + /* + * @brief Key generation failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_KEY_GENERATION_FAILED = -710, + + /* + * @brief Failure to export private key. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_PRIVATE_KEY_EXPORT_FAILED = -712, + + /* + * @brief Self-signed certificate generation failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_SELF_SIGNED_CERT_GENERATION_FAILED = -713, + + /* + * @brief The certificate database changed in some way. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_DATABASE_CHANGED = -714, + + /* + * @brief The certificate verifier configuration changed in some way. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_CERT_VERIFIER_CHANGED = -716, + + /* + * @brief DNS resolver received a malformed response. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_MALFORMED_RESPONSE = -800, + + /* + * @brief DNS server requires TCP. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SERVER_REQUIRES_TCP = -801, + + /* + * @brief DNS server failed. This error is returned for all of the following + * error conditions: + * 1 - Format error - The name server was unable to interpret the query. + * 2 - Server failure - The name server was unable to process this query + * due to a problem with the name server. + * 4 - Not Implemented - The name server does not support the requested + * kind of query. + * 5 - Refused - The name server refuses to perform the specified + * operation for policy reasons. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SERVER_FAILED = -802, + + /* + * @brief DNS transaction timed out. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_TIMED_OUT = -803, + + /* + * @brief The entry was not found in cache or other local sources, for lookups where + * only local sources were queried. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_CACHE_MISS = -804, + + /* + * @brief Suffix search list rules prevent resolution of the given host name. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SEARCH_EMPTY = -805, + + /* + * @brief Failed to sort addresses according to RFC3484. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SORT_ERROR = -806, + + /* + * @brief Failed to resolve the hostname of a DNS-over-HTTPS server. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_SECURE_RESOLVER_HOSTNAME_RESOLUTION_FAILED = -808, + + /* + * @brief DNS identified the request as disallowed for insecure connection (http/ws,. + * Error should be handled as if an HTTP redirect was received to redirect to + * https or wss. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_NAME_HTTPS_ONLY = -809, + + /* + * @brief All DNS requests associated with this job have been cancelled. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_REQUEST_CANCELED = -810, + + /* + * @brief The hostname resolution of HTTPS record was expected to be resolved with + * alpn values of supported protocols, but did not. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_ERR_DNS_NO_MATCHING_SUPPORTED_ALPN = -811, +}; + +#endif // ARKWEB_NET_ERROR_LIST_H diff --git a/web/webview/interfaces/native/arkweb_scheme_handler.h b/web/webview/interfaces/native/arkweb_scheme_handler.h new file mode 100644 index 000000000..348909b5a --- /dev/null +++ b/web/webview/interfaces/native/arkweb_scheme_handler.h @@ -0,0 +1,856 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Web + * @{ + * + * @brief Provides APIs to intercept the request from ArkWeb. + * @since 12 + */ +/** + * @file arkweb_scheme_handler.h + * + * @brief Declares the APIs to intercept the request from ArkWeb. + * @library libohweb.so + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +#ifndef ARKWEB_SCHEME_HANDLER_H +#define ARKWEB_SCHEME_HANDLER_H + +#include "stdint.h" + +#include "arkweb_net_error_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * @brief Configuration information for custom schemes. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef enum ArkWeb_CustomSchemeOption { + OH_ARKWEB_SCHEME_OPTION_NONE = 0, + + /* + * @brief If ARKWEB_SCHEME_OPTION_STANDARD is set the scheme will be handled as a standard scheme. The standard + * schemes needs to comply with the URL normalization and parsing rules defined in Section 3.1 of RFC 1738, + * which can be found in the http://www.ietf.org/rfc/rfc1738.txt. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_STANDARD = 1 << 0, + + /* + * @brief If ARKWEB_SCHEME_OPTION_LOCAL is set, the same security rules as those applied to the "file" URL will be + * used to handle the scheme. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_LOCAL = 1 << 1, + + /* + * @brief If ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED is set, then the scheme can only be displayed from other content + * hosted using the same scheme. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED = 1 << 2, + + /* + * @brief If ARKWEB_SCHEME_OPTION_SECURE is set, the same security rules as those applied to the "https" URL will be + * used to handle the scheme. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_SECURE = 1 << 3, + + /* + * @brief If ARKWEB_SCHEME_OPTION_CORS_ENABLED is set, then the scheme can be sent CORS requests. In most case this + * value should be set when ARKWEB_SCHEME_OPTION_STANDARD is set. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_CORS_ENABLED = 1 << 4, + + /* + * @brief If ARKWEB_SCHEME_OPTION_CSP_BYPASSING is set, then this scheme can bypass Content Security Policy (CSP) + * checks. In most cases, this value should not be set when ARKWEB_SCHEME_OPTION_STANDARD is set. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_CSP_BYPASSING = 1 << 5, + + /* + * @brief If ARKWEB_SCHEME_OPTION_FETCH_ENABLED is set, then this scheme can perform FETCH API requests. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + ARKWEB_SCHEME_OPTION_FETCH_ENABLED = 1 << 6, +} ArkWeb_CustomSchemeOption; + +/* + * @brief This class is used to intercept requests for a specified scheme. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_SchemeHandler_ ArkWeb_SchemeHandler; + +/* + * @brief Used to intercept url requests. Response headers and body can be sent through ArkWeb_ResourceHandler. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_ResourceHandler_ ArkWeb_ResourceHandler; + +/* + * @brief The response of the intercepted request. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_Response_ ArkWeb_Response; + +/* + * @brief The info of the request. You can obtain the requested URL, method, post data, and other information through + * OH_ArkWeb_ResourceRequest. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_ResourceRequest_ ArkWeb_ResourceRequest; + +/* + * @brief The request headers of the request. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_RequestHeaderList_ ArkWeb_RequestHeaderList; + +/* + * @brief The post data of the request. Use OH_ArkWebPostDataStream_* interface to read the body. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef struct ArkWeb_PostDataStream_ ArkWeb_PostDataStream; + + +/* + * @brief Callback for handling the request. This will called on the IO thread. should not use resourceHandler in the + * function. + * @param schemeHandler The ArkWeb_SchemeHandler. + * @param resourceRequest Obtain request's information through this. + * @param resourceHandler The ArkWeb_ResourceHandler for the request. It should not be used if intercept is set to + * false. + * @param intercept If true will intercept the request, if false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_OnRequestStart)(const ArkWeb_SchemeHandler* schemeHandler, + ArkWeb_ResourceRequest* resourceRequest, + const ArkWeb_ResourceHandler* resourceHandler, + bool* intercept); + +/* + * @brief Callback when the request is completed. This will called on the IO thread. + * @param schemeHandler The ArkWeb_SchemeHandler. + * @param resourceRequest The ArkWeb_ResourceRequest. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_OnRequestStop)(const ArkWeb_SchemeHandler* schemeHandler, + const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief Callback when the read operation done. + * @param postDataStream The ArkWeb_PostDataStream. + * @param buffer The buffer to receive data. + * @param bytesRead Callback after OH_ArkWebPostDataStream_Read. bytesRead greater than 0 means that the buffer is + * filled with data of bytesRead size. Caller can read from the buffer, and if + * OH_ArkWebPostDataStream_IsEOF is false, caller can continue to read the remaining data. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_PostDataReadCallback)(const ArkWeb_PostDataStream* postDataStream, + uint8_t* buffer, + int bytesRead); + +/* + * @brief Callback when the init operation done. + * @param postDataStream The ArkWeb_PostDataStream. + * @param result ARKWEB_NET_OK on success otherwise refer to ARKWEB_NET_ERROR. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +typedef void (*ArkWeb_PostDataStreamInitCallback)(const ArkWeb_PostDataStream* postDataStream, ArkWeb_NetError result); + +/* + * @brief The request header list. + * @param requestHeaderList The created ArkWeb_RequestHeaderList. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebRequestHeaderList_Create(const ArkWeb_ResourceRequest* resourceRequest, + ArkWeb_RequestHeaderList** requestHeaderList); + +/* + * @brief Destroy the ArkWeb_RequestHeaderList. + * @param requestHeaderList The ArkWeb_RequestHeaderList to be destroyed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebRequestHeaderList_Destroy(ArkWeb_RequestHeaderList* requestHeaderList); + +/* + * @brief Get the request headers size. + * @param requestHeaderList The list of request header. + * @return The size of request headers. -1 if requestHeaderList is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebRequestHeaderList_GetSize(const ArkWeb_RequestHeaderList* requestHeaderList); + +/* + * @brief Get the specified request header. + * @param requestHeaderList The list of request header. + * @param index The index of request header. + * @param key The header key. Caller must release the string by OH_ArkWeb_ReleaseString. + * @param value The header value. Caller must release the string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebRequestHeaderList_GetHeader(const ArkWeb_RequestHeaderList* requestHeaderList, + int32_t index, + char** key, + char** value); + +/* + * @brief Set a user data to ArkWeb_ResourceRequest. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @param userData The user data to set. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceRequest_SetUserData(ArkWeb_ResourceRequest* resourceRequest, void* userData); + +/* + * @brief Get the user data from ArkWeb_ResourceRequest. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @return The set user data. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void* OH_ArkWebResourceRequest_GetUserData(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief Get the method of request. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @param method The request's http method. This function will allocate memory for the method string and caller must + * release the string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetMethod(const ArkWeb_ResourceRequest* resourceRequest, char** method); + +/* + * @brief Get the url of request. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @param url The request's url. This function will allocate memory for the url string and caller must release the + * string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetUrl(const ArkWeb_ResourceRequest* resourceRequest, char** url); + +/* + * @brief Create a ArkWeb_PostDataStream which used to read the post data. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @param postDataStream The request's post data. This function will allocate memory for the post data stream and + * caller must release the postDataStream by OH_ArkWebResourceRequest_DestroyPostData. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetPostData(const ArkWeb_ResourceRequest* resourceRequest, + ArkWeb_PostDataStream** postDataStream); + +/* + * @brief Destroy the post data stream. + * @param postDataStream The postDataStream to be destroyed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_DestroyPostData(ArkWeb_PostDataStream* postDataStream); + +/* + * @brief Set a user data to ArkWeb_PostDataStream. + * @param postDataStream The ArkWeb_PostDataStream. + * @param userData The user data to set. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebPostDataStream_SetUserData(ArkWeb_PostDataStream* postDataStream, void* userData); + +/* + * @brief Get the user data from ArkWeb_PostDataStream. + * @param postDataStream The ArkWeb_PostDataStream. + * @return The set user data. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void* OH_ArkWebPostDataStream_GetUserData(const ArkWeb_PostDataStream* postDataStream); + +/* + * @brief Set the callback for OH_ArkWebPostDataStream_Read, the result of OH_ArkWebPostDataStream_Read will be + * notified to caller through the readCallback. The callback will runs in the same thread as + * OH_ArkWebPostDataStream_Read. + * @param postDataStream The ArkWeb_PostDataStream. + * @param readCallback The callback of read function. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebPostDataStream_SetReadCallback(ArkWeb_PostDataStream* postDataStream, + ArkWeb_PostDataReadCallback readCallback); + +/* + * @brief Init the post data stream. This function must be called before calling any other functions. + * @param postDataStream The ArkWeb_PostDataStream. + * @param initCallback The callback of init. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebPostDataStream_Init(ArkWeb_PostDataStream* postDataStream, + ArkWeb_PostDataStreamInitCallback initCallback); + +/* + * @brief Read the post data to the buffer. The buffer must be larger than the bufLen. We will be reading data from a + * worker thread to the buffer, so should not use the buffer in other threads before the callback to avoid + * concurrency issues. + * @param postDataStream The ArkWeb_PostDataStream. + * @param buffer The buffer to receive data. + * @param bufLen The size of bytes to read. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebPostDataStream_Read(const ArkWeb_PostDataStream* postDataStream, uint8_t* buffer, int bufLen); + +/* + * @brief Get the total size of the data stream. When data is chunked, always return zero. + * @param postDataStream The ArkWeb_PostDataStream. + * @return The size of data stream. -1 if postDataStream is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +uint64_t OH_ArkWebPostDataStream_GetSize(const ArkWeb_PostDataStream* postDataStream); + +/* + * @brief Get the current position of the data stream. + * @param postDataStream The ArkWeb_PostDataStream. + * @return The current position of data stream. -1 if postDataStream is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +uint64_t OH_ArkWebPostDataStream_GetPosition(const ArkWeb_PostDataStream* postDataStream); + +/* + * @brief Get if the data stream is chunked. + * @param postDataStream The ArkWeb_PostDataStream. + * @return True if is chunked; false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebPostDataStream_IsChunked(const ArkWeb_PostDataStream* postDataStream); + + +/* + * @brief Returns true if all data has been consumed from this upload data stream. For chunked uploads, returns false + * until the first read attempt. + * @param postDataStream The ArkWeb_PostDataStream. + * @return True if all data has been consumed; false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebPostDataStream_IsEof(const ArkWeb_PostDataStream* postDataStream); + +/* + * @brief Returns true if the upload data in the stream is entirely in memory, and all read requests will succeed + * synchronously. Expected to return false for chunked requests. + * @param postDataStream The ArkWeb_PostDataStream. + * @return True if the upload data is in memory; false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebPostDataStream_IsInMemory(const ArkWeb_PostDataStream* postDataStream); + +/* + * @brief Get the referrer of request. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @param referrer The request's referrer. This function will allocate memory for the post data string and caller + * must release the string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetReferrer(const ArkWeb_ResourceRequest* resourceRequest, char** referrer); + +/* + * @brief Get the OH_ArkWeb_RequestHeaderList of the request. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @param requestHeaderList The RequestHeaderList of request. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResourceRequest_GetRequestHeaders(const ArkWeb_ResourceRequest* resourceRequest, + ArkWeb_RequestHeaderList** requestHeaderList); + +/* + * @brief Get if this is a redirect request. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @return True if this is a redirect; false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebResourceRequest_IsRedirect(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief Get if this is a request from main frame. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @return True if this is from main frame; false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebResourceRequest_IsMainFrame(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief Get if this is a request is triggered by user gesutre. + * @param resourceRequest The ArkWeb_ResourceRequest. + * @return True if this is triggered by user gesture; false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebResourceRequest_HasGesture(const ArkWeb_ResourceRequest* resourceRequest); + +/* + * @brief Register custom scheme to the ArkWeb. Should not be called for built-in HTTP, HTTPS, FILE, FTP, ABOUT and + * DATA schemes. This function should be called on main thread. + * @param scheme The scheme to regist. + * @param option The configuration of the scheme. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWeb_RegisterCustomSchemes(const char* scheme, int32_t option); + +/* + * @brief Set a ArkWeb_SchemeHandler for a specific scheme to intercept requests of that scheme type. + * @param scheme Scheme that need to be intercepted. + * @param schemeHandler The SchemeHandler for the scheme. Only requests triggered by ServiceWorker will be notified + * through this handler. + * @return Return true if set SchemeHandler for specific scheme successful, return false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWebServiceWorker_SetSchemeHandler(const char* scheme, ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief Set a ArkWeb_SchemeHandler for a specific scheme to intercept requests of that scheme type. + * @param scheme Scheme that need to be intercepted. + * @param webTag The name of the web component. + * @param schemeHandler The SchemeHandler for the scheme. Only requests triggered from the specified web will be + * notified through this handler. + * @return Return true if set SchemeHandler for specific scheme successful, return false otherwise. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +bool OH_ArkWeb_SetSchemeHandler(const char* scheme, const char* webTag, ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief Clear the handler registered on the specified web for service worker. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebServiceWorker_ClearSchemeHandlers(); + +/* + * @brief Clear the handler registered on the specified web. + * @param webTag The name of the web component. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWeb_ClearSchemeHandlers(const char* webTag); + +/* + * @brief Create a SchemeHandler. + * @param schemeHandler Return the created SchemeHandler. Use OH_ArkWeb_DestroySchemeHandler destroy it when donn't + * need it. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_CreateSchemeHandler(ArkWeb_SchemeHandler** schemeHandler); + +/* + * @brief Destroy a SchemeHandler. + * @param The ArkWeb_SchemeHandler to be destroy. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_DestroySchemeHandler(ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief Set a user data to ArkWeb_SchemeHandler. + * @param schemeHandler The ArkWeb_SchemeHandler. + * @param userData The user data to set. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebSchemeHandler_SetUserData(ArkWeb_SchemeHandler* schemeHandler, void* userData); + +/* + * @brief Get the user data from ArkWeb_SchemeHandler. + * @param schemeHandler The ArkWeb_SchemeHandler. + * @return The set user data. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void* OH_ArkWebSchemeHandler_GetUserData(const ArkWeb_SchemeHandler* schemeHandler); + +/* + * @brief Set the OnRequestStart callback for SchemeHandler. + * @param schemeHandler The SchemeHandler for the scheme. + * @param onRequestStart The OnRequestStart callback. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebSchemeHandler_SetOnRequestStart(ArkWeb_SchemeHandler* schemeHandler, + ArkWeb_OnRequestStart onRequestStart); + +/* + * @brief Set the OnRequestStop callback for SchemeHandler. + * @param schemeHandler The SchemeHandler for the scheme. + * @param onRequestStop The OnRequestStop callback. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebSchemeHandler_SetOnRequestStop(ArkWeb_SchemeHandler* schemeHandler, + ArkWeb_OnRequestStop onRequestStop); + +/* + * @brief Create a Response for a request. + * @param Return the created Response. Use OH_ArkWeb_DestroyResponse to destroy when donn't need it. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_CreateResponse(ArkWeb_Response** response); + +/* + * @brief Destroy the Reponse. + * @param response The Response needs destroy. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_DestroyResponse(ArkWeb_Response* response); + +/* + * @brief Set the resolved URL after redirects or changed as a result of HSTS. + * @param response The ArkWeb_Response. + * @param url The resolved URL. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetUrl(ArkWeb_Response* response, const char* url); + +/* + * @brief Get the resolved URL after redirects or changed as a result of HSTS. + * @param response The ArkWeb_Response. + * @param url The resolved URL. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetUrl(const ArkWeb_Response* response, char** url); + +/* + * @brief Set a error code to ArkWeb_Response. + * @param response The ArkWeb_Response. + * @param errorCode The error code for the failed request. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetError(ArkWeb_Response* response, ArkWeb_NetError errorCode); + +/* + * @brief Get the response's error code. + * @param response The ArkWeb_Response. + * @return The response's error code. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +ArkWeb_NetError OH_ArkWebResponse_GetError(const ArkWeb_Response* response); + +/* + * @brief Set a status code to ArkWebResponse. + * @param response The ArkWeb_Response. + * @param status The http status code for the request. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetStatus(ArkWeb_Response* response, int status); + +/* + * @brief Get the response's status code. + * @param response The ArkWeb_Response. + * @return The response's http status code. -1 if response is invalid. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int OH_ArkWebResponse_GetStatus(const ArkWeb_Response* response); + +/* + * @brief Set a status text to ArkWebResponse. + * @param response The ArkWeb_Response. + * @param statusText The status text for the request. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetStatusText(ArkWeb_Response* response, const char* statusText); + +/* + * @brief Get the response's status text. + * @param response The ArkWeb_Response. + * @param statusText Return the response's statusText. This function will allocate memory for the statusText string and + * caller must release the string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetStatusText(const ArkWeb_Response* response, char** statusText); + +/* + * @brief Set mime type to ArkWebResponse. + * @param response The ArkWeb_Response. + * @param mimeType The mime type for the request. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetMimeType(ArkWeb_Response* response, const char* mimeType); + +/* + * @brief Get the response's mime type. + * @param response The ArkWeb_Response. + * @param mimeType Return the response's mime type. This function will allocate memory for the mime type string and + * caller must release the string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetMimeType(const ArkWeb_Response* response, char** mimeType); + +/* + * @brief Set charset to ArkWeb_Response. + * @param response The ArkWeb_Response. + * @param charset The charset for the request. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetCharset(ArkWeb_Response* response, const char* charset); + +/* + * @brief Get the response's charset. + * @param response The ArkWeb_Response. + * @param charset Return the response's charset. This function will allocate memory for the charset string and caller + * must release the string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetCharset(const ArkWeb_Response* response, char** charset); + +/* + * @brief Set a header to ArkWeb_Response. + * @param response The ArkWeb_Response. + * @param name The name of the header. + * @param value The value of the header. + * @bool overwirte If true will overwrite the exsits header, if false otherwise. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResponse_SetHeaderByName(ArkWeb_Response* response, + const char* name, + const char* value, + bool overwrite); + +/* + * @brief Get the header from the response. + * @param response The ArkWeb_Response. + * @param name The name of the header. + * @param value Return the header's value. This function will allocate memory for the value string and caller must + * release the string by OH_ArkWeb_ReleaseString. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWebResponse_GetHeaderByName(const ArkWeb_Response* response, const char* name, char** value); + +/* + * @brief Pass response headers to intercepted requests. + * @param resourceHandler The ArkWeb_ResourceHandler for the request. + * @param response The ArkWeb_Response for the intercepting requests. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidReceiveResponse(const ArkWeb_ResourceHandler* resourceHandler, + const ArkWeb_Response* response); + +/* + * @brief Pass response body data to intercepted requests. + * @param resourceHandler The ArkWeb_ResourceHandler for the request. + * @param buffer Buffer data to send. + * @param bufLen The size of buffer. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidReceiveData(const ArkWeb_ResourceHandler* resourceHandler, + const uint8_t* buffer, + int64_t bufLen); + +/* + * @brief Notify the ArkWeb that this request should be finished and there is no more data available. + * @param resourceHandler The ArkWeb_ResourceHandler for the request. + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidFinish(const ArkWeb_ResourceHandler* resourceHandler); + +/* + * @brief Notify the ArkWeb that this request should be failed. + * @param resourceHandler The ArkWeb_ResourceHandler for the request. + * @param errorCode The error code for this request. refer to arkweb_net_error_list.h + * @return 0 if success; otherwise if fail. refer to arkweb_net_error_list.h. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +int32_t OH_ArkWebResourceHandler_DidFailWithError(const ArkWeb_ResourceHandler* resourceHandler, + ArkWeb_NetError errorCode); + +/* + * @brief Release the string acquired by native function. + * @param string The string to be released. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_ReleaseString(char* string); + +/* + * @brief Release the byte array acquired by native function. + * @param byteArray The byte array to be released. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ +void OH_ArkWeb_ReleaseByteArray(uint8_t* byteArray); + + +#ifdef __cplusplus +}; +#endif +#endif // ARKWEB_SCHEME_HANDLER_H diff --git a/web/webview/interfaces/native/libohweb.ndk.json b/web/webview/interfaces/native/libohweb.ndk.json index a82e93cb6..7d99bc707 100644 --- a/web/webview/interfaces/native/libohweb.ndk.json +++ b/web/webview/interfaces/native/libohweb.ndk.json @@ -34,5 +34,285 @@ { "first_introduced": "11", "name": "OH_NativeArkWeb_GetWebInstanceByWebTag" + }, + { + "first_introduced": "12", + "name": "ArkWeb_SchemeHandler" + }, + { + "first_introduced": "12", + "name": "ArkWeb_ResourceHandler" + }, + { + "first_introduced": "12", + "name": "ArkWeb_Response" + }, + { + "first_introduced": "12", + "name": "ArkWeb_ResourceRequest" + }, + { + "first_introduced": "12", + "name": "ArkWeb_RequestHeaderList" + }, + { + "first_introduced": "12", + "name": "ArkWeb_RequestHeader" + }, + { + "first_introduced": "12", + "name": "ArkWeb_PostDataStream" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeaderList_Create" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeaderList_Destroy" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeaderList_GetSize" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeaderList_GetHeader" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeader_Create" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeader_Destroy" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeader_GetName" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebRequestHeader_GetValue" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_GetMethod" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_GetUrl" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_GetPostData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_SetReadCallback" + }, + { + "first_introduced": "12", + "name": "ArkWeb_PostDataStreamInitCallback" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_SetUserData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_GetUserData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_Init" + }, + { + "first_introduced": "12", + "name": "ArkWeb_PostDataReadCallback" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_Read" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_GetSize" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_GetPosition" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_IsChunked" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_IsEof" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebPostDataStream_IsInMemory" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_SetUserData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_GetUserData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_GetReferrer" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_GetRequestHeaders" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_IsRedirect" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_IsMainFrame" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceRequest_HasGesture" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_RegisterCustomSchemes" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_SetSchemeHandler" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebServiceWorker_SetSchemeHandler" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_ClearSchemeHandlers" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebServiceWorker_ClearSchemeHandlers" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_CreateSchemeHandler" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_DestroySchemeHandler" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebSchemeHandler_SetUserData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebSchemeHandler_GetUserData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebSchemeHandler_SetOnRequestStart" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebSchemeHandler_SetOnRequestStop" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_CreateResponse" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_DestroyResponse" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_SetUrl" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_GetUrl" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_SetError" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_GetError" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_SetStatus" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_GetStatus" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_SetStatusText" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_GetStatusText" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_SetMimeType" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_GetMimeType" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_SetCharset" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_GetCharset" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_SetHeaderByName" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResponse_GetHeaderByName" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceHandler_DidReceiveResponse" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceHandler_DidReceiveData" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceHandler_DidFinish" + }, + { + "first_introduced": "12", + "name": "OH_ArkWebResourceHandler_DidFailWithError" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_ReleaseString" + }, + { + "first_introduced": "12", + "name": "OH_ArkWeb_ReleaseByteArray" } -] \ No newline at end of file +]