コード例 #1
0
ファイル: XConvolutionFilter.cs プロジェクト: shhadi/SwfLib
        public static XElement ToXml(ConvolutionFilter filter)
        {
            var res = new XElement(TAG_NAME,
                                   new XAttribute("divisor", CommonFormatter.Format(filter.Divisor)),
                                   new XAttribute("bias", CommonFormatter.Format(filter.Bias))
                                   );

            var xMatrix = new XElement("matrix");

            for (var y = 0; y < filter.MatrixY; y++)
            {
                var xRow = new XElement("r");
                for (var x = 0; x < filter.MatrixX; x++)
                {
                    var xCol = new XElement("c")
                    {
                        Value = CommonFormatter.Format(filter.Matrix[y, x])
                    };
                    xRow.Add(xCol);
                }
                xMatrix.Add(xRow);
            }
            res.Add(xMatrix);

            res.Add(new XElement("color", XColorRGBA.ToXml(filter.DefaultColor)));
            if (filter.Reserved != 0)
            {
                res.Add(new XAttribute("reserved", filter.Reserved));
            }
            res.Add(new XAttribute("clamp", CommonFormatter.Format(filter.Clamp)));
            res.Add(new XAttribute("preserveAlpha", CommonFormatter.Format(filter.PreserveAlpha)));
            return(res);
        }
コード例 #2
0
 public static XElement ToXml(GradientRecordRGBA record)
 {
     return(new XElement("GradientItem",
                         new XAttribute("position", record.Ratio),
                         new XElement("color", XColorRGBA.ToXml(record.Color))
                         ));
 }
コード例 #3
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);
        }
コード例 #4
0
ファイル: XSolidFillStyle.cs プロジェクト: shhadi/SwfLib
        public static XElement ToXml(SolidFillStyleRGBA fillStyle)
        {
            var res = new XElement(SOLID);

            res.Add(new XElement("color", XColorRGBA.ToXml(fillStyle.Color)));
            return(res);
        }
コード例 #5
0
        protected override void FormatTagElement(DefineEditTextTag tag, XElement xTag)
        {
            xTag.Add(new XElement(SIZE_ELEM, XRect.ToXml(tag.Bounds)));

            xTag.Add(new XAttribute(WORD_WRAP_ATTRIB, SwfMillPrimitives.GetStringValue(tag.WordWrap)));
            xTag.Add(new XAttribute(MULTILINE_ATTRIB, SwfMillPrimitives.GetStringValue(tag.Multiline)));
            xTag.Add(new XAttribute(PASSWORD_ATTRIB, SwfMillPrimitives.GetStringValue(tag.Password)));
            xTag.Add(new XAttribute(READONLY_ATTRIB, SwfMillPrimitives.GetStringValue(tag.ReadOnly)));

            xTag.Add(new XAttribute(AUTOSIZE_ATTRIB, SwfMillPrimitives.GetStringValue(tag.AutoSize)));
            xTag.Add(new XAttribute(HAS_LAYOUT_ATTRIB, CommonFormatter.Format(tag.HasLayout)));
            xTag.Add(new XAttribute(NOT_SELECTABLE_ATTRIB, CommonFormatter.Format(tag.NoSelect)));
            xTag.Add(new XAttribute(BORDER_ATTRIB, CommonFormatter.Format(tag.Border)));
            xTag.Add(new XAttribute("static", CommonFormatter.Format(tag.WasStatic)));
            xTag.Add(new XAttribute(IS_HTML_ATTRIB, CommonFormatter.Format(tag.HTML)));
            xTag.Add(new XAttribute(USE_OUTLINES_ATTRIB, CommonFormatter.Format(tag.UseOutlines)));

            if (tag.HasFont)
            {
                xTag.Add(new XAttribute(FONT_REF_ATTRIB, tag.FontID));
            }
            if (tag.FontClass != null)
            {
                xTag.Add(new XAttribute("fontClass", tag.FontClass));
            }
            if (tag.HasFont)
            {
                xTag.Add(new XAttribute(FONT_HEIGHT_ATTRIB, tag.FontHeight));
            }
            if (tag.TextColor.HasValue)
            {
                xTag.Add(new XElement("color", XColorRGBA.ToXml(tag.TextColor.Value)));
            }
            if (tag.MaxLength.HasValue)
            {
                xTag.Add(new XAttribute(MAX_LENGTH_ATTRIB, tag.MaxLength.Value));
            }
            if (tag.HasLayout)
            {
                xTag.Add(new XAttribute(ALIGN_ATTRIB, tag.Align));
                xTag.Add(new XAttribute(LEFT_MARGIN_ATTRIB, tag.LeftMargin));
                xTag.Add(new XAttribute(RIGHT_MARGIN_ATTRIB, tag.RightMargin));
                xTag.Add(new XAttribute(INDENT_ATTRIB, tag.Indent));
                xTag.Add(new XAttribute(LEADING_ATTRIB, tag.Leading));
            }
            xTag.Add(new XAttribute(VARIABLE_NAME_ATTRIB, tag.VariableName));
            if (tag.InitialText != null)
            {
                xTag.Add(new XAttribute(INITIAL_TEXT_ATTRIB, tag.InitialText));
            }
        }
