コード例 #1
0
 public LinearGradientColorPaintServerPaintServer(PaintServerManager owner, XmlNode node)
     : base(owner, node)
 {
     System.Diagnostics.Debug.Assert(node.Name == SVGTags.sLinearGradient);
     this.X1 = XmlUtil.AttrValue(node, "x1", double.NaN);
     this.Y1 = XmlUtil.AttrValue(node, "y1", double.NaN);
     this.X2 = XmlUtil.AttrValue(node, "x2", double.NaN);
     this.Y2 = XmlUtil.AttrValue(node, "y2", double.NaN);
 }
コード例 #2
0
 public LinearGradientColorPaintServerPaintServer(PaintServerManager owner, XmlNode node)
     : base(owner, node)
 {
     System.Diagnostics.Debug.Assert(node.Name == SVGTags.sLinearGradient);
     this.Id = XmlUtil.AttrValue(node, "id");
     this.X1 = XmlUtil.AttrValue(node, "x1", double.NaN);
     this.Y1 = XmlUtil.AttrValue(node, "y1", double.NaN);
     this.X2 = XmlUtil.AttrValue(node, "x2", double.NaN);
     this.Y2 = XmlUtil.AttrValue(node, "y2", double.NaN);
 }
コード例 #3
0
 public RadialGradientColorPaintServerPaintServer(PaintServerManager owner, XmlNode node)
     : base(owner, node)
 {
     System.Diagnostics.Debug.Assert(node.Name == SVGTags.sRadialGradient);
     this.CX = XmlUtil.AttrValue(node, "cx", double.NaN);
     this.CY = XmlUtil.AttrValue(node, "cy", double.NaN);
     this.FX = XmlUtil.AttrValue(node, "fx", double.NaN);
     this.FY = XmlUtil.AttrValue(node, "fy", double.NaN);
     this.R  = XmlUtil.AttrValue(node, "r", double.NaN);
     this.Normalize();
 }
コード例 #4
0
        public RadialGradientColorPaintServerPaintServer(PaintServerManager owner, XmlNode node)
            : base(owner, node)
        {
            System.Diagnostics.Debug.Assert(node.Name == SVGTags.sRadialGradient);
            this.Id = XmlUtil.AttrValue(node, "id");

            this.CX = XmlUtil.AttrValue(node, "cx", double.NaN);
            this.CY = XmlUtil.AttrValue(node, "cy", double.NaN);
            this.FX = XmlUtil.AttrValue(node, "fx", double.NaN);
            this.FY = XmlUtil.AttrValue(node, "fy", double.NaN);
            this.R = XmlUtil.AttrValue(node, "r", double.NaN);
            this.Normalize();
        }
コード例 #5
0
        public PatternPaintServer(PaintServerManager owner, SVG svg, XmlNode node) : base(owner)
        {
            this.PatternUnits = XmlUtil.AttrValue(node, "patternUnits", string.Empty);
            string transform = XmlUtil.AttrValue(node, "patternTransform", string.Empty);

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

            m_elements  = SVG.Parse(new SVG(), node);
            this.X      = XmlUtil.AttrValue(node, "x", 0, svg.Size.Width);
            this.Y      = XmlUtil.AttrValue(node, "y", 0, svg.Size.Height);
            this.Width  = XmlUtil.AttrValue(node, "width", 1, svg.Size.Width);
            this.Height = XmlUtil.AttrValue(node, "height", 1, svg.Size.Height);
        }
コード例 #6
0
        public GradientColorPaintServer(PaintServerManager owner, XmlNode node)
            : base(owner)
        {
            this.GradientUnits = XmlUtil.AttrValue(node, "gradientUnits", string.Empty);
            string transform = XmlUtil.AttrValue(node, "gradientTransform", string.Empty);
            if (transform.Length > 0)
            {
                this.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);
                GradientColorPaintServer refcol = owner.Parse(refid.Substring(1)) as GradientColorPaintServer;
                if (refcol == null) return;
                this.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(null, 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;
                    this.m_stops.Add(new GradientStop(color, offset));
                }
            }
        }
コード例 #7
0
 public SolidColorPaintServer(PaintServerManager owner, Color c)
     : base(owner)
 {
     this.Color = c;
 }
コード例 #8
0
ファイル: PaintServer.cs プロジェクト: swcomp/SVGImage
 public PaintServer(PaintServerManager owner)
 {
     this.Owner = owner;
 }
コード例 #9
0
ファイル: InheritPaintServer.cs プロジェクト: soapgu/SVGImage
 public InheritPaintServer(PaintServerManager owner)
     : base(owner)
 {
 }
コード例 #10
0
        public GradientColorPaintServer(PaintServerManager owner, XmlNode node) : base(owner)
        {
            this.GradientUnits = XmlUtil.AttrValue(node, "gradientUnits", string.Empty);
            string transform = XmlUtil.AttrValue(node, "gradientTransform", string.Empty);

            if (transform.Length > 0)
            {
                this.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);
                GradientColorPaintServer refcol = owner.Parse(refid.Substring(1)) as GradientColorPaintServer;
                if (refcol == null)
                {
                    return;
                }
                this.m_stops = new List <GradientStop>(refcol.m_stops);
            }
            foreach (XmlNode childnode in node.ChildNodes)
            {
                if (childnode.Name == "stop")
                {
                    var    styleattr = new List <XmlUtil.StyleItem>();
                    string fullstyle = XmlUtil.AttrValue(childnode, SVGTags.sStyle, string.Empty);
                    if (fullstyle.Length > 0)
                    {
                        foreach (ShapeUtil.Attribute styleitem in XmlUtil.SplitStyle(null, fullstyle))
                        {
                            styleattr.Add(new XmlUtil.StyleItem(styleitem.Name, styleitem.Value));
                        }
                    }
                    foreach (var attr1 in styleattr)
                    {
                        childnode.Attributes.Append(new TempXmlAttribute(childnode, attr1.Name, attr1.Value));
                    }

                    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;
                    }
                    this.m_stops.Add(new GradientStop(color, offset));
                }
            }
        }
コード例 #11
0
 public PatternPaintServer(PaintServerManager owner, Brush newBrush) : base(owner)
 {
     Brush = newBrush;
 }
コード例 #12
0
 public PaintServer(PaintServerManager owner, Brush newBrush)
 {
     this.Owner = owner;
     this.Brush = newBrush;
 }
コード例 #13
0
 public CurrentColorPaintServer(PaintServerManager owner)
     : base(owner)
 {
 }
コード例 #14
0
 public SolidColorPaintServer(PaintServerManager owner, Color c)
     : base(owner)
 {
     this.Color = c;
 }
コード例 #15
0
 public GradientColorPaintServer(PaintServerManager owner) : base(owner)
 {
 }
コード例 #16
0
 public SolidColorPaintServer(PaintServerManager owner, Brush newBrush) : base(owner)
 {
     Brush = newBrush;
 }
コード例 #17
0
 public LinearGradientColorPaintServerPaintServer(PaintServerManager owner, Brush newBrush) : base(owner)
 {
     Brush = newBrush;
 }
コード例 #18
0
ファイル: PaintServer.cs プロジェクト: w8w8w8/SVGImage
 public PaintServer(PaintServerManager owner)
 {
     this.Owner = owner;
 }