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
9d37b566
Commit
9d37b566
authored
Dec 24, 2011
by
Tebjan Halm
Browse files
* added preserverAspectRatio attribute
parent
23143bb7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/DataTypes/ISvgViewPort.cs
View file @
9d37b566
...
...
@@ -14,5 +14,6 @@ namespace Svg
/// Gets or sets the viewport of the element.
/// </summary>
SvgViewBox
ViewBox
{
get
;
set
;
}
SvgAspectRatio
AspectRatio
{
get
;
set
;
}
}
}
Source/DataTypes/SvgAspectRatio.cs
0 → 100644
View file @
9d37b566
using
System
;
using
System.ComponentModel
;
namespace
Svg
{
/// <summary>
/// Description of SvgAspectRatio.
/// </summary>
public
class
SvgAspectRatio
{
public
SvgAspectRatio
()
{
}
public
SvgAspectRatio
(
SvgPreserveAspectRatio
align
)
:
this
(
align
,
false
)
{
}
public
SvgAspectRatio
(
SvgPreserveAspectRatio
align
,
bool
slice
)
{
this
.
Align
=
align
;
this
.
Slice
=
slice
;
}
public
SvgPreserveAspectRatio
Align
{
get
;
set
;
}
public
bool
Slice
{
get
;
set
;
}
public
override
string
ToString
()
{
return
TypeDescriptor
.
GetConverter
(
typeof
(
SvgPreserveAspectRatio
)).
ConvertToString
(
this
.
Align
)
+
(
Slice
?
" slice"
:
""
);
}
}
[
TypeConverter
(
typeof
(
SvgPreserverAspectRatioConverter
))]
public
enum
SvgPreserveAspectRatio
{
XMidYMid
,
//default
None
,
XMinYMin
,
XMidYMin
,
XMaxYMin
,
XMinYMid
,
XMaxYMid
,
XMinYMax
,
XMidYMax
,
XMaxYMax
}
}
Source/Document Structure/SvgFragment.cs
View file @
9d37b566
...
...
@@ -17,6 +17,7 @@ namespace Svg
private
SvgUnit
_width
;
private
SvgUnit
_height
;
private
SvgViewBox
_viewBox
;
private
SvgAspectRatio
_aspect
;
/// <summary>
/// Gets the SVG namespace string.
...
...
@@ -55,6 +56,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
{
return
this
.
_aspect
;
}
set
{
this
.
_aspect
=
value
;
}
}
/// <summary>
/// Applies the required transforms to <see cref="SvgRenderer"/>.
...
...
@@ -109,6 +121,7 @@ namespace Svg
this
.
_height
=
new
SvgUnit
(
SvgUnitType
.
Percentage
,
100.0f
);
this
.
_width
=
new
SvgUnit
(
SvgUnitType
.
Percentage
,
100.0f
);
this
.
ViewBox
=
SvgViewBox
.
Empty
;
this
.
AspectRatio
=
new
SvgAspectRatio
(
SvgPreserveAspectRatio
.
None
);
}
}
}
\ No newline at end of file
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