Commit 7f03fa6b authored by davescriven's avatar davescriven
Browse files

- Fixed "#7524 - support style stroke-dasharray"

- Changed the ISvgStylable interface StrokeDashArray property to be of type SvgUnitCollection instead of     SvgUnit[] and updated SvgGraphicsElement to implement this change.
parent 9eccb205
...@@ -105,6 +105,15 @@ namespace Svg ...@@ -105,6 +105,15 @@ namespace Svg
{ {
if (pen != null) if (pen != null)
{ {
if (this.StrokeDashArray != null)
{
pen.DashPattern = this.StrokeDashArray.ConvertAll<float>(delegate(SvgUnit unit)
{
// divide by stroke width - GDI behaviour that I don't quite understand yet.
return unit.Value / strokeWidth;
}).ToArray();
}
renderer.DrawPath(pen, this.Path); renderer.DrawPath(pen, this.Path);
} }
} }
......
...@@ -91,9 +91,9 @@ namespace Svg ...@@ -91,9 +91,9 @@ namespace Svg
} }
[SvgAttribute("stroke-dasharray")] [SvgAttribute("stroke-dasharray")]
public virtual SvgUnit[] StrokeDashArray public virtual SvgUnitCollection StrokeDashArray
{ {
get { return (this.Attributes["StrokeDashArray"] == null) ? null : (SvgUnit[])this.Attributes["StrokeDashArray"]; } get { return this.Attributes["StrokeDashArray"] as SvgUnitCollection; }
set { this.Attributes["StrokeDashArray"] = value; } set { this.Attributes["StrokeDashArray"] = value; }
} }
......
...@@ -21,7 +21,7 @@ namespace Svg ...@@ -21,7 +21,7 @@ namespace Svg
SvgStrokeLineCap StrokeLineCap { get; set; } SvgStrokeLineCap StrokeLineCap { get; set; }
SvgStrokeLineJoin StrokeLineJoin { get; set; } SvgStrokeLineJoin StrokeLineJoin { get; set; }
float StrokeMiterLimit { get; set; } float StrokeMiterLimit { get; set; }
SvgUnit[] StrokeDashArray { get; set; } SvgUnitCollection StrokeDashArray { get; set; }
SvgUnit StrokeDashOffset { get; set; } SvgUnit StrokeDashOffset { get; set; }
GraphicsPath Path { get; } GraphicsPath Path { get; }
RectangleF Bounds { get; } RectangleF Bounds { get; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment