Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color val delete #17021

Merged
merged 13 commits into from
May 24, 2024
Merged

Color val delete #17021

merged 13 commits into from
May 24, 2024

Conversation

minggo
Copy link
Contributor

@minggo minggo commented May 21, 2024

Re: #13229

Changelog

  • Remove Color._val, use r, g, b, a to record each value.

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Copy link

github-actions bot commented May 21, 2024

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -3274,9 +3274,9 @@
          * @zh
          * 改变描边的颜色。
          */
         get outlineColor(): math.Color;
-        set outlineColor(value: math.Color);
+        set outlineColor(value: Readonly<math.Color>);
         /**
          * @en
          * Change the outline width.
          *
@@ -3298,9 +3298,9 @@
          * @zh
          * 阴影的颜色。
          */
         get shadowColor(): math.Color;
-        set shadowColor(value: math.Color);
+        set shadowColor(value: Readonly<math.Color>);
         /**
          * @en
          * Offset between font and shadow.
          *
@@ -12287,9 +12287,9 @@
                 /**
                  * @zh 全局雾颜色
                  * @en Global fog color
                  */
-                set fogColor(val: math.Color);
+                set fogColor(val: Readonly<math.Color>);
                 get fogColor(): math.Color;
                 /**
                  * @zh 当前雾化类型。
                  * @en The current global fog type.
@@ -17170,17 +17170,13 @@
             set z(value: number);
             get w(): number;
             set w(value: number);
             /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _val: number;
-            /**
              * @en Construct a same color from the given color
              * @zh 构造与指定颜色相等的颜色。
              * @param other Specified color
              */
-            constructor(other: Color);
+            constructor(other: Readonly<Color>);
             /**
              * @en Construct a color form the hex color string
              * @zh 用十六进制颜色字符串中构造颜色。
              * @param hexString Hexadecimal color string.
@@ -17203,20 +17199,20 @@
             /**
              * @en Check whether the current color is identical with the given color
              * @zh 判断当前颜色是否与指定颜色相等。
              * @param other Specified color
-             * @returns Returns `true` when all channels of both colours are equal; otherwise returns `false`.
+             * @returns Returns `true` when all channels of both colors are equal; otherwise returns `false`.
              */
-            equals(other: Color): boolean;
+            equals(other: Readonly<Color>): boolean;
             /**
              * @en Calculate linear interpolation result between this color and another one with given ratio。
              * @zh 根据指定的插值比率,从当前颜色到目标颜色之间做插值。
              * @param to Target color
              * @param ratio The interpolation coefficient.The range is [0,1].
              */
-            lerp(to: Color, ratio: number): Color;
+            lerp(to: Readonly<Color>, ratio: number): Color;
             /**
-             * @en Convert to string with color informations
+             * @en Convert to string with color information.
              * @zh 返回当前颜色的字符串表示。
              * @returns A string representation of the current color.
              */
             toString(): string;
@@ -17252,9 +17248,10 @@
             /**
              * @en convert Color to HEX color string.
              * @zh 转换当前颜色为十六进制颜色字符串。
              * @param fmt "#rrggbb" or "#rrggbbaa".
-             * - `'#rrggbbaa'` obtains the hexadecimal value of the Red, Green, Blue, Alpha channels (**two**, high complement 0) and connects them sequentially.
+             * - `'#rrggbbaa'` obtains the hexadecimal value of the Red, Green, Blue,
+             *   Alpha channels (**two**, high complement 0) and connects them sequentially.
              * - `'#rrggbb'` is similar to `'#rrggbbaa'` but does not include the Alpha channel.
              * @returns the Hex color string
              * @example
              * ```
@@ -17316,32 +17313,16 @@
              * @param [b=0] blue component of the color
              * @param [a=255] alpha component of the color
              * @returns Current color.
              */
-            set(other: Color): Color;
+            set(other: Readonly<Color>): Color;
             set(r?: number, g?: number, b?: number, a?: number): Color;
             /**
              * @en Multiplies the current color by the specified color.
              * @zh 将当前颜色乘以与指定颜色
              * @param other The specified color.
              */
             multiply(other: Color): Color;
-            /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _set_r_unsafe(red: number): Color;
-            /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _set_g_unsafe(green: number): Color;
-            /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _set_b_unsafe(blue: number): Color;
-            /**
-             * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
-             */
-            _set_a_unsafe(alpha: number): Color;
         }
         export function color(other: Color | string): Color;
         export function color(r?: number, g?: number, b?: number, a?: number): Color;
         /**
@@ -17526,9 +17507,8 @@
             r: number;
             g: number;
             b: number;
             a: number;
-            _val: number;
         }
         export interface IMat3Like {
             m00: number;
             m01: number;

Copy link

@minggo, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
ios PASS PASS FAIL motion-streak
mac PASS PASS PASS

Copy link

@minggo, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS PASS
windows PASS PASS FAIL capture_to_web,cameraUseRenderTex,use-render-texture-asset
android PASS PASS PASS

Copy link

@minggo, Please check the result of run test cases:

Task Details

Copy link

@minggo, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS PASS
windows PASS PASS FAIL capture_to_web,cameraUseRenderTex,use-render-texture-asset
android PASS PASS PASS

cocos/core/math/color.ts Outdated Show resolved Hide resolved
cocos/core/math/color.ts Outdated Show resolved Hide resolved
Copy link

@minggo, Please check the result of run test cases:

Task Details

Copy link

@minggo, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS PASS
windows PASS PASS FAIL capture_to_web,cameraUseRenderTex,use-render-texture-asset
android PASS PASS PASS

@minggo minggo merged commit bc6c2d4 into cocos:v3.8.5 May 24, 2024
8 of 9 checks passed
@minggo minggo deleted the Color-val-delete branch May 24, 2024 02:18
Copy link

@minggo ❗ There was an error during the execution of the tasks. Please check the logs for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants