浏览代码

refine code

/main
guanghuispark 3 年前
当前提交
011d4053
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 8
      com.unity.uiwidgets/Runtime/painting/colors.cs

8
com.unity.uiwidgets/Runtime/painting/colors.cs


if (max == 0.0f || delta == 0.0f) {
hue = 0.0f;
}
else if (Math.Abs(max - red) < foundation_.precisionErrorTolerance) {
else if (foundation_.FloatEqual(max,red)) {
else if (Math.Abs(max - green) < foundation_.precisionErrorTolerance) {
else if (foundation_.FloatEqual(max,green)) {
else if (Math.Abs(max - blue) < foundation_.precisionErrorTolerance) {
else if (foundation_.FloatEqual(max,blue)) {
hue = 60.0f * (((red - green) / delta) + 4);
}

float alpha = (float)color.alpha / 0xFF;
float hue = painting_._getHue(red, green, blue, max, delta);
float lightness = (max + min) / 2.0f;
float saturation = Math.Abs(lightness - 1.0f) < foundation_.precisionErrorTolerance
float saturation = foundation_.FloatEqual(lightness, 1.0f)
? 0.0f
: ((delta / (1.0f - Mathf.Abs(2.0f * lightness - 1.0f))).clamp(0.0f, 1.0f));
return HSLColor.fromAHSL(alpha, hue, saturation, lightness);

正在加载...
取消
保存