From 8fd679fba7cd2f6fcc791321da7590d6786706ff Mon Sep 17 00:00:00 2001 From: mobHot Date: Thu, 13 Mar 2025 14:36:25 +0800 Subject: [PATCH 1/2] add the interface of high constract mode Signed-off-by: mobHot Change-Id: I645d227ba1875e08f8ae8cbc1d7830d134d423f4 --- graphic/graphic_2d/native_drawing/BUILD.gn | 1 + .../native_drawing/drawing_text_global.h | 77 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 + 3 files changed, 82 insertions(+) create mode 100644 graphic/graphic_2d/native_drawing/drawing_text_global.h diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn index 88c0459bc..27dbdba97 100644 --- a/graphic/graphic_2d/native_drawing/BUILD.gn +++ b/graphic/graphic_2d/native_drawing/BUILD.gn @@ -106,5 +106,6 @@ ohos_ndk_library("libnative_drawing_ndk") { "native_drawing/drawing_text_typography.h", "native_drawing/drawing_typeface.h", "native_drawing/drawing_types.h", + "native_drawing/drawing_text_global.h", ] } diff --git a/graphic/graphic_2d/native_drawing/drawing_text_global.h b/graphic/graphic_2d/native_drawing/drawing_text_global.h new file mode 100644 index 000000000..c040c66b7 --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_text_global.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2025 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 Drawing + * @{ + * + * @brief Provides the global text capability. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 20 + * @version 1.0 + */ + +/** + * @file drawing_text_global.h + * + * @brief Declares functions related to run in the drawing module. + * + * @kit ArkGraphics2D + * @library libnative_drawing.so + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 20 + * @version 1.0 + */ + +#ifndef C_INCLUDE_DRAWING_TEXT_GLOBAL_H +#define C_INCLUDE_DRAWING_TEXT_GLOBAL_H + +#include "drawing_text_declaration.h" +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines text rendering high contrast mode to enhance readability. + * @since 20 + * @version 1.0 + */ +typedef enum { + /** Follow system's high contrast settings for text rendering */ + TEXT_FOLLOW_SYSTEM_HIGH_CONTRAST, + /** Disable high contrast rendering regardless of system settings */ + TEXT_APP_DISABLE_HIGH_CONTRAST, + /** Enable high contrast rendering regardless of system settings */ + TEXT_APP_ENABLE_HIGH_CONTRAST, + TEXT_HIGH_CONTRAST_BUTT +} OH_Drawing_TextHighContrast; + +/** + * @brief Sets high contrast mode of text rendering. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param action OH_Drawing_TextHighContrast object. + * @since 20 + */ +void OH_Drawing_SetTextHighContrast(OH_Drawing_TextHighContrast action); +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // C_INCLUDE_DRAWING_TEXT_GLOBAL_H \ No newline at end of file diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index e13687d42..91bdff126 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1793,5 +1793,9 @@ { "first_introduced": "18", "name": "OH_Drawing_CanvasDrawPixelMapNine" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_SetTextHighContrast" } ] \ No newline at end of file -- Gitee From 1ddf263a449740c8efa8466e3579a3af4eab9e10 Mon Sep 17 00:00:00 2001 From: mobHot Date: Fri, 14 Mar 2025 01:32:00 +0000 Subject: [PATCH 2/2] update graphic/graphic_2d/native_drawing/drawing_text_global.h. Signed-off-by: mobHot Change-Id: I2074aa2ac41c9bc333f53a93952ca5fa8668f51c --- .../graphic_2d/native_drawing/drawing_text_global.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_global.h b/graphic/graphic_2d/native_drawing/drawing_text_global.h index c040c66b7..e708cd34d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_global.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_global.h @@ -37,8 +37,8 @@ * @version 1.0 */ -#ifndef C_INCLUDE_DRAWING_TEXT_GLOBAL_H -#define C_INCLUDE_DRAWING_TEXT_GLOBAL_H +#ifndef DRAWING_TEXT_GLOBAL_H +#define DRAWING_TEXT_GLOBAL_H #include "drawing_text_declaration.h" #include "drawing_types.h" @@ -56,10 +56,9 @@ typedef enum { /** Follow system's high contrast settings for text rendering */ TEXT_FOLLOW_SYSTEM_HIGH_CONTRAST, /** Disable high contrast rendering regardless of system settings */ - TEXT_APP_DISABLE_HIGH_CONTRAST, + TEXT_APP_DISABLE_HIGH_CONTRAST, /** Enable high contrast rendering regardless of system settings */ - TEXT_APP_ENABLE_HIGH_CONTRAST, - TEXT_HIGH_CONTRAST_BUTT + TEXT_APP_ENABLE_HIGH_CONTRAST } OH_Drawing_TextHighContrast; /** @@ -74,4 +73,4 @@ void OH_Drawing_SetTextHighContrast(OH_Drawing_TextHighContrast action); } #endif /** @} */ -#endif // C_INCLUDE_DRAWING_TEXT_GLOBAL_H \ No newline at end of file +#endif // DRAWING_TEXT_GLOBAL_H \ No newline at end of file -- Gitee