From 8f4835a18a92572fc294dd47cc068cfb2bff8728 Mon Sep 17 00:00:00 2001 From: xuhangqi Date: Tue, 22 Jul 2025 20:34:56 +0800 Subject: [PATCH] Refactor overload Issue: https://gitee.com/openharmony/interface_sdk-js/issues/ICO3T8 Signed-off-by: xuhangqi Change-Id: Idc6d8a86170e4f7f019fe64cfa1dbb1ceda8302a --- api/@ohos.graphics.drawing.d.ts | 176 ++++++++++++++++++++++++++++---- 1 file changed, 155 insertions(+), 21 deletions(-) diff --git a/api/@ohos.graphics.drawing.d.ts b/api/@ohos.graphics.drawing.d.ts index 23c93603de..ea429402e2 100644 --- a/api/@ohos.graphics.drawing.d.ts +++ b/api/@ohos.graphics.drawing.d.ts @@ -650,20 +650,43 @@ declare namespace drawing { /** * Constructs a path. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(); + /** + * Constructs a path. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithNoArgs(); + /** * Constructs a copy of an existing path. * @param { Path } path - Path to copy. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(path: Path); + /** + * Constructs a copy of an existing path. + * @param { Path } path - Path to copy. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithPath(path: Path); + + /** + * @since 20 + * @arkts 1.2 + */ + overload constructor { ctorWithNoArgs, ctorWithPath }; + /** * Sets the Path with the same content of another. * @param { Path } src - the path to copy content from. @@ -1724,20 +1747,46 @@ declare namespace drawing { /** * Creates a SamplingOptions object. The default value of FilterMode is FILTER_MODE_NEAREST. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(); + + /** + * Creates a SamplingOptions object. The default value of FilterMode is FILTER_MODE_NEAREST. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithNoArgs(); + /** * Creates a SamplingOptions object. * @param { FilterMode } filterMode - Storage filter mode. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(filterMode: FilterMode); + + /** + * Creates a SamplingOptions object. + * @param { FilterMode } filterMode - Storage filter mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithFilterMode(filterMode: FilterMode); + + /** + * @since 20 + * @arkts 1.2 + */ + overload constructor { ctorWithNoArgs, ctorWithFilterMode }; } /** @@ -4757,13 +4806,26 @@ declare namespace drawing { * @syscap SystemCapability.Graphics.Drawing * @crossplatform * @since 20 - * @arkts 1.1&1.2 */ static createBlendModeColorFilter(color: common2D.Color, mode: BlendMode): ColorFilter; /** * Creates a ColorFilter object with a given color and blend mode. - * @param { common2D.Color | int } color - Color, represented by an unsigned integer in hexadecimal ARGB format. + * @param { common2D.Color } color - Color in ARGB format. The value of each color channel is an integer ranging from 0 to 255. + * @param { BlendMode } mode - Blend mode. + * @returns { ColorFilter } Colorfilter object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + static createBlendModeColorFilterWithColorBlendMode(color: common2D.Color, mode: BlendMode): ColorFilter; + + /** + * Creates a ColorFilter object with a given color and blend mode. + * @param { common2D.Color | number } color - Color, represented by an unsigned integer in hexadecimal ARGB format. * @param { BlendMode } mode - Blend mode. * @returns { ColorFilter } Colorfilter object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; @@ -4774,7 +4836,7 @@ declare namespace drawing { */ /** * Creates a ColorFilter object with a given color and blend mode. - * @param { common2D.Color | int } color - Color, represented by an unsigned integer in hexadecimal ARGB format. + * @param { common2D.Color | number } color - Color, represented by an unsigned integer in hexadecimal ARGB format. * @param { BlendMode } mode - Blend mode. * @returns { ColorFilter } Colorfilter object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; @@ -4783,9 +4845,31 @@ declare namespace drawing { * @syscap SystemCapability.Graphics.Drawing * @crossplatform * @since 20 - * @arkts 1.1&1.2 */ - static createBlendModeColorFilter(color: common2D.Color | int, mode: BlendMode): ColorFilter; + static createBlendModeColorFilter(color: common2D.Color | number, mode: BlendMode): ColorFilter; + + /** + * Creates a ColorFilter object with a given color and blend mode. + * @param { common2D.Color | int } color - Color, represented by an unsigned integer in hexadecimal ARGB format. + * @param { BlendMode } mode - Blend mode. + * @returns { ColorFilter } Colorfilter object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + static createBlendModeColorFilterWithColorOrNumberBlendMode(color: common2D.Color | int, mode: BlendMode): ColorFilter; + + /** + * @since 20 + * @arkts 1.2 + */ + static overload createBlendModeColorFilter { + createBlendModeColorFilterWithColorBlendMode, + createBlendModeColorFilterWithColorOrNumberBlendMode + }; /** * Creates a ColorFilter object by combining another two color filters. @@ -5091,22 +5175,47 @@ declare namespace drawing { /** * A constructor used to create a Pen object. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(); + /** + * A constructor used to create a Pen object. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithNoArgs(); + /** * Copies a Pen object to create a new one. * @param { Pen } pen - Pen object to copy. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(pen: Pen); + /** + * Copies a Pen object to create a new one. + * @param { Pen } pen - Pen object to copy. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithPen(pen: Pen); + + /** + * @since 20 + * @arkts 1.2 + */ + overload constructor { ctorWithNoArgs, ctorWithPen }; + /** * Sets the maximum ratio allowed between the sharp corner length of a polyline and its line width. * When drawing a polyline with the pen, if JoinStyle is set to MITER_JOIN and this maximum ratio is exceeded, @@ -5531,22 +5640,47 @@ declare namespace drawing { /** * A constructor used to create a Brush object. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(); + /** + * A constructor used to create a Brush object. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithNoArgs(); + /** * Copies a Brush object to create a new one. * @param { Brush } brush - Indicates the Brush object. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; *
2. Incorrect parameter types. * @syscap SystemCapability.Graphics.Drawing - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * */ constructor(brush: Brush); + /** + * Copies a Brush object to create a new one. + * @param { Brush } brush - Indicates the Brush object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 20 + * @arkts 1.2 + */ + constructor ctorWithBrush(brush: Brush); + + /** + * @since 20 + * @arkts 1.2 + */ + overload constructor { ctorWithNoArgs, ctorWithBrush }; + /** * Sets a color for this brush. * @param { common2D.Color } color - Color in ARGB format. -- Gitee