diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn index 88c0459bc9fd316e2be057729c6e97d9081011e3..73dbebd12399e83ae12891b4fb2b7c3c7c3632b1 100644 --- a/graphic/graphic_2d/native_drawing/BUILD.gn +++ b/graphic/graphic_2d/native_drawing/BUILD.gn @@ -51,6 +51,7 @@ ohos_ndk_headers("native_drawing_header") { "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_blob.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_declaration.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_global.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_line.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_lineTypography.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_run.h", @@ -106,5 +107,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 0000000000000000000000000000000000000000..7a7493c9445b39e8ab696f87d49f98b25bda81e2 --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_text_global.h @@ -0,0 +1,76 @@ +/* + * 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 DRAWING_TEXT_GLOBAL_H +#define DRAWING_TEXT_GLOBAL_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 +} 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 // 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 def91bc0d0672966294bb12d94d1bb1aa20a9c3f..a9624eb22bfa0f4940727133f76a154d8f2640e5 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1801,5 +1801,9 @@ { "first_introduced": "20", "name": "OH_Drawing_SetTypographyTextAutoSpace" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_SetTextHighContrast" } ] \ No newline at end of file