Make sure the hue returned by Color.RgbToHsv is positive.
This commit is contained in:
@@ -151,6 +151,11 @@ namespace OpenRA.Primitives
|
|||||||
hue = (r - g) / (6 * delta) + 2 / 3f;
|
hue = (r - g) / (6 * delta) + 2 / 3f;
|
||||||
|
|
||||||
var h = hue - (int)hue;
|
var h = hue - (int)hue;
|
||||||
|
|
||||||
|
// Wrap negative values into [0-1)
|
||||||
|
if (h < 0)
|
||||||
|
h += 1;
|
||||||
|
|
||||||
var s = delta / rgbMax;
|
var s = delta / rgbMax;
|
||||||
return (h, s, v);
|
return (h, s, v);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user