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) )); }