Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
05922300
Commit
05922300
authored
13 years ago
by
Tebjan Halm
Browse files
Options
Download
Email Patches
Plain Diff
* better path collection method
* fixed missing files
parent
bc1d94f4
master
netstandard2
nuget2.4.2
nuget2.4.1
nuget2.4
nuget2.3
nuget2.2.2
nuget2.2.1
nuget1.7
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Source/Document Structure/SvgGroup.cs
+12
-3
Source/Document Structure/SvgGroup.cs
Source/Svg.csproj
+1
-0
Source/Svg.csproj
Source/SvgElement.cs
+50
-9
Source/SvgElement.cs
with
63 additions
and
12 deletions
+63
-12
Source/Document Structure/SvgGroup.cs
+
12
-
3
View file @
05922300
...
@@ -38,9 +38,9 @@ namespace Svg
...
@@ -38,9 +38,9 @@ namespace Svg
{
{
var
path
=
new
GraphicsPath
();
var
path
=
new
GraphicsPath
();
AddPaths
(
this
,
path
);
//
AddPaths(this, path);
return
path
;
return
GetPaths
(
this
);
}
}
}
}
...
@@ -50,7 +50,16 @@ namespace Svg
...
@@ -50,7 +50,16 @@ namespace Svg
/// <value>The bounds.</value>
/// <value>The bounds.</value>
public
override
System
.
Drawing
.
RectangleF
Bounds
public
override
System
.
Drawing
.
RectangleF
Bounds
{
{
get
{
return
new
System
.
Drawing
.
RectangleF
();
}
get
{
var
r
=
new
RectangleF
();
foreach
(
var
c
in
this
.
Children
)
{
if
(
c
is
SvgVisualElement
)
r
=
RectangleF
.
Union
(
r
,
((
SvgVisualElement
)
c
).
Bounds
);
}
return
r
;
}
}
}
/// <summary>
/// <summary>
...
...
This diff is collapsed.
Click to expand it.
Source/Svg.csproj
+
1
-
0
View file @
05922300
...
@@ -91,6 +91,7 @@
...
@@ -91,6 +91,7 @@
<Compile
Include=
"Clipping and Masking\SvgClipPath.cs"
/>
<Compile
Include=
"Clipping and Masking\SvgClipPath.cs"
/>
<Compile
Include=
"Clipping and Masking\SvgMask.cs"
/>
<Compile
Include=
"Clipping and Masking\SvgMask.cs"
/>
<Compile
Include=
"DataTypes\ISvgViewPort.cs"
/>
<Compile
Include=
"DataTypes\ISvgViewPort.cs"
/>
<Compile
Include=
"DataTypes\SvgAspectRatio.cs"
/>
<Compile
Include=
"DataTypes\SvgElementStyle.cs"
/>
<Compile
Include=
"DataTypes\SvgElementStyle.cs"
/>
<Compile
Include=
"DataTypes\SvgCoordinateUnits.cs"
/>
<Compile
Include=
"DataTypes\SvgCoordinateUnits.cs"
/>
<Compile
Include=
"DataTypes\SvgUnitCollection.cs"
/>
<Compile
Include=
"DataTypes\SvgUnitCollection.cs"
/>
...
...
This diff is collapsed.
Click to expand it.
Source/SvgElement.cs
+
50
-
9
View file @
05922300
...
@@ -415,23 +415,64 @@ namespace Svg
...
@@ -415,23 +415,64 @@ namespace Svg
{
{
foreach
(
var
child
in
elem
.
Children
)
foreach
(
var
child
in
elem
.
Children
)
{
{
if
(
!(
child
is
SvgGroup
)
&&
child
is
SvgVisualElement
)
if
(
child
is
SvgVisualElement
)
{
{
var
childPath
=
((
SvgVisualElement
)
child
).
Path
;
if
(!(
child
is
SvgGroup
))
if
(
childPath
!=
null
)
{
{
childPath
=
(
GraphicsPath
)
childPath
.
Clone
();
var
childPath
=
((
SvgVisualElement
)
child
).
Path
;
if
(
child
.
Transforms
!=
null
)
childPath
.
Transform
(
child
.
Transforms
.
GetMatrix
());
path
.
AddPath
(
childPath
,
false
);
if
(
childPath
!=
null
)
{
childPath
=
(
GraphicsPath
)
childPath
.
Clone
();
if
(
child
.
Transforms
!=
null
)
childPath
.
Transform
(
child
.
Transforms
.
GetMatrix
());
path
.
AddPath
(
childPath
,
false
);
}
}
}
}
}
AddPaths
(
child
,
path
);
AddPaths
(
child
,
path
);
}
}
}
/// <summary>
/// Recursive method to add up the paths of all children
/// </summary>
/// <param name="elem"></param>
/// <param name="path"></param>
protected
GraphicsPath
GetPaths
(
SvgElement
elem
)
{
var
ret
=
new
GraphicsPath
();
foreach
(
var
child
in
elem
.
Children
)
{
if
(
child
is
SvgVisualElement
)
{
if
(!(
child
is
SvgGroup
))
{
var
childPath
=
((
SvgVisualElement
)
child
).
Path
;
if
(
childPath
!=
null
)
{
childPath
=
(
GraphicsPath
)
childPath
.
Clone
();
if
(
child
.
Transforms
!=
null
)
childPath
.
Transform
(
child
.
Transforms
.
GetMatrix
());
ret
.
AddPath
(
childPath
,
false
);
}
}
else
{
var
childPath
=
GetPaths
(
child
);
if
(
child
.
Transforms
!=
null
)
childPath
.
Transform
(
child
.
Transforms
.
GetMatrix
());
}
}
}
return
ret
;
}
}
/// <summary>
/// <summary>
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help