示例#1
0
        public static object Parse(string s)
        {
            if (string.IsNullOrEmpty (s))
                return Color.White;

            Crow.Gradient tmp;

            string[] stops = s.Trim ().Split ('|');

            switch (stops[0].Trim()) {
            case "vgradient":
                tmp = new Gradient (Type.Vertical);
                break;
            case "hgradient":
                tmp = new Gradient (Type.Horizontal);
                break;
            case "ogradient":
                tmp = new Gradient (Type.Oblic);
                break;
            default:
                throw new Exception ("Unknown gradient type: " + stops [0]);
            }

            for (int i = 1; i < stops.Length; i++)
                tmp.Stops.Add((ColorStop)ColorStop.Parse(stops[i]));

            return tmp;
        }
示例#2
0
 public Gradient(Gradient.Type _type)
 {
     GradientType = _type;
 }