cocos-engine
cocos-engine copied to clipboard
Add srgb transform.
Re: #
Changelog
- Add srgb transform for Class Color.
Continuous Integration
This pull request:
- [ ] needs automatic test cases check.
Manual trigger with
@cocos-robot run test casesafterward. - [ ] 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.
Interface Check Report
! WARNING this pull request has changed these public interfaces:
@@ -11817,8 +11817,29 @@
* @zh 设置颜色值
*/
static set<Out extends IColorLike>(out: Out, r: number, g: number, b: number, a: number): Out;
/**
+ * @en Convert 8bit color to Vec4
+ * @zh 将当前颜色转换为到 Vec4
+ * @returns Vec4 as float color value
+ * @example
+ * ```
+ * const color = Color.YELLOW;
+ * color.toVec4();
+ * ```
+ */
+ static toVec4(color: Color, out?: Vec4): Vec4;
+ /**
+ * @en Set 8bit Color from Vec4
+ * @zh 使用 Vec4 设置 8 bit 颜色
+ * @returns 8 Bit srgb value
+ * @example
+ * ```
+ * color.fromVec4(new Vec4(1,1,1,1));
+ * ```
+ */
+ static fromVec4(value: Vec4, out?: Color): Color;
+ /**
* @en Converts the hexadecimal formal color into rgb formal and save the results to out color.
* @zh 从十六进制颜色字符串中读入颜色到 out 中
*/
static fromHEX<Out extends IColorLike>(out: Out, hexString: string): Out;