Skip to content

Commit

Permalink
Merge branch 'allisterb-pr-bugfix-drawpath'
Browse files Browse the repository at this point in the history
  • Loading branch information
monoman committed Aug 29, 2017
2 parents 53af427 + 35a2e19 commit 21f8e59
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 8 deletions.
7 changes: 6 additions & 1 deletion SvgGdiTest/SvgGdiTestForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,12 @@ private void Render(IGraphics ig)
LinearGradientBrush gbr2 = new LinearGradientBrush(new Point(0, 0), new Point(10, 20), Color.WhiteSmoke, Color.CornflowerBlue);
gbr2.WrapMode = WrapMode.TileFlipXY;
ig.FillPath(gbr2, myPath);

GraphicsPath myPath2 = new GraphicsPath();
myPath2.AddLine(100, 100, 130, 120);
myPath2.AddEllipse(120, 120, 120, 140);
myPath2.AddBezier(130, 160, 170, 160, 150, 130, 200, 110);
ig.DrawPath(new Pen(Color.Blue), myPath2);
}
else if (s == "Path 2 (Slow)")
{
Expand All @@ -522,7 +528,6 @@ private void Render(IGraphics ig)
myGraphicsPath.AddString("a string in a path filled", myFontFamily,
0, 24, myPointF, myStringFormat);
myGraphicsPath.AddPie(230, 10, 40, 40, 40, 110);

ig.FillPath(mySolidBrush, myGraphicsPath);
ig.DrawPath(new Pen(Color.Green), myGraphicsPath);
}
Expand Down
12 changes: 12 additions & 0 deletions SvgNet/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[*]
end_of_line = crlf

[*.xml]
indent_style = space

[*.cs]
indent_style = space
indent_size = 4
trim_trailing_whitespace=true
dotnet_sort_system_directives_first=true
csharp_new_line_before_else=false
4 changes: 2 additions & 2 deletions SvgNet/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.3")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyFileVersion("1.0.4")]
[assembly: AssemblyInformationalVersion("1.0.4")]

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
Expand Down
9 changes: 5 additions & 4 deletions SvgNet/SVGGraphics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,7 @@ public void DrawLines(Pen pen, Point[] points)
/// <remarks>
/// Mainly based on the libgdi+ implementation: https://github.com/mono/libgdiplus/blob/master/src/graphics-cairo.c
/// and this SO question reply: https://stackoverflow.com/questions/1790862/how-to-determine-endpoints-of-arcs-in-graphicspath-pathpoints-and-pathtypes-arra
/// from SiiliconMind.
/// from SiliconMind.
/// </remarks>
public void DrawPath(Pen pen, GraphicsPath path)
{
Expand Down Expand Up @@ -2011,10 +2011,11 @@ public void DrawPath(Pen pen, GraphicsPath path)
start = subpath.PathPoints[i];
bezierCurvePoints[0] = subpath.PathPoints[i];
bezierCurvePointsIndex = 1;
pen.DashStyle = originalPenDashStyle; //Reset pen dash mode to original when starting subpath
continue;
case PathPointType.Line:
DrawLine(pen, start, subpath.PathPoints[i]); //Draw a line segment ftom start point
start = subpath.PathPoints[i]; //Move start point here
start = subpath.PathPoints[i]; //Move start point to line end
bezierCurvePoints[0] = subpath.PathPoints[i]; //A line point can also be the start of a Bezier curve
bezierCurvePointsIndex = 1;
continue;
Expand All @@ -2026,10 +2027,10 @@ public void DrawPath(Pen pen, GraphicsPath path)
bezierCurvePoints = new PointF[4];
bezierCurvePoints[0] = subpath.PathPoints[i];
bezierCurvePointsIndex = 1;
start = subpath.PathPoints[i]; //Move start point to curve end
}
continue;
default:

switch ((PathPointType)subpath.PathTypes[i])
{
case PathPointType.DashMode:
Expand Down Expand Up @@ -2353,7 +2354,7 @@ public void FillPath(Brush brush, GraphicsPath path)
}
if (!isClosed)
{
subpath.CloseAllFigures();
//subpath.CloseAllFigures();
}
PathPointType lastType = (PathPointType)subpath.PathTypes[subpath.PathPoints.Length - 1];
if (subpath.PathTypes.Any(pt => ((PathPointType) pt & PathPointType.PathTypeMask) == PathPointType.Line))
Expand Down
1 change: 1 addition & 0 deletions SvgNet/SvgNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
<None Include="packages.config" />
<None Include="SvgNet.nuspec" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion SvgNet/svgnetdoc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21f8e59

Please sign in to comment.