Skip to content

Commit 21f8e59

Browse files
committed
Merge branch 'allisterb-pr-bugfix-drawpath'
2 parents 53af427 + 35a2e19 commit 21f8e59

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

SvgGdiTest/SvgGdiTestForm.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,12 @@ private void Render(IGraphics ig)
502502
LinearGradientBrush gbr2 = new LinearGradientBrush(new Point(0, 0), new Point(10, 20), Color.WhiteSmoke, Color.CornflowerBlue);
503503
gbr2.WrapMode = WrapMode.TileFlipXY;
504504
ig.FillPath(gbr2, myPath);
505+
506+
GraphicsPath myPath2 = new GraphicsPath();
507+
myPath2.AddLine(100, 100, 130, 120);
508+
myPath2.AddEllipse(120, 120, 120, 140);
509+
myPath2.AddBezier(130, 160, 170, 160, 150, 130, 200, 110);
510+
ig.DrawPath(new Pen(Color.Blue), myPath2);
505511
}
506512
else if (s == "Path 2 (Slow)")
507513
{
@@ -522,7 +528,6 @@ private void Render(IGraphics ig)
522528
myGraphicsPath.AddString("a string in a path filled", myFontFamily,
523529
0, 24, myPointF, myStringFormat);
524530
myGraphicsPath.AddPie(230, 10, 40, 40, 40, 110);
525-
526531
ig.FillPath(mySolidBrush, myGraphicsPath);
527532
ig.DrawPath(new Pen(Color.Green), myGraphicsPath);
528533
}

SvgNet/.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[*]
2+
end_of_line = crlf
3+
4+
[*.xml]
5+
indent_style = space
6+
7+
[*.cs]
8+
indent_style = space
9+
indent_size = 4
10+
trim_trailing_whitespace=true
11+
dotnet_sort_system_directives_first=true
12+
csharp_new_line_before_else=false

SvgNet/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
[assembly: AssemblyCulture("")]
2121

2222
[assembly: AssemblyVersion("1.0.0")]
23-
[assembly: AssemblyFileVersion("1.0.3")]
24-
[assembly: AssemblyInformationalVersion("1.0.3")]
23+
[assembly: AssemblyFileVersion("1.0.4")]
24+
[assembly: AssemblyInformationalVersion("1.0.4")]
2525

2626
[assembly: AssemblyDelaySign(false)]
2727
[assembly: AssemblyKeyFile("")]

SvgNet/SVGGraphics.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ public void DrawLines(Pen pen, Point[] points)
19721972
/// <remarks>
19731973
/// Mainly based on the libgdi+ implementation: https://github.com/mono/libgdiplus/blob/master/src/graphics-cairo.c
19741974
/// and this SO question reply: https://stackoverflow.com/questions/1790862/how-to-determine-endpoints-of-arcs-in-graphicspath-pathpoints-and-pathtypes-arra
1975-
/// from SiiliconMind.
1975+
/// from SiliconMind.
19761976
/// </remarks>
19771977
public void DrawPath(Pen pen, GraphicsPath path)
19781978
{
@@ -2011,10 +2011,11 @@ public void DrawPath(Pen pen, GraphicsPath path)
20112011
start = subpath.PathPoints[i];
20122012
bezierCurvePoints[0] = subpath.PathPoints[i];
20132013
bezierCurvePointsIndex = 1;
2014+
pen.DashStyle = originalPenDashStyle; //Reset pen dash mode to original when starting subpath
20142015
continue;
20152016
case PathPointType.Line:
20162017
DrawLine(pen, start, subpath.PathPoints[i]); //Draw a line segment ftom start point
2017-
start = subpath.PathPoints[i]; //Move start point here
2018+
start = subpath.PathPoints[i]; //Move start point to line end
20182019
bezierCurvePoints[0] = subpath.PathPoints[i]; //A line point can also be the start of a Bezier curve
20192020
bezierCurvePointsIndex = 1;
20202021
continue;
@@ -2026,10 +2027,10 @@ public void DrawPath(Pen pen, GraphicsPath path)
20262027
bezierCurvePoints = new PointF[4];
20272028
bezierCurvePoints[0] = subpath.PathPoints[i];
20282029
bezierCurvePointsIndex = 1;
2030+
start = subpath.PathPoints[i]; //Move start point to curve end
20292031
}
20302032
continue;
20312033
default:
2032-
20332034
switch ((PathPointType)subpath.PathTypes[i])
20342035
{
20352036
case PathPointType.DashMode:
@@ -2353,7 +2354,7 @@ public void FillPath(Brush brush, GraphicsPath path)
23532354
}
23542355
if (!isClosed)
23552356
{
2356-
subpath.CloseAllFigures();
2357+
//subpath.CloseAllFigures();
23572358
}
23582359
PathPointType lastType = (PathPointType)subpath.PathTypes[subpath.PathPoints.Length - 1];
23592360
if (subpath.PathTypes.Any(pt => ((PathPointType) pt & PathPointType.PathTypeMask) == PathPointType.Line))

SvgNet/SvgNet.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
</Compile>
164164
</ItemGroup>
165165
<ItemGroup>
166+
<None Include=".editorconfig" />
166167
<None Include="packages.config" />
167168
<None Include="SvgNet.nuspec" />
168169
</ItemGroup>

SvgNet/svgnetdoc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)