コード例 #1
0
        public static object Parse(string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return(null);
            }
            if (s.Substring(1).StartsWith("gradient"))
            {
                return((Gradient)Gradient.Parse(s));
            }
            if (s.EndsWith(".svg", true, System.Globalization.CultureInfo.InvariantCulture))
            {
                return(SvgPicture.Parse(s));
            }
            if (s.EndsWith(".png", true, System.Globalization.CultureInfo.InvariantCulture) ||
                s.EndsWith(".jpg", true, System.Globalization.CultureInfo.InvariantCulture) ||
                s.EndsWith(".jpeg", true, System.Globalization.CultureInfo.InvariantCulture) ||
                s.EndsWith(".bmp", true, System.Globalization.CultureInfo.InvariantCulture) ||
                s.EndsWith(".gif", true, System.Globalization.CultureInfo.InvariantCulture))
            {
                return(BmpPicture.Parse(s));
            }

            return((SolidColor)SolidColor.Parse(s));
        }
コード例 #2
0
        public void LoadImage(string path)
        {
            Picture pic;

            if (path.EndsWith(".svg", true, System.Globalization.CultureInfo.InvariantCulture))
            {
                pic = new SvgPicture(path);
            }
            else
            {
                pic = new BmpPicture(path);
            }

            pic.Load(IFace, path);
            pic.Scaled          = scaled;
            pic.KeepProportions = keepProps;

            Picture = pic;
        }
コード例 #3
0
ファイル: Picture.cs プロジェクト: jpbruyere/Crow
        public static object Parse(string path)
        {
            if (string.IsNullOrEmpty (path))
                return null;

            Picture _pic = null;

            if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
                _pic = new SvgPicture ();
            else
                _pic = new BmpPicture ();

            _pic.LoadImage (path);

            return _pic;
        }