Changeset 212 for Include/Classes/System/Drawing/Rectangle.ab
- Timestamp:
- Apr 13, 2007, 5:12:31 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Drawing/Rectangle.ab
r166 r212 48 48 End Function 49 49 50 Sub Location( ByRefpoint As Point)50 Sub Location(point As Point) 51 51 x = point.X 52 52 y = point.Y … … 57 57 End Function 58 58 59 Sub Size( ByRefsize As Size)59 Sub Size(size As Size) 60 60 width = size.Width 61 61 height = size.Height … … 117 117 End If 118 118 End Function 119 120 Function Operator = ( ByRefrc As Rectangle)119 /* 120 Function Operator = (rc As Rectangle) 121 121 With rc 122 122 x = .x … … 126 126 End With 127 127 End Function 128 129 Function Operator == ( ByRefrc As Rectangle)128 */ 129 Function Operator == (rc As Rectangle) 130 130 Return Equals(rc) 131 131 End Function 132 132 133 Function Operator <> ( ByRefrc As Rectangle)133 Function Operator <> (rc As Rectangle) 134 134 Return Not Equals(rc) 135 135 End Function 136 136 137 137 Function Operator () As RectangleF 138 Dim r As RectangleF(x, y, width, height) 139 Return r 140 End Function 141 142 Function Equals(ByRef rc As Rectangle) As Boolean 138 Return New RectangleF(x, y, width, height) 139 End Function 140 141 Function Equals(rc As Rectangle) As Boolean 143 142 If X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height Then 144 Equals = _System_TRUE145 Else 146 Equals = _System_FALSE143 Return True 144 Else 145 Return False 147 146 End If 148 147 End Function … … 153 152 154 153 Static Function FromLTRB(l As Long, t As Long, r As Long, b As Long) As Rectangle 155 Dim rect As Rectangle(l, t, r - l, r - b) 156 return rect 154 return New Rectangle(l, t, r - l, r - b) 157 155 End Function 158 156 159 157 Function Contains(x As Long, y As Long) As Boolean 160 158 If x >= X And x < X + Width And y >= Y And y < Y + Height Then 161 Contains = _System_TRUE162 Else 163 Contains = _System_FALSE164 End If 165 End Function 166 167 Function Contains( ByRefpt As Point) As Boolean168 ContainsPTF =Contains(pt.X, pt.Y)169 End Function 170 171 Function Contains( ByRefrc As Rectangle) As Boolean159 Return True 160 Else 161 Return False 162 End If 163 End Function 164 165 Function Contains(pt As Point) As Boolean 166 Return Contains(pt.X, pt.Y) 167 End Function 168 169 Function Contains(rc As Rectangle) As Boolean 172 170 If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then 173 ContainsRCF = _System_TRUE174 Else 175 ContainsRCF = _System_FALSE171 Return True 172 Else 173 Return False 176 174 End If 177 175 End Function … … 188 186 End Sub 189 187 190 Static Function Inflate( ByRefrc As Rectangle, x As Long, y As Long) As Rectangle191 Inflate = rc188 Static Function Inflate(rc As Rectangle, x As Long, y As Long) As Rectangle 189 Inflate = New Rectangle(rc) 192 190 Inflate.Inflate(x, y) 193 191 End Function 194 192 195 Sub Intersect( ByRefrect As Rectangle)193 Sub Intersect(rect As Rectangle) 196 194 This = Rectangle.Intersect(This, rect) 197 195 End Sub 198 196 199 Static Function Intersect( ByRefa As Rectangle, ByRef b As Rectangle) As Rectangle197 Static Function Intersect(a As Rectangle, ByRef b As Rectangle) As Rectangle 200 198 Dim right As Long, bottom As Long, left As Long, top As Long 201 199 right = Math.Min(a.Right, b.Right) … … 206 204 End Function 207 205 208 Function IntersectsWith( ByRefrc As Rectangle) As Boolean206 Function IntersectsWith(rc As Rectangle) As Boolean 209 207 If Left < rc.Right And _ 210 208 Top < rc.Bottom And _ 211 209 Right > rc.Left And _ 212 210 Bottom > rc.Top Then 213 IntersectsWith = _System_TRUE214 Else 215 IntersectsWith = _System_FALSE216 End If 217 End Function 218 219 Static Function Union( ByRef a As Rectangle, ByRefb As Rectangle) As Rectangle211 Return True 212 Else 213 Return False 214 End If 215 End Function 216 217 Static Function Union(a As Rectangle, b As Rectangle) As Rectangle 220 218 Dim right As Long, bottom As Long, left As Long, top As Long 221 219 right = Math.Max(a.Right(), b.Right())
Note:
See TracChangeset
for help on using the changeset viewer.