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
11d63ae2
"vscode:/vscode.git/clone" did not exist on "f20108c812d22889d25412c195d0dd8fc6854174"
Commit
11d63ae2
authored
May 22, 2016
by
Andreas Niedermair
Browse files
fixed SvgImage.GetImage
parent
3bb22f1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Basic Shapes/SvgImage.cs
View file @
11d63ae2
...
@@ -88,8 +88,8 @@ namespace Svg
...
@@ -88,8 +88,8 @@ namespace Svg
/// <value>The bounds.</value>
/// <value>The bounds.</value>
public
override
RectangleF
Bounds
public
override
RectangleF
Bounds
{
{
get
{
return
new
RectangleF
(
this
.
Location
.
ToDeviceValue
(
null
,
this
),
get
{
return
new
RectangleF
(
this
.
Location
.
ToDeviceValue
(
null
,
this
),
new
SizeF
(
this
.
Width
.
ToDeviceValue
(
null
,
UnitRenderingType
.
Horizontal
,
this
),
new
SizeF
(
this
.
Width
.
ToDeviceValue
(
null
,
UnitRenderingType
.
Horizontal
,
this
),
this
.
Height
.
ToDeviceValue
(
null
,
UnitRenderingType
.
Vertical
,
this
)));
}
this
.
Height
.
ToDeviceValue
(
null
,
UnitRenderingType
.
Vertical
,
this
)));
}
}
}
...
@@ -143,10 +143,10 @@ namespace Svg
...
@@ -143,10 +143,10 @@ namespace Svg
}
}
var
destClip
=
new
RectangleF
(
this
.
Location
.
ToDeviceValue
(
renderer
,
this
),
var
destClip
=
new
RectangleF
(
this
.
Location
.
ToDeviceValue
(
renderer
,
this
),
new
SizeF
(
Width
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Horizontal
,
this
),
new
SizeF
(
Width
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Horizontal
,
this
),
Height
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Vertical
,
this
)));
Height
.
ToDeviceValue
(
renderer
,
UnitRenderingType
.
Vertical
,
this
)));
RectangleF
destRect
=
destClip
;
RectangleF
destRect
=
destClip
;
this
.
PushTransforms
(
renderer
);
this
.
PushTransforms
(
renderer
);
renderer
.
SetClip
(
new
Region
(
destClip
),
CombineMode
.
Intersect
);
renderer
.
SetClip
(
new
Region
(
destClip
),
CombineMode
.
Intersect
);
this
.
SetClip
(
renderer
);
this
.
SetClip
(
renderer
);
...
@@ -203,7 +203,7 @@ namespace Svg
...
@@ -203,7 +203,7 @@ namespace Svg
break
;
break
;
}
}
destRect
=
new
RectangleF
(
destClip
.
X
+
xOffset
,
destClip
.
Y
+
yOffset
,
destRect
=
new
RectangleF
(
destClip
.
X
+
xOffset
,
destClip
.
Y
+
yOffset
,
srcRect
.
Width
*
fScaleX
,
srcRect
.
Height
*
fScaleY
);
srcRect
.
Width
*
fScaleX
,
srcRect
.
Height
*
fScaleY
);
}
}
...
@@ -223,7 +223,7 @@ namespace Svg
...
@@ -223,7 +223,7 @@ namespace Svg
renderer
.
PopBoundable
();
renderer
.
PopBoundable
();
}
}
this
.
ResetClip
(
renderer
);
this
.
ResetClip
(
renderer
);
this
.
PopTransforms
(
renderer
);
this
.
PopTransforms
(
renderer
);
}
}
...
@@ -234,9 +234,22 @@ namespace Svg
...
@@ -234,9 +234,22 @@ namespace Svg
protected
object
GetImage
(
string
uriString
)
protected
object
GetImage
(
string
uriString
)
{
{
var
uriString
=
this
.
Href
;
string
safeUriString
;
if
(
uriString
.
Length
>
65519
)
{
safeUriString
=
uriString
.
Substring
(
0
,
65519
);
}
else
{
safeUriString
=
uriString
;
}
try
try
{
{
var
uri
=
new
Uri
(
u
riString
.
Substring
(
0
,
65519
)
);
//Uri MaxLength is 65519 (https://msdn.microsoft.com/en-us/library/z6c2z492.aspx)
var
uri
=
new
Uri
(
safeU
riString
);
//Uri MaxLength is 65519 (https://msdn.microsoft.com/en-us/library/z6c2z492.aspx)
// handle data/uri embedded images (http://en.wikipedia.org/wiki/Data_URI_scheme)
// handle data/uri embedded images (http://en.wikipedia.org/wiki/Data_URI_scheme)
if
(
uri
.
IsAbsoluteUri
&&
uri
.
Scheme
==
"data"
)
if
(
uri
.
IsAbsoluteUri
&&
uri
.
Scheme
==
"data"
)
...
@@ -268,7 +281,7 @@ namespace Svg
...
@@ -268,7 +281,7 @@ namespace Svg
{
{
if
(
stream
.
CanSeek
)
if
(
stream
.
CanSeek
)
{
{
stream
.
Position
=
0
;
stream
.
Position
=
0
;
}
}
if
(
uri
.
LocalPath
.
EndsWith
(
".svg"
,
StringComparison
.
InvariantCultureIgnoreCase
))
if
(
uri
.
LocalPath
.
EndsWith
(
".svg"
,
StringComparison
.
InvariantCultureIgnoreCase
))
{
{
...
...
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