From 4c6cbfecb82b58a68a27e635f64a0ddbccfb731f Mon Sep 17 00:00:00 2001 From: mobHot Date: Mon, 5 May 2025 17:01:43 +0800 Subject: [PATCH] add the support for updating color and decoration Signed-off-by: mobHot Change-Id: Ie307fb95d17080cfb864ead948e9d70bcd6a1de4 --- .../native_drawing/drawing_text_typography.h | 48 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 16 +++++++ 2 files changed, 64 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 9052c1697..597d00598 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -2612,6 +2612,54 @@ int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography* typ */ void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography* typography, size_t from, size_t to, float fontSize); +/** + * @brief Update the font color of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param color Indicates the color to update. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateFontColor(OH_Drawing_Typography* typography, uint32_t color); + +/** + * @brief Update the decoration of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param decoration Indicates the text decoration to update. For details, see the enum + * OH_Drawing_TextDecoration. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateDecoration(OH_Drawing_Typography* typography, OH_Drawing_TextDecoration decoration); + +/** + * @brief Update the decoration thickness scale of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param decorationThicknessScale Indicates the thickness scale of the text decoration to update. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateDecorationThicknessScale(OH_Drawing_Typography* typography, + double decorationThicknessScale); + +/** + * @brief Update the decoration style of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param decorationStyle Indicates the text decoration style to update. + * For details, see the enum OH_Drawing_TextDecorationStyle. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateDecorationStyle(OH_Drawing_Typography* typography, + OH_Drawing_TextDecorationStyle decorationStyle); + /** * @brief Get whether the text layout enables line styles. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 208814b74..da5139fcb 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1522,6 +1522,22 @@ "first_introduced": "12", "name": "OH_Drawing_TypographyUpdateFontSize" }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateFontColor" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateDecoration" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateDecorationThicknessScale" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateDecorationStyle" + }, { "first_introduced": "12", "name": "OH_Drawing_TypographyTextGetLineStyle" -- Gitee