source: branch/egtra-gdiplus/Classes/System/Drawing/PointF.ab@ 552

Last change on this file since 552 was 241, checked in by イグトランス (egtra), 18 years ago

GDI+に対して名前空間で囲ったものの、現在コンパイルできないため分岐させておく

File size: 2.7 KB
Line 
1' Classes/System/Drawing/PointF.ab
2
3#ifndef __SYSTEM_DRAWING_POINTF_AB__
4#define __SYSTEM_DRAWING_POINTF_AB__
5
6#require <Classes/System/Drawing/Size.ab>
7#require <Classes/System/Drawing/SizeF.ab>
8
9Namespace System
10Namespace Drawing
11
12Class PointF
13Public
14 Sub PointF()
15 x = 0
16 y = 0
17 End Sub
18
19 Sub PointF(initX As Single, initY As Single)
20 x = initX
21 y = initY
22 End Sub
23
24 Sub PointF(pt As PointF)
25 x = pt.x
26 y = pt.y
27 End Sub
28
29 Sub PointF(sz As SizeF)
30 x = sz.Width
31 y = sz.Height
32 End Sub
33
34 Function X() As Single
35 Return x
36 End Function
37
38 Sub X(newX As Single)
39 x = newX
40 End Sub
41
42 Function Y() As Single
43 Return y
44 End Function
45
46 Sub Y(newY As Single)
47 y = newY
48 End Sub
49
50 Function IsEmpty() As Boolean
51 Return x = 0 And y = 0
52 End Function
53
54 Function Operator + (pt As PointF) As PointF
55 Return Add(This, pt)
56 End Function
57
58 Function Operator + (sz As Size) As PointF
59 Return Add(This, sz)
60 End Function
61
62 Function Operator + (sz As SizeF) As PointF
63 Return Add(This, sz)
64 End Function
65
66 Function Operator - (pt As PointF) As PointF
67 Return Substract(This, pt)
68 End Function
69
70 Function Operator - (sz As Size) As PointF
71 Return Substract(This, sz)
72 End Function
73
74 Function Operator - (sz As SizeF) As PointF
75 Return Substract(This, sz)
76 End Function
77
78 Function Operator == (sz As PointF) As Boolean
79 Return Equals(sz)
80 End Function
81
82 Function Operator <> (sz As PointF) As Boolean
83 Return Not Equals(sz)
84 End Function
85
86 Static Function Add(pt1 As PointF, pt2 As PointF) As PointF
87 Dim ret As PointF(pt1.x + pt2.x, pt1.y + pt2.y)
88 Return ret
89 End Function
90
91 Static Function Add(pt As PointF, sz As Size) As PointF
92 Dim ret As PointF(pt.x + sz.Width, pt.y + sz.Height)
93 Return ret
94 End Function
95
96 Static Function Add(pt As PointF, sz As SizeF) As PointF
97 Dim ret As PointF(pt.x + sz.Width, pt.y + sz.Height)
98 Return ret
99 End Function
100
101 Static Function Substract(pt1 As PointF, pt2 As PointF) As PointF
102 Dim ret As PointF(pt1.x - pt2.x, pt1.y - pt2.y)
103 Return ret
104 End Function
105
106 Static Function Substract(pt As PointF, sz As Size) As PointF
107 Dim ret As PointF(pt.x - sz.Width, pt.y - sz.Height)
108 Return ret
109 End Function
110
111 Static Function Substract(pt As PointF, sz As SizeF) As PointF
112 Dim ret As PointF(pt.x - sz.Width, pt.y - sz.Height)
113 Return ret
114 End Function
115
116 Function Equals(pt As PointF) As Boolean
117 Return x = pt.x And y = pt.y
118 End Function
119
120 Override Function GetHashCode() As Long
121 Return (GetDWord(VarPtr(x)) Xor _System_BSwap(GetDWord(VarPtr(x)))) As Long
122 End Function
123
124Private
125 x As Single
126 y As Single
127End Class
128
129End Namespace 'Drawing
130End Namespace 'System
131
132#endif '__SYSTEM_DRAWING_POINTF_AB__
Note: See TracBrowser for help on using the repository browser.