Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
6a20095e
Commit
6a20095e
authored
Mar 12, 2017
by
MatthewDiamond
Browse files
Found better solution to SvgClosePathSegment tested with Tiger.
parent
8ad92e3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Paths/SvgClosePathSegment.cs
View file @
6a20095e
...
...
@@ -8,24 +8,22 @@ namespace Svg.Pathing
{
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
{
if
(
graphicsPath
.
PointCount
==
0
)
var
pathData
=
graphicsPath
.
PathData
;
if
(
pathData
.
Points
.
Length
>
0
)
{
return
;
}
// Important for custom line caps. Force the path the close with an explicit line, not just an implicit close of the figure.
// Important for custom line caps. Force the path the close with an explicit line, not just an implicit close of the figure.
var
pathPoints
=
graphicsPath
.
PathPoints
;
if
(!
pathData
.
Points
[
0
].
Equals
(
pathData
.
Points
[
pathData
.
Points
.
Length
-
1
]))
{
int
i
=
pathData
.
Points
.
Length
-
1
;
while
(
i
>=
0
&&
pathData
.
Types
[
i
]
>
0
)
i
--;
if
(
i
<
0
)
i
=
0
;
graphicsPath
.
AddLine
(
pathData
.
Points
[
pathData
.
Points
.
Length
-
1
],
pathData
.
Points
[
i
]);
}
if
(!
pathPoints
[
0
].
Equals
(
pathPoints
[
pathPoints
.
Length
-
1
]))
{
var
pathTypes
=
graphicsPath
.
PathTypes
;
int
i
=
pathPoints
.
Length
-
1
;
while
(
i
>=
0
&&
pathTypes
[
i
]
>
0
)
i
--;
if
(
i
<
0
)
i
=
0
;
graphicsPath
.
AddLine
(
pathPoints
[
pathPoints
.
Length
-
1
],
pathPoints
[
i
]);
graphicsPath
.
CloseFigure
();
}
graphicsPath
.
CloseFigure
();
}
public
override
string
ToString
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment