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
05922300
Commit
05922300
authored
Dec 24, 2011
by
Tebjan Halm
Browse files
* better path collection method
* fixed missing files
parent
bc1d94f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/Document Structure/SvgGroup.cs
View file @
05922300
...
...
@@ -38,9 +38,9 @@ namespace Svg
{
var
path
=
new
GraphicsPath
();
AddPaths
(
this
,
path
);
//
AddPaths(this, path);
return
path
;
return
GetPaths
(
this
);
}
}
...
...
@@ -50,7 +50,16 @@ namespace Svg
/// <value>The bounds.</value>
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>
...
...
Source/Svg.csproj
View file @
05922300
...
...
@@ -91,6 +91,7 @@
<Compile
Include=
"Clipping and Masking\SvgClipPath.cs"
/>
<Compile
Include=
"Clipping and Masking\SvgMask.cs"
/>
<Compile
Include=
"DataTypes\ISvgViewPort.cs"
/>
<Compile
Include=
"DataTypes\SvgAspectRatio.cs"
/>
<Compile
Include=
"DataTypes\SvgElementStyle.cs"
/>
<Compile
Include=
"DataTypes\SvgCoordinateUnits.cs"
/>
<Compile
Include=
"DataTypes\SvgUnitCollection.cs"
/>
...
...
Source/SvgElement.cs
View file @
05922300
...
...
@@ -415,23 +415,64 @@ namespace Svg
{
foreach
(
var
child
in
elem
.
Children
)
{
if
(
!(
child
is
SvgGroup
)
&&
child
is
SvgVisualElement
)
if
(
child
is
SvgVisualElement
)
{
var
childPath
=
((
SvgVisualElement
)
child
).
Path
;
if
(
childPath
!=
null
)
if
(!(
child
is
SvgGroup
))
{
childPath
=
(
GraphicsPath
)
childPath
.
Clone
();
if
(
child
.
Transforms
!=
null
)
childPath
.
Transform
(
child
.
Transforms
.
GetMatrix
());
var
childPath
=
((
SvgVisualElement
)
child
).
Path
;
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
);
}
}
/// <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>
...
...
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