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
3d89dfc6
Commit
3d89dfc6
authored
Jun 28, 2013
by
Tebjan Halm
Browse files
added extention methods
parent
95c7f938
Changes
2
Show whitespace changes
Inline
Side-by-side
Source/Svg.csproj
View file @
3d89dfc6
...
@@ -117,6 +117,7 @@
...
@@ -117,6 +117,7 @@
<Compile
Include=
"Painting\EnumConverters.cs"
/>
<Compile
Include=
"Painting\EnumConverters.cs"
/>
<Compile
Include=
"SvgDefinitionDefaults.cs"
/>
<Compile
Include=
"SvgDefinitionDefaults.cs"
/>
<Compile
Include=
"SvgElementAttribute.cs"
/>
<Compile
Include=
"SvgElementAttribute.cs"
/>
<Compile
Include=
"SvgExtentions.cs"
/>
<Compile
Include=
"SvgRenderer.cs"
/>
<Compile
Include=
"SvgRenderer.cs"
/>
<Compile
Include=
"Painting\SvgColourConverter.cs"
/>
<Compile
Include=
"Painting\SvgColourConverter.cs"
/>
<Compile
Include=
"Painting\SvgGradientSpreadMethod.cs"
/>
<Compile
Include=
"Painting\SvgGradientSpreadMethod.cs"
/>
...
...
Source/SvgExtentions.cs
0 → 100644
View file @
3d89dfc6
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Drawing
;
using
System.IO
;
using
System.Xml
;
namespace
Svg
{
/// <summary>
/// Svg helpers
/// </summary>
public
static
class
SvgExtentions
{
public
static
void
SetRectangle
(
this
SvgRectangle
r
,
RectangleF
bounds
)
{
r
.
X
=
bounds
.
X
;
r
.
Y
=
bounds
.
Y
;
r
.
Width
=
bounds
.
Width
;
r
.
Height
=
bounds
.
Height
;
}
public
static
string
GetXML
(
this
SvgDocument
doc
)
{
var
ret
=
""
;
using
(
var
ms
=
new
MemoryStream
())
{
doc
.
Write
(
ms
);
ms
.
Position
=
0
;
var
sr
=
new
StreamReader
(
ms
);
ret
=
sr
.
ReadToEnd
();
sr
.
Close
();
}
return
ret
;
}
public
static
string
GetXML
(
this
SvgElement
elem
)
{
using
(
StringWriter
str
=
new
StringWriter
())
using
(
XmlTextWriter
xml
=
new
XmlTextWriter
(
str
))
{
elem
.
WriteElement
(
xml
);
return
str
.
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