Exemplo n.º 1
0
        public static ISvgBrush Parsing(string text, SvgDocument doc)
        {
            while (text.Trim().EndsWith(";"))
            {
                text = text.Substring(0, text.Length - 1);
            }
            if (text.Trim().StartsWith("url"))
            {
                int     num1  = text.Trim().IndexOf("#", 0, text.Trim().Length);
                int     num2  = text.Trim().IndexOf(")", 0, text.Trim().Length);
                string  text1 = text.Trim().Substring(num1 + 1, (num2 - num1) - 1);
                XmlNode node1 = NodeFunc.GetRefNode(text1, doc);
                if (node1 != null)
                {
                    if (node1.NodeType != XmlNodeType.Element)
                    {
                        return(null);
                    }
                    XmlElement element1 = (XmlElement)node1;
                    if (element1 != null)
                    {
                        return((ISvgBrush)element1);
                    }
                }
                return(null);
            }

            return(new SolidColor(ColorFunc.ParseColor(text)));
        }
Exemplo n.º 2
0
        public static ISvgBrush Parsing(string text, SvgDocument doc, IGraphPath path)
        {
            while (text.Trim().EndsWith(";"))
            {
                text = text.Substring(0, text.Length - 1);
            }
            if (text.Trim().StartsWith("url"))
            {
                int     num1  = text.Trim().IndexOf("#", 0, text.Trim().Length);
                int     num2  = text.Trim().IndexOf(")", 0, text.Trim().Length);
                string  text1 = text.Trim().Substring(num1 + 1, (num2 - num1) - 1);
                XmlNode node1 = NodeFunc.GetRefNode(text1, doc);
                if (node1 != null)
                {
                    if (node1.NodeType != XmlNodeType.Element)
                    {
                        return(null);
                    }
                    XmlElement element1 = (XmlElement)node1;
                    if (element1 != null)
                    {
                        return((ISvgBrush)element1);
                    }
                }
                return(null);
            }
            string text7 = "none";           // AttributeFunc.ParseAttribute("hatch-style",(SvgElement) path,false).ToString();

            if (((SvgElement)path).SvgAttributes.ContainsKey("hatch-style"))
            {
                text7 = ((SvgElement)path).SvgAttributes["hatch-style"].ToString();
            }
            if ((text7 != "") && (text7.ToLower() != "none") && (text != "none"))
            {
                Color color1 = ColorFunc.ParseColor(text);
                Color color2 = ColorFunc.ParseColor(AttributeFunc.ParseAttribute("hatch-color", (SvgElement)path, false).ToString());

                Struct.Pattern pattern = new ItopVector.Struct.Pattern(color1, (ItopVector.PatternType)Enum.Parse(typeof(ItopVector.PatternType), text7, false), color2);

                return(new RatHatchBrush(pattern));
            }

            return(new SolidColor(ColorFunc.ParseColor(text)));
        }