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
bc1d94f4
Commit
bc1d94f4
authored
Dec 24, 2011
by
Tebjan Halm
Browse files
* path tag writing works now
* added few enum converters
parent
a8ae07cc
Changes
9
Hide whitespace changes
Inline
Side-by-side
Source/Painting/EnumConverters.cs
View file @
bc1d94f4
...
@@ -95,5 +95,16 @@ namespace Svg
...
@@ -95,5 +95,16 @@ namespace Svg
//implementaton for clip rule
//implementaton for clip rule
public
sealed
class
SvgClipRuleConverter
:
EnumBaseConverter
<
SvgClipRule
>
public
sealed
class
SvgClipRuleConverter
:
EnumBaseConverter
<
SvgClipRule
>
{
{
}
}
//implementaton for clip rule
public
sealed
class
SvgTextAnchorConverter
:
EnumBaseConverter
<
SvgTextAnchor
>
{
}
//implementaton for preserve aspect ratio
public
sealed
class
SvgPreserverAspectRatioConverter
:
EnumBaseConverter
<
SvgPreserveAspectRatio
>
{
}
}
}
Source/Painting/SvgPatternServer.cs
View file @
bc1d94f4
...
@@ -31,6 +31,17 @@ namespace Svg
...
@@ -31,6 +31,17 @@ namespace Svg
get
{
return
this
.
_viewBox
;
}
get
{
return
this
.
_viewBox
;
}
set
{
this
.
_viewBox
=
value
;
}
set
{
this
.
_viewBox
=
value
;
}
}
}
/// <summary>
/// Gets or sets the aspect of the viewport.
/// </summary>
/// <value></value>
[
SvgAttribute
(
"preserveAspectRatio"
)]
public
SvgAspectRatio
AspectRatio
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Gets or sets the width of the pattern.
/// Gets or sets the width of the pattern.
...
...
Source/Paths/SvgArcSegment.cs
View file @
bc1d94f4
...
@@ -152,6 +152,13 @@ namespace Svg.Pathing
...
@@ -152,6 +152,13 @@ namespace Svg.Pathing
startY
=
(
float
)
endpointY
;
startY
=
(
float
)
endpointY
;
}
}
}
}
public
override
string
ToString
()
{
var
arcFlag
=
this
.
Size
==
SvgArcSize
.
Large
?
"1"
:
"0"
;
var
sweepFlag
=
this
.
Sweep
==
SvgArcSweep
.
Positive
?
"1"
:
"0"
;
return
"A"
+
this
.
RadiusX
.
ToString
()
+
" "
+
this
.
RadiusY
.
ToString
()
+
" "
+
this
.
Angle
.
ToString
()
+
" "
+
arcFlag
+
" "
+
sweepFlag
+
" "
+
this
.
End
.
ToSvgString
();
}
}
}
[
Flags
]
[
Flags
]
...
...
Source/Paths/SvgClosePathSegment.cs
View file @
bc1d94f4
...
@@ -10,5 +10,11 @@ namespace Svg.Pathing
...
@@ -10,5 +10,11 @@ namespace Svg.Pathing
{
{
graphicsPath
.
CloseFigure
();
graphicsPath
.
CloseFigure
();
}
}
public
override
string
ToString
()
{
return
"z"
;
}
}
}
}
}
Source/Paths/SvgCubicCurveSegment.cs
View file @
bc1d94f4
...
@@ -37,7 +37,7 @@ namespace Svg.Pathing
...
@@ -37,7 +37,7 @@ namespace Svg.Pathing
public
override
string
ToString
()
public
override
string
ToString
()
{
{
return
String
.
Format
(
"C {0} {1} {2}"
,
this
.
FirstControlPoint
,
this
.
SecondControlPoint
,
this
.
End
);
return
"C"
+
this
.
FirstControlPoint
.
ToSvgString
()
+
" "
+
this
.
SecondControlPoint
.
ToSvgString
()
+
" "
+
this
.
End
.
ToSvgString
(
);
}
}
}
}
}
}
Source/Paths/SvgLineSegment.cs
View file @
bc1d94f4
...
@@ -17,5 +17,11 @@ namespace Svg.Pathing
...
@@ -17,5 +17,11 @@ namespace Svg.Pathing
{
{
graphicsPath
.
AddLine
(
this
.
Start
,
this
.
End
);
graphicsPath
.
AddLine
(
this
.
Start
,
this
.
End
);
}
}
public
override
string
ToString
()
{
return
"L"
+
this
.
End
.
ToSvgString
();
}
}
}
}
}
\ No newline at end of file
Source/Paths/SvgMoveToSegment.cs
View file @
bc1d94f4
...
@@ -17,5 +17,11 @@ namespace Svg.Pathing
...
@@ -17,5 +17,11 @@ namespace Svg.Pathing
{
{
graphicsPath
.
StartFigure
();
graphicsPath
.
StartFigure
();
}
}
public
override
string
ToString
()
{
return
"M"
+
this
.
Start
.
ToSvgString
();
}
}
}
}
}
Source/Paths/SvgPathBuilder.cs
View file @
bc1d94f4
...
@@ -4,11 +4,19 @@ using System.ComponentModel;
...
@@ -4,11 +4,19 @@ using System.ComponentModel;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing
;
using
System.Globalization
;
using
System.Globalization
;
using
System.Linq
;
using
Svg.Pathing
;
using
Svg.Pathing
;
namespace
Svg
namespace
Svg
{
{
public
static
class
PointFExtensions
{
public
static
string
ToSvgString
(
this
PointF
p
)
{
return
p
.
X
.
ToString
()
+
" "
+
p
.
Y
.
ToString
();
}
}
internal
class
SvgPathBuilder
:
TypeConverter
internal
class
SvgPathBuilder
:
TypeConverter
{
{
/// <summary>
/// <summary>
...
@@ -256,6 +264,31 @@ namespace Svg
...
@@ -256,6 +264,31 @@ namespace Svg
}
}
return
base
.
ConvertFrom
(
context
,
culture
,
value
);
return
base
.
ConvertFrom
(
context
,
culture
,
value
);
}
public
override
object
ConvertTo
(
ITypeDescriptorContext
context
,
CultureInfo
culture
,
object
value
,
Type
destinationType
)
{
if
(
destinationType
==
typeof
(
string
))
{
var
paths
=
value
as
SvgPathSegmentList
;
if
(
paths
!=
null
)
{
return
string
.
Join
(
" "
,
paths
.
Select
(
p
=>
p
.
ToString
()).
ToArray
());
}
}
return
base
.
ConvertTo
(
context
,
culture
,
value
,
destinationType
);
}
public
override
bool
CanConvertTo
(
ITypeDescriptorContext
context
,
Type
destinationType
)
{
if
(
destinationType
==
typeof
(
string
))
{
return
true
;
}
return
base
.
CanConvertTo
(
context
,
destinationType
);
}
}
}
}
}
}
\ No newline at end of file
Source/Paths/SvgQuadraticCurveSegment.cs
View file @
bc1d94f4
...
@@ -48,5 +48,11 @@ namespace Svg.Pathing
...
@@ -48,5 +48,11 @@ namespace Svg.Pathing
{
{
graphicsPath
.
AddBezier
(
this
.
Start
,
this
.
FirstControlPoint
,
this
.
SecondControlPoint
,
this
.
End
);
graphicsPath
.
AddBezier
(
this
.
Start
,
this
.
FirstControlPoint
,
this
.
SecondControlPoint
,
this
.
End
);
}
}
public
override
string
ToString
()
{
return
"Q"
+
this
.
ControlPoint
.
ToSvgString
()
+
" "
+
this
.
End
.
ToSvgString
();
}
}
}
}
}
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