diff --git a/Basic Shapes/SvgGraphicsElement.cs b/Basic Shapes/SvgGraphicsElement.cs index 5ff4d43839739bb2cd407c90689646595f96f802..4e4886985e61b9a075ef04f4d64e9b8557cec8b8 100644 --- a/Basic Shapes/SvgGraphicsElement.cs +++ b/Basic Shapes/SvgGraphicsElement.cs @@ -110,7 +110,7 @@ namespace Svg pen.DashPattern = this.StrokeDashArray.ConvertAll(delegate(SvgUnit unit) { // divide by stroke width - GDI behaviour that I don't quite understand yet. - return unit.Value / strokeWidth; + return unit.Value / ((strokeWidth <= 0) ? 1 : strokeWidth); }).ToArray(); } diff --git a/Paths/SvgArcSegment.cs b/Paths/SvgArcSegment.cs index f94cddbe9b2df2bc60120975bbbd7ceab0a7e13c..011d3e7cb7ebed3cea4081cb791dec31f59f1d76 100644 --- a/Paths/SvgArcSegment.cs +++ b/Paths/SvgArcSegment.cs @@ -99,7 +99,7 @@ namespace Svg.Pathing } else { - root = (this.Size == SvgArcSize.Large && this.Sweep == SvgArcSweep.Positive ? -1.0 : 1.0) * Math.Sqrt(numerator / (this.RadiusX * this.RadiusX * y1dash * y1dash + this.RadiusY * this.RadiusY * x1dash * x1dash)); + root = ((this.Size == SvgArcSize.Large && this.Sweep == SvgArcSweep.Positive) || (this.Size == SvgArcSize.Small && this.Sweep == SvgArcSweep.Negative) ? -1.0 : 1.0) * Math.Sqrt(numerator / (this.RadiusX * this.RadiusX * y1dash * y1dash + this.RadiusY * this.RadiusY * x1dash * x1dash)); } double cxdash = root * rx * y1dash / ry; diff --git a/Paths/SvgPathBuilder.cs b/Paths/SvgPathBuilder.cs index 12732228c93c130d2144e85c857743e353b99cd8..387d125ad6527fa1c0ac2e794824d81cdafacab6 100644 --- a/Paths/SvgPathBuilder.cs +++ b/Paths/SvgPathBuilder.cs @@ -57,8 +57,8 @@ namespace Svg for (var i = 0; i < coords.Count; i += 7) { - size = (coords[i + 3] == 1.0f) ? SvgArcSize.Large : SvgArcSize.Small; - sweep = (coords[i + 4] == 1.0f) ? SvgArcSweep.Positive : SvgArcSweep.Negative; + size = (coords[i + 3] != 0.0f) ? SvgArcSize.Large : SvgArcSize.Small; + sweep = (coords[i + 4] != 0.0f) ? SvgArcSweep.Positive : SvgArcSweep.Negative; // A|a rx ry x-axis-rotation large-arc-flag sweep-flag x y segments.Add(new SvgArcSegment(segments.Last.End, coords[i], coords[i + 1], coords[i + 2], @@ -235,7 +235,7 @@ namespace Svg private static IEnumerable ParseCoordinates(string coords) { // TODO: Handle "1-1" (new PointF(1, -1); - var parts = coords.Remove(0, 1).Replace("-", " -").Split(new[] { ',', ' '}, + var parts = coords.Remove(0, 1).Replace("-", " -").Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < parts.Length; i++)