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
bc1d94f4
Commit
bc1d94f4
authored
13 years ago
by
Tebjan Halm
Browse files
Options
Download
Email Patches
Plain Diff
* path tag writing works now
* added few enum converters
parent
a8ae07cc
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
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
Source/Painting/EnumConverters.cs
+12
-1
Source/Painting/EnumConverters.cs
Source/Painting/SvgPatternServer.cs
+11
-0
Source/Painting/SvgPatternServer.cs
Source/Paths/SvgArcSegment.cs
+7
-0
Source/Paths/SvgArcSegment.cs
Source/Paths/SvgClosePathSegment.cs
+6
-0
Source/Paths/SvgClosePathSegment.cs
Source/Paths/SvgCubicCurveSegment.cs
+1
-1
Source/Paths/SvgCubicCurveSegment.cs
Source/Paths/SvgLineSegment.cs
+6
-0
Source/Paths/SvgLineSegment.cs
Source/Paths/SvgMoveToSegment.cs
+6
-0
Source/Paths/SvgMoveToSegment.cs
Source/Paths/SvgPathBuilder.cs
+34
-1
Source/Paths/SvgPathBuilder.cs
Source/Paths/SvgQuadraticCurveSegment.cs
+6
-0
Source/Paths/SvgQuadraticCurveSegment.cs
with
89 additions
and
3 deletions
+89
-3
Source/Painting/EnumConverters.cs
+
12
-
1
View file @
bc1d94f4
...
...
@@ -95,5 +95,16 @@ namespace Svg
//implementaton for clip rule
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
>
{
}
}
This diff is collapsed.
Click to expand it.
Source/Painting/SvgPatternServer.cs
+
11
-
0
View file @
bc1d94f4
...
...
@@ -31,6 +31,17 @@ namespace Svg
get
{
return
this
.
_viewBox
;
}
set
{
this
.
_viewBox
=
value
;
}
}
/// <summary>
/// Gets or sets the aspect of the viewport.
/// </summary>
/// <value></value>
[
SvgAttribute
(
"preserveAspectRatio"
)]
public
SvgAspectRatio
AspectRatio
{
get
;
set
;
}
/// <summary>
/// Gets or sets the width of the pattern.
...
...
This diff is collapsed.
Click to expand it.
Source/Paths/SvgArcSegment.cs
+
7
-
0
View file @
bc1d94f4
...
...
@@ -152,6 +152,13 @@ namespace Svg.Pathing
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
]
...
...
This diff is collapsed.
Click to expand it.
Source/Paths/SvgClosePathSegment.cs
+
6
-
0
View file @
bc1d94f4
...
...
@@ -10,5 +10,11 @@ namespace Svg.Pathing
{
graphicsPath
.
CloseFigure
();
}
public
override
string
ToString
()
{
return
"z"
;
}
}
}
This diff is collapsed.
Click to expand it.
Source/Paths/SvgCubicCurveSegment.cs
+
1
-
1
View file @
bc1d94f4
...
...
@@ -37,7 +37,7 @@ namespace Svg.Pathing
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
(
);
}
}
}
This diff is collapsed.
Click to expand it.
Source/Paths/SvgLineSegment.cs
+
6
-
0
View file @
bc1d94f4
...
...
@@ -17,5 +17,11 @@ namespace Svg.Pathing
{
graphicsPath
.
AddLine
(
this
.
Start
,
this
.
End
);
}
public
override
string
ToString
()
{
return
"L"
+
this
.
End
.
ToSvgString
();
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Source/Paths/SvgMoveToSegment.cs
+
6
-
0
View file @
bc1d94f4
...
...
@@ -17,5 +17,11 @@ namespace Svg.Pathing
{
graphicsPath
.
StartFigure
();
}
public
override
string
ToString
()
{
return
"M"
+
this
.
Start
.
ToSvgString
();
}
}
}
This diff is collapsed.
Click to expand it.
Source/Paths/SvgPathBuilder.cs
+
34
-
1
View file @
bc1d94f4
...
...
@@ -4,11 +4,19 @@ using System.ComponentModel;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Globalization
;
using
System.Linq
;
using
Svg.Pathing
;
namespace
Svg
{
public
static
class
PointFExtensions
{
public
static
string
ToSvgString
(
this
PointF
p
)
{
return
p
.
X
.
ToString
()
+
" "
+
p
.
Y
.
ToString
();
}
}
internal
class
SvgPathBuilder
:
TypeConverter
{
/// <summary>
...
...
@@ -256,6 +264,31 @@ namespace Svg
}
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
This diff is collapsed.
Click to expand it.
Source/Paths/SvgQuadraticCurveSegment.cs
+
6
-
0
View file @
bc1d94f4
...
...
@@ -48,5 +48,11 @@ namespace Svg.Pathing
{
graphicsPath
.
AddBezier
(
this
.
Start
,
this
.
FirstControlPoint
,
this
.
SecondControlPoint
,
this
.
End
);
}
public
override
string
ToString
()
{
return
"Q"
+
this
.
ControlPoint
.
ToSvgString
()
+
" "
+
this
.
End
.
ToSvgString
();
}
}
}
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