Exemple #1
0
        public static global::color.Color colorToRgb(global::color.Color color)
        {
            unchecked {
                switch (color._hx_index)
                {
                case 0:
                {
                    double _g  = (color as global::color.Color_Rgb).b;
                    double _g1 = (color as global::color.Color_Rgb).g;
                    double _g2 = (color as global::color.Color_Rgb).r;
                    return(color);
                }


                case 1:
                {
                    double v = (color as global::color.Color_Hsv).v;
                    double s = (color as global::color.Color_Hsv).s;
                    double h = (color as global::color.Color_Hsv).h;
                    return(global::color.Convert.hsvToRgb(h, s, v));
                }


                case 2:
                {
                    string name = (color as global::color.Color_Named).name;
                    return((global::color.Color)((((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(global::color.Convert.namedColors))))))).@get(name)).@value));
                }
                }

                return(null);
            }
        }
Exemple #2
0
        public static global::color.Color hsvToRgb(double h, double s, double v)
        {
            unchecked {
                double c  = (s * v);
                double h1 = (h * 6);
                double x  = (c * ((1 - global::System.Math.Abs(((double)(((h1 % 2) - 1)))))));
                global::color.Color rgb1 = (((h1 < 1)) ? (global::color.Color.Rgb(c, x, ((double)(0)))) : ((((h1 < 2)) ? (global::color.Color.Rgb(x, c, ((double)(0)))) : ((((h1 < 3)) ? (global::color.Color.Rgb(((double)(0)), c, x)) : ((((h1 < 4)) ? (global::color.Color.Rgb(((double)(0)), x, c)) : ((((h1 < 5)) ? (global::color.Color.Rgb(x, ((double)(0)), c)) : (global::color.Color.Rgb(c, ((double)(0)), x)))))))))));
                double m = (v - c);
                global::color.Color rgb = null;
                if ((rgb1._hx_index == 0))
                {
                    double b = (rgb1 as global::color.Color_Rgb).b;
                    double g = (rgb1 as global::color.Color_Rgb).g;
                    double r = (rgb1 as global::color.Color_Rgb).r;
                    rgb = global::color.Color.Rgb((r + m), (g + m), (b + m));
                }
                else
                {
                    throw ((global::System.Exception)(global::haxe.Exception.thrown("no match")));
                }

                return(rgb);
            }
        }