コード例 #6
0
ファイル: XGlowFilter.cs プロジェクト: shhadi/SwfLib
        public static XElement ToXml(GlowFilter filter)
        {
            var res = new XElement(TAG_NAME,
                                   new XAttribute("blurX", CommonFormatter.Format(filter.BlurX)),
                                   new XAttribute("blurY", CommonFormatter.Format(filter.BlurY)),
                                   new XAttribute("innerGlow", CommonFormatter.Format(filter.InnerGlow)),
                                   new XAttribute("knockout", CommonFormatter.Format(filter.Knockout)),
                                   new XAttribute("passes", filter.Passes),
                                   new XAttribute("strength", CommonFormatter.Format(filter.Strength)),
                                   new XElement("color", XColorRGBA.ToXml(filter.Color)),
                                   new XAttribute("compositeSource", CommonFormatter.Format(filter.CompositeSource))
                                   );

            return(res);
        }
コード例 #7
0
 public static XElement ToXml(DropShadowFilter filter)
 {
     return(new XElement(TAG_NAME,
                         new XAttribute("angle", CommonFormatter.Format(filter.Angle)),
                         new XAttribute("blurX", CommonFormatter.Format(filter.BlurX)),
                         new XAttribute("blurY", CommonFormatter.Format(filter.BlurY)),
                         new XAttribute("distance", CommonFormatter.Format(filter.Distance)),
                         new XAttribute("innerShadow", CommonFormatter.Format(filter.InnerShadow)),
                         new XAttribute("knockout", CommonFormatter.Format(filter.Knockout)),
                         new XAttribute("compositeSource", CommonFormatter.Format(filter.CompositeSource)),
                         new XAttribute("passes", filter.Passes),
                         new XAttribute("strength", CommonFormatter.Format(filter.Strength)),
                         new XElement("color", XColorRGBA.ToXml(filter.Color))
                         ));
 }
コード例 #8
0
        public static XElement ToXmlRGBA(TextRecordRGBA entry)
        {
            var res = new XElement(XName.Get("TextRecord6"));

            res.Add(new XAttribute("isSetup", CommonFormatter.Format(entry.Type)));
            if (entry.FontID.HasValue)
            {
                res.Add(new XAttribute("objectID", entry.FontID.Value));
            }
            if (entry.Reserved != 0)
            {
                res.Add(new XAttribute("reserved", entry.Reserved));
            }
            if (entry.XOffset.HasValue)
            {
                res.Add(new XAttribute("x", entry.XOffset.Value));
            }
            if (entry.YOffset.HasValue)
            {
                res.Add(new XAttribute("y", entry.YOffset.Value));
            }
            if (entry.FontID.HasValue)
            {
                if (!entry.TextHeight.HasValue)
                {
                    throw new InvalidOperationException("Text Height must be specified");
                }
                res.Add(new XAttribute("fontHeight", entry.TextHeight.Value));
            }
            if (entry.TextColor.HasValue)
            {
                var color = entry.TextColor.Value;
                res.Add(new XElement("color", XColorRGBA.ToXml(color)));
            }
            res.Add(new XElement(XName.Get("glyphs"), entry.Glyphs.Select(FormatGlyphEntry)));
            return(res);
        }
コード例 #9
0
 public static XElement ToXml(LineStyleRGBA lineStyle)
 {
     return(new XElement("LineStyle",
                         new XAttribute("width", lineStyle.Width),
                         new XElement("color", XColorRGBA.ToXml(lineStyle.Color))));
 }