示例#1
0
        public static Color FromHsv(double _hue, double _saturation, double _value)
        {
            double c = _value * _saturation;
            double h = Meth.RMod(_hue, 1) * 6;
            double x = c * (1 - Meth.Abs(h % 2 - 1));

            double r = 0, g = 0, b = 0;

            if (0 <= h && h < 1)
            {
                r = c;
                g = x;
            }
            else if (1 <= h && h < 2)
            {
                r = x;
                g = c;
            }
            else if (2 <= h && h < 3)
            {
                g = c;
                b = x;
            }
            else if (3 <= h && h < 4)
            {
                g = x;
                b = c;
            }
            else if (4 <= h && h < 5)
            {
                b = c;
                r = x;
            }
            else if (5 <= h && h < 6)
            {
                b = x;
                r = c;
            }

            double m = _value - c;

            return(new Color((byte)((r + m) * 255), (byte)((g + m) * 255), (byte)((b + m) * 255)));
        }
示例#2
0
 public static Point operator %(Point _one, Point _two) => new Point(Meth.RMod(_one.X, _two.X), Meth.RMod(_one.Y, _two.Y));
示例#3
0
 public static Vector operator %(Vector _one, Vector _two) => new Vector(Meth.RMod(_one.X, _two.X), Meth.RMod(_one.Y, _two.Y));