From 104e839bd9ed3e76ef226a87e56d673db0d58741 Mon Sep 17 00:00:00 2001 From: wangxiuxiu96 Date: Fri, 23 May 2025 16:34:34 +0800 Subject: [PATCH] shader Signed-off-by: wangxiuxiu96 Change-Id: Ib0f759983b7a20886ac2f36988be97ea3b3fde4f --- api/@internal/component/ets/symbolglyph.d.ts | 11 ++ api/@internal/component/ets/text.d.ts | 12 ++ api/@internal/component/ets/text_common.d.ts | 117 +++++++++++++++++++ 3 files changed, 140 insertions(+) diff --git a/api/@internal/component/ets/symbolglyph.d.ts b/api/@internal/component/ets/symbolglyph.d.ts index d7083269b0..3d9edfd394 100644 --- a/api/@internal/component/ets/symbolglyph.d.ts +++ b/api/@internal/component/ets/symbolglyph.d.ts @@ -1003,6 +1003,17 @@ declare class SymbolGlyphAttribute extends CommonMethod { */ fontColor(value: Array): SymbolGlyphAttribute; + /** + * Set the shader style of the symbol, such as lineargradient or radialgradient. + * + * @param { Array } shaders - The shaders style of the symbol. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 20 + */ + shaderStyle(shaders: Array): SymbolGlyphAttribute; + /** * Called when the font symbolGlyph weight is set. * diff --git a/api/@internal/component/ets/text.d.ts b/api/@internal/component/ets/text.d.ts index 0cc9ed3ffa..35118fcaae 100644 --- a/api/@internal/component/ets/text.d.ts +++ b/api/@internal/component/ets/text.d.ts @@ -1338,6 +1338,18 @@ declare class TextAttribute extends CommonMethod { */ selectedBackgroundColor(color: ResourceColor): TextAttribute; + /** + * Set the shader style of the text, such as lineargradient or radialgradient. + * + * @param { ShaderStyle } shader - The shader style of the text. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + shaderStyle(shader: ShaderStyle): TextAttribute; + /** * Set the ellipsis mode. * diff --git a/api/@internal/component/ets/text_common.d.ts b/api/@internal/component/ets/text_common.d.ts index 510666ba8a..07a37f7dd3 100644 --- a/api/@internal/component/ets/text_common.d.ts +++ b/api/@internal/component/ets/text_common.d.ts @@ -1464,6 +1464,123 @@ declare enum KeyboardAppearance { DARK_IMMERSIVE = 3, } +/** + * Defines shader style class. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +declare class ShaderStyle { +} + +/** + * Defines linear gradient class. + * + * @extends ShaderStyle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +declare class LinearGradientStyle extends ShaderStyle { + /** + * The constructor. + * + * @param { LinearGradientOptions } options - The options of the gradient. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + constructor(options: LinearGradientOptions); + + /** + * The options of the gradient. + * angle: Angle of linear gradient. + * direction: Direction of Linear Gradient. + * colors: Color description for gradients. + * repeating: if the gradient colors with repeated coloring. + * + * @type { LinearGradientOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + options: LinearGradientOptions; +} + +/** + * Defines radial gradient class. + * + * @extends ShaderStyle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +declare class RadialGradientStyle extends ShaderStyle { + /** + * The constructor. + * + * @param { RadialGradientOptions } options - The options of the gradient. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + constructor(options: RadialGradientOptions); + + /** + * The options of the gradient. + * center: Center point of radial gradient + * radius: Radius of Radial Gradient. value range [0, +∞) + * colors: Color description for gradients + * repeating: Refill. The default value is false + * + * @type { RadialGradientOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + options: RadialGradientOptions; +} + +/** + * Defines a shader with single color. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ +declare class ColorShaderStyle extends ShaderStyle { + /** + * The constructor. + * + * @param { ResourceColor } color - The color used by shader. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + constructor(color: ResourceColor); + + /** + * The color of the shader. + * + * @type { RadialGradientOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 20 + */ + color: ResourceColor; +} + /** * Defines the line spacing options. * @interface LineSpacingOptions -- Gitee