예제 #1
0
        public static XElement ToXml(LineStyleEx lineStyle)
        {
            var res = new XElement("LineStyle",
                                   new XAttribute("width", lineStyle.Width),
                                   new XAttribute("startCapStyle", (byte)lineStyle.StartCapStyle),
                                   new XAttribute("jointStyle", (byte)lineStyle.JoinStyle),
                                   new XAttribute("hasFill", lineStyle.HasFill ? "1" : "0"),
                                   new XAttribute("noHScale", lineStyle.NoHScale ? "1" : "0"),
                                   new XAttribute("noVScale", lineStyle.NoVScale ? "1" : "0"),
                                   new XAttribute("pixelHinting", lineStyle.PixelHinting ? "1" : "0"),
                                   new XAttribute("noClose", lineStyle.NoClose ? "1" : "0"),
                                   new XAttribute("endCapStyle", (byte)lineStyle.EndCapStyle)
                                   );

            if (lineStyle.Reserved != 0)
            {
                res.Add(new XAttribute("reserved", lineStyle.Reserved));
            }
            if (lineStyle.JoinStyle == JoinStyle.Miter)
            {
                res.Add(new XAttribute("miterFactor", CommonFormatter.Format(lineStyle.MilterLimitFactor)));
            }
            if (lineStyle.HasFill)
            {
                res.Add(new XElement("fillStyle", XFillStyle.ToXml(lineStyle.FillStyle)));
            }
            else
            {
                res.Add(new XElement("fillColor", XColorRGBA.ToXml(lineStyle.Color)));
            }
            return(res);
        }
예제 #2
0
파일: XStyleList.cs 프로젝트: shhadi/SwfLib
        public static XElement ToXml(IList <FillStyleRGB> fillStyles, IList <LineStyleRGB> lineStyles)
        {
            var xStyleList = new XElement("StyleList");

            var xFillStyles = new XElement("fillStyles");

            xStyleList.Add(xFillStyles);

            var xLineStyles = new XElement("lineStyles");

            xStyleList.Add(xLineStyles);

            foreach (var fillStyle in fillStyles)
            {
                xFillStyles.Add(XFillStyle.ToXml(fillStyle));
            }
            foreach (var lineStyle in lineStyles)
            {
                xLineStyles.Add(XLineStyleRGB.ToXml(lineStyle));
            }

            return(xStyleList);
        }