From 361b8936a7bfd3d147a96d1549ba836892c8c42f Mon Sep 17 00:00:00 2001 From: eager1 Date: Tue, 13 May 2025 11:41:17 +0800 Subject: [PATCH] Color Inverter Signed-off-by: eager1 Change-Id: Ie001c6f82db9011be4fb406e83a6add9e26a2321 --- arkui/ace_engine/native/libace.ndk.json | 4 ++++ arkui/ace_engine/native/native_node.h | 23 +++++++++++++++++++++++ arkui/ace_engine/native/native_type.h | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/arkui/ace_engine/native/libace.ndk.json b/arkui/ace_engine/native/libace.ndk.json index 3b7a8c0af..2f74b718f 100644 --- a/arkui/ace_engine/native/libace.ndk.json +++ b/arkui/ace_engine/native/libace.ndk.json @@ -3334,5 +3334,9 @@ { "first_introduced": "20", "name": "OH_ArkUI_EmbeddedComponentOption_SetOnTerminated" + }, + { + "first_introduced": "20", + "name": "OH_ArkUI_SetForceDarkConfig" } ] \ No newline at end of file diff --git a/arkui/ace_engine/native/native_node.h b/arkui/ace_engine/native/native_node.h index f3d238f72..b1f72c18b 100644 --- a/arkui/ace_engine/native/native_node.h +++ b/arkui/ace_engine/native/native_node.h @@ -143,6 +143,11 @@ typedef enum { * @since 20 */ ARKUI_NODE_EMBEDDED_COMPONENT, + /** + * Undefined. + * @since 20 + */ + ARKUI_NODE_UNDEFINED = 999, } ArkUI_NodeType; /** @@ -9281,6 +9286,24 @@ int32_t OH_ArkUI_GetNodeSnapshot(ArkUI_NodeHandle node, ArkUI_SnapshotOptions* s */ int32_t OH_ArkUI_NodeUtils_GetPositionToParent(ArkUI_NodeHandle node, ArkUI_IntOffset* globalOffset); +/** + * @brief Sets the inverse color algorithm for components and instances. + * + * @param uiContext Indicates the context in which the inverse color feature should take effect. If the value is null, + * the feature applies to the entire application process. + * @param forceDark Indicates whether the inverse color feature is enabled. + * @param nodeType Indicates the component type for which to enable the inverse color feature. If the value is null, + * enabling the feature for all components. + * @param colorInvertFunc Indicates the user-defined inverse color algorithm. + * @return Returns the error code. + * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. + * Returns {@link ERROR_CODE_CAPI_INIT_ERROR} if CAPI init error. + Returns {@link ARKUI_ERROR_CODE_FORCE_DARK_CONFIG_INVALID} if force dark config is invalid. + * @since 20 + */ +int32_t OH_ArkUI_SetForceDarkConfig(ArkUI_ContextHandle uiContext, bool forceDark, ArkUI_NodeType nodeType, + uint32_t (*colorInvertFunc)(uint32_t color)); + #ifdef __cplusplus }; #endif diff --git a/arkui/ace_engine/native/native_type.h b/arkui/ace_engine/native/native_type.h index adb29c35f..9ab9a2f57 100644 --- a/arkui/ace_engine/native/native_type.h +++ b/arkui/ace_engine/native/native_type.h @@ -2202,6 +2202,11 @@ typedef enum { * @since 15 */ ARKUI_ERROR_CODE_NODE_NOT_ON_MAIN_TREE = 106203, + /** + * @error Force dark config is invalid. + * @since 20 + */ + ARKUI_ERROR_CODE_FORCE_DARK_CONFIG_INVALID = 106204, /** * @error The node requesting focus is not focusable. * @since 15 -- Gitee