FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
MapWindow5/src/MW5.Shared/RectangleHelper.cs at develop · MapWindow/MapWindow5 · GitHub
MapWindow
/
MapWindow5
Public
Notifications
You must be signed in to change notification settings
Fork
102
Star
308
Code
Issues
14
Pull requests
12
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
MapWindow5
/
src
/
MW5.Shared
/
RectangleHelper.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (37 loc) · 1.39 KB
Breadcrumbs
MapWindow5
/
src
/
MW5.Shared
/
RectangleHelper.cs
Copy path
File metadata and controls
45 lines (37 loc) · 1.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using
System
;
using
System
.
Drawing
;
namespace
MW5
.
Shared
{
public
static
class
RectangleHelper
{
public
static
Rectangle
CloneWithOffset
(
this
Rectangle
r
,
int
dx
,
int
dy
)
{
return
new
Rectangle
(
r
.
X
+
dx
,
r
.
Y
+
dy
,
r
.
Width
,
r
.
Height
)
;
}
public
static
Rectangle
FloatRectangleToInt
(
this
RectangleF
r
)
{
return
new
Rectangle
(
Convert
.
ToInt32
(
r
.
X
)
,
Convert
.
ToInt32
(
r
.
Y
)
,
Convert
.
ToInt32
(
r
.
Width
)
,
Convert
.
ToInt32
(
r
.
Height
)
)
;
}
public
static
Rectangle
Clone
(
this
Rectangle
r
)
{
return
new
Rectangle
(
r
.
X
,
r
.
Y
,
r
.
Width
,
r
.
Height
)
;
}
public
static
RectangleF
Clone
(
this
RectangleF
r
)
{
return
new
RectangleF
(
r
.
X
,
r
.
Y
,
r
.
Width
,
r
.
Height
)
;
}
public
static
Rectangle
ConvertToInt
(
this
RectangleF
r
)
{
return
new
Rectangle
(
Convert
.
ToInt32
(
r
.
X
)
,
Convert
.
ToInt32
(
r
.
Y
)
,
Convert
.
ToInt32
(
r
.
Width
)
,
Convert
.
ToInt32
(
r
.
Height
)
)
;
}
public
static
RectangleF
GetIntersection
(
Rectangle
page
,
RectangleF
r
)
{
var
result
=
new
RectangleF
(
)
;
result
.
X
=
Math
.
Max
(
r
.
X
,
page
.
X
)
;
result
.
Y
=
Math
.
Max
(
r
.
Y
,
page
.
Y
)
;
result
.
Width
=
Math
.
Min
(
r
.
Right
,
page
.
Right
)
-
result
.
X
;
result
.
Height
=
Math
.
Min
(
r
.
Bottom
,
page
.
Bottom
)
-
result
.
Y
;
return
result
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL