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
41581021
Commit
41581021
authored
Apr 16, 2012
by
Tebjan Halm
Browse files
Merge remote-tracking branch 'origin/master'
parents
79c12b63
220cac7f
Changes
54
Show whitespace changes
Inline
Side-by-side
Source/Basic Shapes/SvgCircle.cs
View file @
41581021
...
...
@@ -139,5 +139,20 @@ namespace Svg
{
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgCircle
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgCircle
;
newObj
.
CenterX
=
this
.
CenterX
;
newObj
.
CenterY
=
this
.
CenterY
;
newObj
.
Radius
=
this
.
Radius
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Basic Shapes/SvgEllipse.cs
View file @
41581021
...
...
@@ -115,5 +115,22 @@ namespace Svg
public
SvgEllipse
()
{
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgEllipse
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgEllipse
;
newObj
.
CenterX
=
this
.
CenterX
;
newObj
.
CenterY
=
this
.
CenterY
;
newObj
.
RadiusX
=
this
.
RadiusX
;
newObj
.
RadiusY
=
this
.
RadiusY
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Basic Shapes/SvgImage.cs
0 → 100644
View file @
41581021
using
System
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
Svg.Transforms
;
namespace
Svg
{
/// <summary>
/// Represents and SVG image
/// </summary>
[
SvgElement
(
"image"
)]
public
class
SvgImage
:
SvgVisualElement
{
/// <summary>
/// Initializes a new instance of the <see cref="SvgImage"/> class.
/// </summary>
public
SvgImage
()
{
Width
=
new
SvgUnit
(
0.0f
);
Height
=
new
SvgUnit
(
0.0f
);
}
/// <summary>
/// Gets an <see cref="SvgPoint"/> representing the top left point of the rectangle.
/// </summary>
public
SvgPoint
Location
{
get
{
return
new
SvgPoint
(
X
,
Y
);
}
}
[
SvgAttribute
(
"x"
)]
public
virtual
SvgUnit
X
{
get
{
return
this
.
Attributes
.
GetAttribute
<
SvgUnit
>(
"x"
);
}
set
{
this
.
Attributes
[
"x"
]
=
value
;
}
}
[
SvgAttribute
(
"y"
)]
public
virtual
SvgUnit
Y
{
get
{
return
this
.
Attributes
.
GetAttribute
<
SvgUnit
>(
"y"
);
}
set
{
this
.
Attributes
[
"y"
]
=
value
;
}
}
[
SvgAttribute
(
"width"
)]
public
virtual
SvgUnit
Width
{
get
{
return
this
.
Attributes
.
GetAttribute
<
SvgUnit
>(
"width"
);
}
set
{
this
.
Attributes
[
"width"
]
=
value
;
}
}
[
SvgAttribute
(
"height"
)]
public
virtual
SvgUnit
Height
{
get
{
return
this
.
Attributes
.
GetAttribute
<
SvgUnit
>(
"height"
);
}
set
{
this
.
Attributes
[
"height"
]
=
value
;
}
}
[
SvgAttribute
(
"href"
,
SvgAttributeAttribute
.
XLinkNamespace
)]
public
virtual
Uri
Href
{
get
{
return
this
.
Attributes
.
GetAttribute
<
Uri
>(
"href"
);
}
set
{
this
.
Attributes
[
"href"
]
=
value
;
}
}
/// <summary>
/// Gets the bounds of the element.
/// </summary>
/// <value>The bounds.</value>
public
override
RectangleF
Bounds
{
get
{
return
new
RectangleF
(
this
.
Location
.
ToDeviceValue
(),
new
SizeF
(
this
.
Width
,
this
.
Height
));
}
}
/// <summary>
/// Gets the <see cref="GraphicsPath"/> for this element.
/// </summary>
public
override
GraphicsPath
Path
{
get
{
return
null
;
}
}
/// <summary>
/// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object.
/// </summary>
protected
override
void
Render
(
SvgRenderer
renderer
)
{
if
(
Width
.
Value
>
0.0f
&&
Height
.
Value
>
0.0f
)
{
//TODO:
//base.Render(renderer);
}
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgImage
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgImage
;
newObj
.
Height
=
this
.
Height
;
newObj
.
Width
=
this
.
Width
;
newObj
.
X
=
this
.
X
;
newObj
.
Y
=
this
.
Y
;
newObj
.
Href
=
this
.
Href
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Basic Shapes/SvgLine.cs
View file @
41581021
...
...
@@ -81,5 +81,24 @@ namespace Svg
{
get
{
return
this
.
Path
.
GetBounds
();
}
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgLine
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgLine
;
newObj
.
StartX
=
this
.
StartX
;
newObj
.
EndX
=
this
.
EndX
;
newObj
.
StartY
=
this
.
StartY
;
newObj
.
EndY
=
this
.
EndY
;
if
(
this
.
Fill
!=
null
)
newObj
.
Fill
=
this
.
Fill
.
DeepCopy
()
as
SvgPaintServer
;
return
newObj
;
}
}
}
Source/Basic Shapes/SvgPolygon.cs
View file @
41581021
...
...
@@ -74,5 +74,20 @@ namespace Svg
{
get
{
return
this
.
Path
.
GetBounds
();
}
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgPolygon
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgPolygon
;
newObj
.
Points
=
new
SvgUnitCollection
();
foreach
(
var
pt
in
this
.
Points
)
newObj
.
Points
.
Add
(
pt
);
return
newObj
;
}
}
}
\ No newline at end of file
Source/Basic Shapes/SvgRectangle.cs
View file @
41581021
using
System
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
Svg.Transforms
;
namespace
Svg
{
...
...
@@ -250,5 +251,23 @@ namespace Svg
base
.
Render
(
renderer
);
}
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgRectangle
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgRectangle
;
newObj
.
CornerRadiusX
=
this
.
CornerRadiusX
;
newObj
.
CornerRadiusY
=
this
.
CornerRadiusY
;
newObj
.
Height
=
this
.
Height
;
newObj
.
Width
=
this
.
Width
;
newObj
.
X
=
this
.
X
;
newObj
.
Y
=
this
.
Y
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Basic Shapes/SvgVisualElement.cs
View file @
41581021
...
...
@@ -61,6 +61,18 @@ namespace Svg
set
{
this
.
Attributes
[
"clip-rule"
]
=
value
;
}
}
/// <summary>
/// Gets the associated <see cref="SvgClipPath"/> if one has been specified.
/// </summary>
[
SvgAttribute
(
"filter"
)]
public
virtual
Uri
Filter
{
get
{
return
this
.
Attributes
.
GetAttribute
<
Uri
>(
"filter"
);
}
set
{
this
.
Attributes
[
"filter"
]
=
value
;
}
}
/// <summary>
/// Gets or sets a value to determine if anti-aliasing should occur when the element is being rendered.
/// </summary>
...
...
@@ -199,5 +211,32 @@ namespace Svg
{
this
.
ResetClip
(
renderer
);
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgVisualElement
;
newObj
.
ClipPath
=
this
.
ClipPath
;
newObj
.
ClipRule
=
this
.
ClipRule
;
newObj
.
Filter
=
this
.
Filter
;
newObj
.
Visible
=
this
.
Visible
;
if
(
this
.
Fill
!=
null
)
newObj
.
Fill
=
this
.
Fill
;
if
(
this
.
Stroke
!=
null
)
newObj
.
Stroke
=
this
.
Stroke
;
newObj
.
FillRule
=
this
.
FillRule
;
newObj
.
FillOpacity
=
this
.
FillOpacity
;
newObj
.
StrokeWidth
=
this
.
StrokeWidth
;
newObj
.
StrokeLineCap
=
this
.
StrokeLineCap
;
newObj
.
StrokeLineJoin
=
this
.
StrokeLineJoin
;
newObj
.
StrokeMiterLimit
=
this
.
StrokeMiterLimit
;
newObj
.
StrokeDashArray
=
this
.
StrokeDashArray
;
newObj
.
StrokeDashOffset
=
this
.
StrokeDashOffset
;
newObj
.
StrokeOpacity
=
this
.
StrokeOpacity
;
newObj
.
Opacity
=
this
.
Opacity
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Clipping and Masking/SvgClipPath.cs
View file @
41581021
...
...
@@ -115,5 +115,18 @@ namespace Svg
{
// Do nothing
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgClipPath
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgClipPath
;
newObj
.
ClipPathUnits
=
this
.
ClipPathUnits
;
return
newObj
;
}
}
}
Source/Clipping and Masking/SvgMask.cs
View file @
41581021
...
...
@@ -6,5 +6,12 @@ namespace Svg
{
public
class
SvgMask
:
SvgElement
{
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgMask
>();
}
}
}
\ No newline at end of file
Source/DataTypes/ISvgViewPort.cs
View file @
41581021
...
...
@@ -15,5 +15,6 @@ namespace Svg
/// </summary>
SvgViewBox
ViewBox
{
get
;
set
;
}
SvgAspectRatio
AspectRatio
{
get
;
set
;
}
SvgOverflow
Overflow
{
get
;
set
;
}
}
}
Source/DataTypes/SvgColourInterpolation.cs
0 → 100644
View file @
41581021
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Svg.DataTypes
{
public
enum
SvgColourInterpolation
{
auto
,
sRGB
,
linearRGB
,
inherit
}
}
Source/DataTypes/SvgFontWeight.cs
0 → 100644
View file @
41581021
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
namespace
Svg.DataTypes
{
public
enum
SvgFontWeight
{
normal
,
bold
}
}
Source/DataTypes/SvgOrient.cs
0 → 100644
View file @
41581021
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.ComponentModel
;
using
System.Web.UI.WebControls
;
using
System.Globalization
;
namespace
Svg
{
/// <summary>
/// Represents an orientation in an Scalable Vector Graphics document.
/// </summary>
public
class
SvgOrient
{
private
bool
_isAuto
=
true
;
private
float
_angle
;
public
SvgOrient
()
{
IsAuto
=
true
;
}
public
SvgOrient
(
float
angle
)
{
Angle
=
angle
;
}
/// <summary>
/// Gets the value of the unit.
/// </summary>
public
float
Angle
{
get
{
return
this
.
_angle
;
}
set
{
this
.
_angle
=
value
;
this
.
_isAuto
=
false
;
}
}
/// <summary>
/// Gets the value of the unit.
/// </summary>
public
bool
IsAuto
{
get
{
return
this
.
_isAuto
;
}
set
{
this
.
_isAuto
=
value
;
this
.
_angle
=
0f
;
}
}
/// <summary>
/// Indicates whether this instance and a specified object are equal.
/// </summary>
/// <param name="obj">Another object to compare to.</param>
/// <returns>
/// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
/// </returns>
public
override
bool
Equals
(
object
obj
)
{
if
(
obj
==
null
)
return
false
;
if
(!(
obj
.
GetType
()
==
typeof
(
SvgOrient
)))
return
false
;
var
unit
=
(
SvgOrient
)
obj
;
return
(
unit
.
IsAuto
==
this
.
IsAuto
&&
unit
.
Angle
==
this
.
Angle
);
}
public
override
int
GetHashCode
()
{
return
base
.
GetHashCode
();
}
public
override
string
ToString
()
{
string
type
=
string
.
Empty
;
if
(
this
.
IsAuto
)
return
"auto"
;
else
return
this
.
Angle
.
ToString
();
}
///// <summary>
///// Performs an implicit conversion from <see cref="Svg.SvgUnit"/> to <see cref="System.Single"/>.
///// </summary>
///// <param name="value">The value.</param>
///// <returns>The result of the conversion.</returns>
//public static implicit operator float(SvgOrient value)
//{
// return this.Angle;
//}
/// <summary>
/// Performs an implicit conversion from <see cref="System.Single"/> to <see cref="Svg.SvgOrient"/>.
/// </summary>
/// <param name="value">The value.</param>
/// <returns>The result of the conversion.</returns>
public
static
implicit
operator
SvgOrient
(
float
value
)
{
return
new
SvgOrient
(
value
);
}
}
}
Source/DataTypes/SvgOverflow.cs
0 → 100644
View file @
41581021
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Svg
{
public
enum
SvgOverflow
{
auto
,
visible
,
hidden
,
scroll
,
inherit
}
}
Source/Document Structure/SvgDefinitionList.cs
View file @
41581021
...
...
@@ -25,5 +25,12 @@ namespace Svg
{
// Do nothing. Children should NOT be rendered.
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgDefinitionList
>();
}
}
}
\ No newline at end of file
Source/Document Structure/SvgDescription.cs
View file @
41581021
...
...
@@ -21,5 +21,19 @@ namespace Svg
{
return
this
.
Text
;
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgDescription
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgDescription
;
newObj
.
Text
=
this
.
Text
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Document Structure/SvgDocumentMetadata.cs
0 → 100644
View file @
41581021
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Xml
;
namespace
Svg
{
/// <summary>
/// Represents a list of re-usable SVG components.
/// </summary>
[
SvgElement
(
"metadata"
)]
public
class
SvgDocumentMetadata
:
SvgElement
{
// private string _metadata;
/// <summary>
/// Initializes a new instance of the <see cref="SvgDocumentMetadata"/> class.
/// </summary>
public
SvgDocumentMetadata
()
{
Content
=
""
;
}
//public string Metadata
//{
// get { return _metadata; }
// set { _metadata = value; }
//}
/// <summary>
/// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="SvgRenderer"/> object.
/// </summary>
/// <param name="renderer">The <see cref="SvgRenderer"/> object to render to.</param>
protected
override
void
Render
(
SvgRenderer
renderer
)
{
// Do nothing. Children should NOT be rendered.
}
protected
override
void
WriteChildren
(
XmlTextWriter
writer
)
{
writer
.
WriteRaw
(
this
.
Content
);
//write out metadata as is
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgDocumentMetadata
>();
}
public
override
void
InitialiseFromXML
(
XmlTextReader
reader
,
SvgDocument
document
)
{
base
.
InitialiseFromXML
(
reader
,
document
);
//read in the metadata just as a string ready to be written straight back out again
Content
=
reader
.
ReadInnerXml
();
}
}
}
\ No newline at end of file
Source/Document Structure/SvgFragment.cs
View file @
41581021
...
...
@@ -46,6 +46,13 @@ namespace Svg
set
{
this
.
_height
=
value
;
}
}
[
SvgAttribute
(
"overflow"
)]
public
virtual
SvgOverflow
Overflow
{
get
{
return
this
.
Attributes
.
GetAttribute
<
SvgOverflow
>(
"overflow"
);
}
set
{
this
.
Attributes
[
"overflow"
]
=
value
;
}
}
/// <summary>
/// Gets or sets the viewport of the element.
/// </summary>
...
...
@@ -123,5 +130,22 @@ namespace Svg
this
.
ViewBox
=
SvgViewBox
.
Empty
;
this
.
AspectRatio
=
new
SvgAspectRatio
(
SvgPreserveAspectRatio
.
None
);
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgFragment
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgFragment
;
newObj
.
Height
=
this
.
Height
;
newObj
.
Width
=
this
.
Width
;
newObj
.
Overflow
=
this
.
Overflow
;
newObj
.
ViewBox
=
this
.
ViewBox
;
newObj
.
AspectRatio
=
this
.
AspectRatio
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Document Structure/SvgGroup.cs
View file @
41581021
...
...
@@ -4,6 +4,8 @@ using System.Xml;
using
System.Text
;
using
System.Drawing
;
using
System.Drawing.Drawing2D
;
using
System.Linq
;
using
Svg.Transforms
;
namespace
Svg
{
...
...
@@ -74,5 +76,19 @@ namespace Svg
this
.
ResetClip
(
renderer
);
this
.
PopTransforms
(
renderer
);
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgGroup
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgGroup
;
if
(
this
.
Fill
!=
null
)
newObj
.
Fill
=
this
.
Fill
.
DeepCopy
()
as
SvgPaintServer
;
return
newObj
;
}
}
}
\ No newline at end of file
Source/Document Structure/SvgUse.cs
View file @
41581021
...
...
@@ -90,5 +90,22 @@ namespace Svg
this
.
PopTransforms
(
renderer
);
}
public
override
SvgElement
DeepCopy
()
{
return
DeepCopy
<
SvgUse
>();
}
public
override
SvgElement
DeepCopy
<
T
>()
{
var
newObj
=
base
.
DeepCopy
<
T
>()
as
SvgUse
;
newObj
.
ReferencedElement
=
this
.
ReferencedElement
;
newObj
.
X
=
this
.
X
;
newObj
.
Y
=
this
.
Y
;
return
newObj
;
}
}
}
\ No newline at end of file
Prev
1
2
3
Next
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