public static SolidFillStyleRGB FromXmlRGB(XElement xFillStyle) { var xColor = xFillStyle.RequiredElement("color").Element("Color"); return(new SolidFillStyleRGB { Color = XColorRGB.FromXml(xColor) }); }
public static TextRecordRGB FromXmlRGB(XElement element) { var result = new TextRecordRGB(); foreach (var attribute in element.Attributes()) { switch (attribute.Name.LocalName) { case "objectID": result.FontID = ushort.Parse(attribute.Value); break; case "isSetup": result.Type = CommonFormatter.ParseBool(attribute.Value); break; case "reserved": result.Reserved = byte.Parse(attribute.Value); break; case "x": result.XOffset = short.Parse(attribute.Value); break; case "y": result.YOffset = short.Parse(attribute.Value); break; case "fontHeight": result.TextHeight = ushort.Parse(attribute.Value); break; default: throw new NotSupportedException(); } } foreach (var elem in element.Elements()) { switch (elem.Name.LocalName) { case "color": var color = XColorRGB.FromXml(elem.Element("Color")); result.TextColor = color; break; case "glyphs": foreach (var glyphElem in elem.Elements()) { result.Glyphs.Add(ParseGlyphEntry(glyphElem)); } break; default: throw new NotSupportedException(); } } return(result); }
public static GradientRecordRGB FromXml(XElement xRecord) { var record = new GradientRecordRGB { Ratio = xRecord.RequiredByteAttribute("position"), Color = XColorRGB.FromXml(xRecord.RequiredElement("color").Element("Color")) }; return(record); }
public static LineStyleRGB FromXml(XElement xLineStyle) { var xColor = xLineStyle.RequiredElement("color").Element("Color"); return(new LineStyleRGB { Width = xLineStyle.RequiredUShortAttribute("width"), Color = XColorRGB.FromXml(xColor) }); }
protected override bool AcceptTagElement(SetBackgroundColorTag tag, XElement element) { switch (element.Name.LocalName) { case COLOR_ELEM: tag.Color = XColorRGB.FromXml(element.Element("Color")); break; default: return(false); } return(true); }