Exemplo n.º 1
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            float r = (float)x;
            float g = (float)Saturation.GetValue(x, y);
            float b = (float)Lightness.GetValue(x, y);

            HsvRgb.ToRgb(ref r, ref g, ref b);

            return(new UnityEngine.Color(r, g, b, 1f));
        }
Exemplo n.º 2
0
    void UpdateHSLBoxes()
    {
        disableBoxChange = true;

        hueBox.Text        = Hue.ToString();
        saturationBox.Text = Saturation.ToString();
        lightnessBox.Text  = Lightness.ToString();

        disableBoxChange = false;
    }
Exemplo n.º 3
0
        public void allow_to_convert_from_Hsl_to_Rgb()
        {
            var colour24BitFromRgb = Colour.FromRgb(
                Intensity.FromScalar(255),
                Intensity.FromScalar(0),
                Intensity.FromScalar(0));
            var colour24BitFromHsl = Colour.FromHsl(
                Hue.FromScalar(0),
                Saturation.FromScalar(100),
                Lightness.FromScalar(50));

            colour24BitFromRgb.Should().Be(colour24BitFromHsl);
        }
Exemplo n.º 4
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hash = 37;

                hash = hash * 53 + Hue.GetHashCode();
                hash = hash * 53 + Saturation.GetHashCode();
                hash = hash * 53 + Lightness.GetHashCode();
                hash = hash * 53 + Alpha;

                return(hash);
            }
        }
Exemplo n.º 5
0
 public override string ToString()
 {
     return(Hue.ToString("0.00").PadLeft(6) + ", " + Saturation.ToString("0.0000") + ", " + Lightness.ToString("0.0000") + ", " + Lrv.ToString("0.00") + ": " + Name + " (" + Brand.GetDescription() + " " + string.Join(", ", ColorNumbers.Select(x => x.Number)) + ")");
 }