public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { yield return(attr); } } yield return(new SvgAttribute("id", () => this.ID, v => this.ID = v )); yield return(new SvgAttribute("display", Display.Inline.ToString().ToLowerInvariant(), () => this.Display.ToString().ToLowerInvariant(), v => this.Display = SvgAttribute.ParseDisplayAttribute(v, Display.None))); yield return(new SvgAttribute("transform", () => TransformToString(this.Transform), v => Transform = SvgAttribute.ParseTransformAttribute(v))); }
public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { yield return(attr); } } var ci = CultureInfo.InvariantCulture; yield return(new SvgAttribute("cx", "0", () => Cx.ToString(ci), v => Cx = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("cy", "0", () => Cy.ToString(ci), v => Cy = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("rx", "0", () => Rx.ToString(ci), v => Rx = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("ry", "0", () => Ry.ToString(ci), v => Ry = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("stroke-width", () => StrokeWidth.ToString(ci), v => StrokeWidth = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("stroke", () => ColorTranslator.ToSvg(Stroke), v => Stroke = SvgAttribute.ParseColorAttribute(v, Stroke.A) )); yield return(new SvgAttribute("stroke-opacity", "1", () => ((double)Stroke.A / 255).ToString(ci), v => Stroke = SvgAttribute.ParseOpacityAttribute(v, Stroke) )); yield return(new SvgAttribute("fill", () => Fill.A == 0 ? "none" : ColorTranslator.ToSvg(Fill), v => Fill = SvgAttribute.ParseColorAttribute(v, Fill.A) )); yield return(new SvgAttribute("fill-opacity", "1", () => ((double)Fill.A / 255).ToString(ci), v => Fill = SvgAttribute.ParseOpacityAttribute(v, Fill) )); }
public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { yield return(attr); } } var ci = CultureInfo.InvariantCulture; yield return(new SvgAttribute("x1", "0", () => X1.ToString(ci), v => X1 = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("y1", "0", () => Y1.ToString(ci), v => Y1 = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("x2", "0", () => X2.ToString(ci), v => X2 = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("y2", "0", () => Y2.ToString(ci), v => Y2 = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("stroke-width", () => StrokeWidth.ToString(ci), v => StrokeWidth = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("stroke", () => Stroke == Color.Empty ? "none" : ColorTranslator.ToSvg(Stroke), v => Stroke = SvgAttribute.ParseColorAttribute(v, Stroke.A) )); yield return(new SvgAttribute("stroke-opacity", "1", () => ((double)Stroke.A / 255).ToString(ci), v => Stroke = SvgAttribute.ParseOpacityAttribute(v, Stroke) )); yield return(new SvgAttribute("stroke-dashoffset", () => StrokeDashOffset.ToString(ci), v => StrokeDashOffset = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("stroke-dasharray", () => DashArrayToString(), v => StrokeDashArray = SvgAttribute.ParseFloatArray(v) )); }
public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { yield return(attr); } } var ci = CultureInfo.InvariantCulture; yield return(new SvgAttribute("x", "0", () => X.ToString(ci), value => X = SvgAttribute.ParseFloatAttribute(value) )); yield return(new SvgAttribute("y", "0", () => Y.ToString(ci), value => Y = SvgAttribute.ParseFloatAttribute(value) )); yield return(new SvgAttribute("width", "0", () => Width.ToString(ci), value => Width = SvgAttribute.ParseFloatAttribute(value) )); yield return(new SvgAttribute("height", "0", () => Height.ToString(ci), value => Height = SvgAttribute.ParseFloatAttribute(value) )); yield return(new SvgAttribute("href", "", XmlNamespace.Xlink, () => Src, value => Src = value )); yield return(new SvgAttribute("preserveAspectRatio", () => PreserveAspectRatio, value => PreserveAspectRatio = value )); }
public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { yield return(attr); } } yield return(new SvgAttribute("id", () => this.ID, v => this.ID = v)); yield return(new SvgAttribute("width", () => this.Width.ToString(CultureInfo.InvariantCulture), v => this.Width = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("height", () => this.Height.ToString(CultureInfo.InvariantCulture), v => this.Height = SvgAttribute.ParseFloatAttribute(v) )); var ci = CultureInfo.InvariantCulture; var viewBox = string.Format("{0},{1},{2},{3}", ViewBox.X.ToString(ci), ViewBox.Y.ToString(ci), ViewBox.Width.ToString(ci), ViewBox.Height.ToString(ci)); yield return(new SvgAttribute("viewBox", () => viewBox, value => ViewBox = SvgAttribute.ParseViewBoxAttribute(value) )); yield return(new SvgAttribute("version", () => this.Version, v => { } // Readonly property )); }
public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { yield return(attr); } } var ci = CultureInfo.InvariantCulture; yield return(new SvgAttribute("x", "0", () => X.ToString(ci), value => X = SvgAttribute.ParseFloatAttribute(value) )); yield return(new SvgAttribute("y", "0", () => Y.ToString(ci), value => Y = SvgAttribute.ParseFloatAttribute(value) )); yield return(new SvgAttribute("fill", () => Fill.A == 0 ? "none" : ColorTranslator.ToSvg(Fill), v => Fill = SvgAttribute.ParseColorAttribute(v, Fill.A) )); yield return(new SvgAttribute("fill-opacity", "1", () => ((double)Fill.A / 255).ToString(ci), v => Fill = SvgAttribute.ParseOpacityAttribute(v, Fill) )); yield return(new SvgAttribute("text-anchor", () => TextAnchor, value => TextAnchor = value )); yield return(new SvgAttribute("font-family", () => FontFamily, value => FontFamily = value )); yield return(new SvgAttribute("font-style", () => FontStyle, value => FontStyle = value )); yield return(new SvgAttribute("font-weight", () => FontWeight, value => FontWeight = value )); yield return(new SvgAttribute("font-size", () => FontSize.ToString(ci), value => FontSize = SvgAttribute.ParseFloatAttribute(value) )); yield return(new SvgAttribute("text-decoration", () => TextDecoration, value => TextDecoration = value )); }