Exemplo n.º 1
0
 public LinearGradientColor(PaintServerManager owner, XmlNode node) : base(owner, node)
 {
     System.Diagnostics.Debug.Assert(node.Name == SVGTags.sLinearGradient);
     Id = XmlUtil.AttrValue(node, "id");
     X1 = XmlUtil.AttrValue(node, "x1", double.NaN);
     Y1 = XmlUtil.AttrValue(node, "y1", double.NaN);
     X2 = XmlUtil.AttrValue(node, "x2", double.NaN);
     Y2 = XmlUtil.AttrValue(node, "y2", double.NaN);
 }
Exemplo n.º 2
0
        public RadialGradientColor(PaintServerManager owner, XmlNode node) : base(owner, node)
        {
            System.Diagnostics.Debug.Assert(node.Name == SVGTags.sRadialGradient);
            Id = XmlUtil.AttrValue(node, "id");

            CX = XmlUtil.AttrValue(node, "cx", double.NaN);
            CY = XmlUtil.AttrValue(node, "cy", double.NaN);
            FX = XmlUtil.AttrValue(node, "fx", double.NaN);
            FY = XmlUtil.AttrValue(node, "fy", double.NaN);
            R  = XmlUtil.AttrValue(node, "r", double.NaN);
            Normalize();
        }
Exemplo n.º 3
0
 public SolidColor(PaintServerManager owner, Color c) : base(owner)
 {
     Color = c;
 }
Exemplo n.º 4
0
        public GradientColor(PaintServerManager owner, XmlNode node) : base(owner)
        {
            GradientUnits = XmlUtil.AttrValue(node, "gradientUnits", string.Empty);
            string transform = XmlUtil.AttrValue(node, "gradientTransform", string.Empty);

            if (transform.Length > 0)
            {
                Transform = ShapeUtil.ParseTransform(transform.ToLower());
            }

            if (node.ChildNodes.Count == 0 && XmlUtil.AttrValue(node, "xlink:href", string.Empty).Length > 0)
            {
                string        refid  = XmlUtil.AttrValue(node, "xlink:href", string.Empty);
                GradientColor refcol = owner.Parse(refid.Substring(1)) as GradientColor;
                if (refcol == null)
                {
                    return;
                }
                m_stops = new List <GradientStop>(refcol.m_stops);
            }
            foreach (XmlNode childnode in node.ChildNodes)
            {
                if (childnode.Name == "stop")
                {
                    List <XmlAttribute> styleattr = new List <XmlAttribute>();
                    string fullstyle = XmlUtil.AttrValue(childnode, SVGTags.sStyle, string.Empty);
                    if (fullstyle.Length > 0)
                    {
                        foreach (ShapeUtil.Attribute styleitem in XmlUtil.SplitStyle(fullstyle))
                        {
                            styleattr.Add(new XmlUtil.StyleItem(childnode, styleitem.Name, styleitem.Value));
                        }
                    }
                    foreach (XmlAttribute attr1 in styleattr)
                    {
                        childnode.Attributes.Append(attr1);
                    }


                    double offset = XmlUtil.AttrValue(childnode, "offset", (double)0);
                    string s      = XmlUtil.AttrValue(childnode, "stop-color", "#0");

                    double stopopacity = XmlUtil.AttrValue(childnode, "stop-opacity", (double)1);

                    Color color;
                    if (s.StartsWith("#"))
                    {
                        color = PaintServerManager.ParseHexColor(s);
                    }
                    else
                    {
                        color = PaintServerManager.KnownColor(s);
                    }

                    if (stopopacity != 1)
                    {
                        color = Color.FromArgb((byte)(stopopacity * 255), color.R, color.G, color.B);
                    }

                    if (offset > 1)
                    {
                        offset = offset / 100;
                    }
                    m_stops.Add(new GradientStop(color, offset));
                }
            }
        }
Exemplo n.º 5
0
 public PaintServer(PaintServerManager owner)
 {
     Owner = owner;
 }