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
f12b1ead
Commit
f12b1ead
authored
Feb 20, 2012
by
Tebjan Halm
Browse files
fixed corner radius value and calculation
parent
05922300
Changes
1
Show whitespace changes
Inline
Side-by-side
Source/Basic Shapes/SvgRectangle.cs
View file @
f12b1ead
...
@@ -178,8 +178,8 @@ namespace Svg
...
@@ -178,8 +178,8 @@ namespace Svg
var
lineEnd
=
new
PointF
();
var
lineEnd
=
new
PointF
();
var
width
=
Width
.
ToDeviceValue
();
var
width
=
Width
.
ToDeviceValue
();
var
height
=
Height
.
ToDeviceValue
();
var
height
=
Height
.
ToDeviceValue
();
var
rx
=
CornerRadiusX
.
ToDeviceValue
();
var
rx
=
CornerRadiusX
.
ToDeviceValue
()
*
2
;
var
ry
=
CornerRadiusY
.
ToDeviceValue
();
var
ry
=
CornerRadiusY
.
ToDeviceValue
()
*
2
;
var
location
=
Location
.
ToDeviceValue
();
var
location
=
Location
.
ToDeviceValue
();
// Start
// Start
...
@@ -192,9 +192,9 @@ namespace Svg
...
@@ -192,9 +192,9 @@ namespace Svg
_path
.
AddArc
(
arcBounds
,
180
,
90
);
_path
.
AddArc
(
arcBounds
,
180
,
90
);
// Add first line
// Add first line
lineStart
.
X
=
location
.
X
+
rx
;
lineStart
.
X
=
Math
.
Min
(
location
.
X
+
rx
,
location
.
X
+
width
*
0.5f
)
;
lineStart
.
Y
=
location
.
Y
;
lineStart
.
Y
=
location
.
Y
;
lineEnd
.
X
=
location
.
X
+
width
-
rx
;
lineEnd
.
X
=
Math
.
Max
(
location
.
X
+
width
-
rx
,
location
.
X
+
width
*
0.5f
)
;
lineEnd
.
Y
=
lineStart
.
Y
;
lineEnd
.
Y
=
lineStart
.
Y
;
_path
.
AddLine
(
lineStart
,
lineEnd
);
_path
.
AddLine
(
lineStart
,
lineEnd
);
...
@@ -204,9 +204,9 @@ namespace Svg
...
@@ -204,9 +204,9 @@ namespace Svg
// Add second line
// Add second line
lineStart
.
X
=
location
.
X
+
width
;
lineStart
.
X
=
location
.
X
+
width
;
lineStart
.
Y
=
location
.
Y
+
ry
;
lineStart
.
Y
=
Math
.
Min
(
location
.
Y
+
ry
,
location
.
Y
+
height
*
0.5f
)
;
lineEnd
.
X
=
lineStart
.
X
;
lineEnd
.
X
=
lineStart
.
X
;
lineEnd
.
Y
=
location
.
Y
+
height
-
ry
;
lineEnd
.
Y
=
Math
.
Max
(
location
.
Y
+
height
-
ry
,
location
.
Y
+
height
*
0.5f
)
;
_path
.
AddLine
(
lineStart
,
lineEnd
);
_path
.
AddLine
(
lineStart
,
lineEnd
);
// Add third arc
// Add third arc
...
@@ -214,9 +214,9 @@ namespace Svg
...
@@ -214,9 +214,9 @@ namespace Svg
_path
.
AddArc
(
arcBounds
,
0
,
90
);
_path
.
AddArc
(
arcBounds
,
0
,
90
);
// Add third line
// Add third line
lineStart
.
X
=
location
.
X
+
width
-
rx
;
lineStart
.
X
=
Math
.
Max
(
location
.
X
+
width
-
rx
,
location
.
X
+
width
*
0.5f
)
;
lineStart
.
Y
=
location
.
Y
+
height
;
lineStart
.
Y
=
location
.
Y
+
height
;
lineEnd
.
X
=
location
.
X
+
rx
;
lineEnd
.
X
=
Math
.
Min
(
location
.
X
+
rx
,
location
.
X
+
width
*
0.5f
)
;
lineEnd
.
Y
=
lineStart
.
Y
;
lineEnd
.
Y
=
lineStart
.
Y
;
_path
.
AddLine
(
lineStart
,
lineEnd
);
_path
.
AddLine
(
lineStart
,
lineEnd
);
...
@@ -226,9 +226,9 @@ namespace Svg
...
@@ -226,9 +226,9 @@ namespace Svg
// Add fourth line
// Add fourth line
lineStart
.
X
=
location
.
X
;
lineStart
.
X
=
location
.
X
;
lineStart
.
Y
=
location
.
Y
+
height
-
ry
;
lineStart
.
Y
=
Math
.
Max
(
location
.
Y
+
height
-
ry
,
location
.
Y
+
height
*
0.5f
)
;
lineEnd
.
X
=
lineStart
.
X
;
lineEnd
.
X
=
lineStart
.
X
;
lineEnd
.
Y
=
location
.
Y
+
ry
;
lineEnd
.
Y
=
Math
.
Min
(
location
.
Y
+
ry
,
location
.
Y
+
height
*
0.5f
)
;
_path
.
AddLine
(
lineStart
,
lineEnd
);
_path
.
AddLine
(
lineStart
,
lineEnd
);
// Close
// Close
...
...
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