Beispiel #1
0
        public static CT_GradientFill Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_GradientFill ctObj = new CT_GradientFill();

            if (node.Attribute("type") != null)
            {
                ctObj.type = (ST_GradientType)Enum.Parse(typeof(ST_GradientType), node.Attribute("type").Value);
            }
            ctObj.degree = XmlHelper.ReadDouble(node.Attribute("degree"));
            ctObj.left   = XmlHelper.ReadDouble(node.Attribute("left"));
            ctObj.right  = XmlHelper.ReadDouble(node.Attribute("right"));
            ctObj.top    = XmlHelper.ReadDouble(node.Attribute("top"));
            ctObj.bottom = XmlHelper.ReadDouble(node.Attribute("bottom"));
            ctObj.stop   = new List <CT_GradientStop>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "stop")
                {
                    ctObj.stop.Add(CT_GradientStop.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Beispiel #2
0
        public static CT_GradientStop Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_GradientStop ctObj = new CT_GradientStop();

            ctObj.positionField = XmlHelper.ReadInt(node.Attribute("position"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "color")
                {
                    ctObj.colorField = CT_Color.Parse(childNode, namespaceManager);
                    break;
                }
            }
            return(ctObj);
        }