From c248065e73d3f8622bb8f84dee00bcc82985aa19 Mon Sep 17 00:00:00 2001 From: lixiang Date: Tue, 8 Jul 2025 22:35:29 +0800 Subject: [PATCH] Sync 0328branch to 0702 branch Signed-off-by: lixiang Signed-off-by: lixiang --- api/@ohos.graphics.uiEffect.d.ts | 228 +++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) diff --git a/api/@ohos.graphics.uiEffect.d.ts b/api/@ohos.graphics.uiEffect.d.ts index daa434171b..9ebba8ff37 100644 --- a/api/@ohos.graphics.uiEffect.d.ts +++ b/api/@ohos.graphics.uiEffect.d.ts @@ -108,6 +108,120 @@ declare namespace uiEffect { * @arkts 1.1&1.2 */ distort(distortionK: number): Filter; + + /** + * Adds the content radius gradient blurring effect for the current component. The input parameter is the blurring radius. + * + * @param { number } value - the blurring radius. + * The larger the blurring radius, the more blurring the content, and if the value is 0, the content blurring effect is not blurring. + * @param { LinearGradientBlurOptions } options - the radius gradient blur options. + * @returns { Filter } - Returns radius gradient blur Filter. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 19 + */ + radiusGradientBlur(value: number, options: LinearGradientBlurOptions): Filter; + + /** + * Sets the deformation effect controlled by bezier curves of the component. + * + * @param { Array } controlPoints - The bezier control points, 12 points needed. + * @returns { Filter } - Returns the Filter that the current effect have been added. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + bezierWarp(controlPoints: Array): Filter; + + /** + * Sets the content light filter. + * + * @param { common2D.Point3d } lightPosition + * @param { common2D.Color } lightColor + * @param { number } lightIntensity + * @param { Mask } [displacementMap] + * @returns { Filter } - Returns the Filter that the current effect have been added. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + contentLight(lightPosition: common2D.Point3d, lightColor: common2D.Color, lightIntensity: number, + displacementMap?: Mask): Filter; + + /** + * Sets the color gradient filter, may blend with alpha mask. + * + * @param { Array } colors + * @param { Array } positions + * @param { Array } strengths + * @param { Mask } [alphaMask] + * @returns { Filter } - Returns the Filter that the current effect have been added. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + colorGradient(colors: Array, positions: Array, strengths: Array, + alphaMask?: Mask): Filter; + + /** + * Detects and glows edges of contents. + * + * @param { number } alpha + * @param { Color } [color] + * @param { Mask } [mask] + * @param { boolean } [bloom] + * @returns { Filter } - Returns the Filter that the current effect have been added. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + edgeLight(alpha: number, color?: Color, mask?: Mask, bloom?: boolean): Filter; + + /** + * Sets distort effect with displacement map. + * + * @param { Mask } displacementMap + * @param { [number, number] } [factor] + * @returns { Filter } - Returns the Filter that the current effect have been added. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + displacementDistort(displacementMap: Mask, factor?: [number, number]): Filter; + + /** + * Sets dispersion effect with mask map. + * + * @param { Mask } dispersionMap + * @param { number } alpha + * @param { [number, number] } [rFactor] + * @param { [number, number] } [gFactor] + * @param { [number, number] } [bFactor] + * @returns { Filter } - Returns the Filter that the current effect have been added. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + maskDispersion(dispersionMap: Mask, alpha: number, rFactor?: [number, number], gFactor?: [number, number], + bFactor?: [number, number]): Filter; + + /** + * Applies a high dynamic range (HDR) brightness enhancement filter to the component. + * @param { number } ratio - The brightness multiplier ratio (1.0 = original, >1.0 = brighter). + * @returns { Filter } - Returns hdr brightness Filter. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + hdrBrightnessRatio(ratio: number): Filter; } /** @@ -261,6 +375,22 @@ declare namespace uiEffect { * @arkts 1.1&1.2 */ backgroundColorBlender(blender: BrightnessBlender): VisualEffect; + + /** + * Sets the border light effect. + * + * @param { common2D.Point3d } lightPosition + * @param { common2D.Color } lightColor + * @param { number } lightIntensity + * @param { number } borderWidth + * @returns { VisualEffect } - Returns the VisualEffect that the current effect have been added. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + borderLight(lightPosition: common2D.Point3d, lightColor: common2D.Color, lightIntensity: number, + borderWidth: number): VisualEffect; } /** @@ -371,6 +501,104 @@ declare namespace uiEffect { fraction: number; } + /** + * The Color of Light. + * @typedef Color + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + interface Color { + /** + * Red component of color. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + red: number; + /** + * Green component of color. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + green: number; + /** + * Blue component of color + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + blue: number; + /** + * Alpha component of color. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + alpha: number; + } + + /** + * Defines the mask for Filter or VisualEffect. + * @typedef { Mask } + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + class Mask { + /** + * Create a Mask of ripple. + * @param { common2D.Point } center + * @param { number } radius + * @param { number } width + * @param { number } [offset] + * @returns { Mask } + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + static createRippleMask(center: common2D.Point, radius: number, width: number, offset?: number): Mask; + + /** + * Create a Mask of pixelmap. + * @param { image.PixelMap } pixelMap + * @param { common2D.Rect } srcRect + * @param { common2D.Rect } dstRect + * @param { Color } [fillColor] + * @returns { Mask } + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + static createPixelMapMask(pixelMap: image.PixelMap, srcRect: common2D.Rect, dstRect: common2D.Rect, + fillColor?: Color): Mask; + + /** + * Create a Mask of radial gradient. + * @param { common2D.Point } center + * @param { number } radiusX + * @param { number } radiusY + * @param { Array<[number, number]> } values + * @returns { Mask } + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @systemapi + * @since 20 + */ + static createRadialGradientMask(center: common2D.Point, radiusX: number, radiusY: number, + values: Array<[number, number]>): Mask; + } + /** * Create a Filter to add multiple effects to the component. * @returns { Filter } Returns the head node of Filter. -- Gitee