浏览代码

fix colors calculate error

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

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


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

}
public static HSVColor fromColor(Color color) {
float red = color.red / 0xFF;
float green = color.green / 0xFF;
float blue = color.blue / 0xFF;
float red = (float)color.red / 0xFF;
float green = (float)color.green / 0xFF;
float blue = (float)color.blue / 0xFF;
float alpha = color.alpha / 0xFF;
float alpha = (float)color.alpha / 0xFF;
float hue = painting_._getHue(red, green, blue, max, delta);
float saturation = max == 0.0f ? 0.0f : delta / max;

}
public static HSLColor fromColor(Color color) {
float red = color.red / 0xFF;
float green = color.green / 0xFF;
float blue = color.blue / 0xFF;
float red = (float)color.red / 0xFF;
float green = (float)color.green / 0xFF;
float blue = (float)color.blue / 0xFF;
float alpha = color.alpha / 0xFF;
float alpha = (float)color.alpha / 0xFF;
float saturation = lightness == 1.0f
float saturation = Math.Abs(lightness - 1.0f) < foundation_.precisionErrorTolerance
? 0.0f
: ((delta / (1.0f - Mathf.Abs(2.0f * lightness - 1.0f))).clamp(0.0f, 1.0f));
return HSLColor.fromAHSL(alpha, hue, saturation, lightness);

正在加载...
取消
保存