Changeset 223 for Include/Classes/System/Drawing
- Timestamp:
- Apr 30, 2007, 1:56:57 PM (18 years ago)
- Location:
- Include/Classes/System/Drawing
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Drawing/Point.ab
r212 r223 4 4 #define __SYSTEM_DRAWING_POINT_AB__ 5 5 6 # include <Classes/System/Drawing/PointF.ab>7 # include <Classes/System/Drawing/Size.ab>8 # include <Classes/System/Drawing/SizeF.ab>6 #require <Classes/System/Drawing/PointF.ab> 7 #require <Classes/System/Drawing/Size.ab> 8 #require <Classes/System/Drawing/SizeF.ab> 9 9 10 10 Class Point … … 20 20 End Sub 21 21 22 Sub Point(pt As Point) 23 x = pt.x 24 y = pt.y 25 End Sub 26 27 Sub Point(ByRef sz As Size) 22 Sub Point(sz As Size) 28 23 x = sz.Width 29 24 y = sz.Height … … 54 49 Return x = 0 And y = 0 55 50 End Function 56 /* 57 Sub Operator = (ByRef pt As Point) 58 x = pt.x 59 y = pt.y 60 End Sub 61 */ 51 62 52 Function Operator + (pt As Point) As Point 63 53 Return Add(This, pt) -
Include/Classes/System/Drawing/Rectangle.ab
r212 r223 4 4 #define __SYSTEM_DRAWING_RECTANGLE_AB__ 5 5 6 # include <Classes/System/Math.ab>7 # include <Classes/System/Drawing/RectangleF.ab>8 # include <Classes/System/Drawing/Point.ab>9 # include <Classes/System/Drawing/Size.ab>6 #require <Classes/System/Math.ab> 7 #require <Classes/System/Drawing/RectangleF.ab> 8 #require <Classes/System/Drawing/Point.ab> 9 #require <Classes/System/Drawing/Size.ab> 10 10 11 11 Class Rectangle … … 32 32 End Sub 33 33 34 Sub Rectangle(ByRef r As Rectangle)35 x = r.x36 y = r.y37 width = r.width38 height = r.height39 End Sub40 41 34 Sub Rectangle(ByRef r As RECT) 42 This = FromLTRB(r.left, r.top, r.right, r.bottom) 35 x = r.left 36 y = r.top 37 width = r.right - r.left 38 height = r.top - r.bottom 43 39 End Sub 44 40 … … 111 107 112 108 Function IsEmpty() As Boolean 113 If Width <= 0 Or Height <= 0 Then 114 IsEmpty = _System_TRUE 115 Else 116 IsEmpty = _System_FALSE 117 End If 118 End Function 119 /* 120 Function Operator = (rc As Rectangle) 121 With rc 122 x = .x 123 y = .y 124 width = .width 125 height = .height 126 End With 127 End Function 128 */ 109 Return Width <= 0 Or Height <= 0 110 End Function 111 129 112 Function Operator == (rc As Rectangle) 130 113 Return Equals(rc) … … 140 123 141 124 Function Equals(rc As Rectangle) As Boolean 142 If X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height Then 143 Return True 144 Else 145 Return False 146 End If 125 Return X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height 147 126 End Function 148 127 149 128 Override Function GetHashCode() As Long 150 Return x Xor _System_BSwap(y) Xor width Xor _System_BSwap(height)129 Return x As DWord Xor _System_BSwap(y As DWord) Xor width As DWord Xor _System_BSwap(height As DWord) 151 130 End Function 152 131 153 132 Static Function FromLTRB(l As Long, t As Long, r As Long, b As Long) As Rectangle 154 return New Rectangle(l, t, r - l, r - b)133 return New Rectangle(l, t, r - l, b - t) 155 134 End Function 156 135 157 136 Function Contains(x As Long, y As Long) As Boolean 158 If x >= X And x < X + Width And y >= Y And y < Y + Height Then 159 Return True 160 Else 161 Return False 162 End If 137 Return x >= X And x < X + Width And y >= Y And y < Y + Height 163 138 End Function 164 139 … … 168 143 169 144 Function Contains(rc As Rectangle) As Boolean 170 If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then 171 Return True 172 Else 173 Return False 174 End If 145 Return X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom 175 146 End Function 176 147 … … 205 176 206 177 Function IntersectsWith(rc As Rectangle) As Boolean 207 IfLeft < rc.Right And _178 Return Left < rc.Right And _ 208 179 Top < rc.Bottom And _ 209 180 Right > rc.Left And _ 210 Bottom > rc.Top Then 211 Return True 212 Else 213 Return False 214 End If 181 Bottom > rc.Top 215 182 End Function 216 183 -
Include/Classes/System/Drawing/Size.ab
r212 r223 77 77 78 78 Override Function GetHashCode() As Long 79 Return width Xor _System_BSwap(height)79 Return width As DWord Xor _System_BSwap(height As DWord) 80 80 End Function 81 81 -
Include/Classes/System/Drawing/SizeF.ab
r212 r223 64 64 */ 65 65 Function Equals(sz As SizeF) As Boolean 66 If width = sz.width And height = sz.height Then 67 Equals = _System_TRUE 68 Else 69 Equals = _System_FALSE 70 End If 66 Return width = sz.width And height = sz.height 71 67 End Function 72 68 73 69 Override Function GetHashCode() As Long 74 70 Return VarPtr(GetDWord(width)) Xor _System_BSwap(VarPtr(GetDWord(height))) 71 End Function 75 72 76 73 Function IsEmpty() As Boolean 77 If width = 0 And height = 0 Then 78 Empty = _System_TRUE 79 Else 80 Empty = _System_FALSE 81 End If 74 Return width = 0 And height = 0 82 75 End Function 83 76
Note:
See TracChangeset
for help on using the changeset viewer.