Changeset 28
 Timestamp:
 Dec 11, 2006, 11:25:03 PM (18 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Include/Classes/System/Drawing/Rectangle.ab
r11 r28 27 27 Sub Rectangle(location As Point, size As Size) 28 28 x = location.X 29 y = l ccation.Y29 y = location.Y 30 30 width = size.Height 31 he giht = size.Height31 height = size.Height 32 32 End Sub 33 33 … … 35 35 x = rc.x 36 36 y = rc.y 37 wid ht= rc.width37 width = rc.width 38 38 height = rc.height 39 39 End Sub … … 107 107 108 108 Function IsEmpty() As BOOL 109 If Width <= Single_EPSILON Or Height <= Single_EPSILONThen110 IsEmpty Area= _System_TRUE111 Else 112 IsEmpty Area= _System_FALSE109 If Width <= 0 Or Height <= 0 Then 110 IsEmpty = _System_TRUE 111 Else 112 IsEmpty = _System_FALSE 113 113 End If 114 114 End Function … … 145 145 146 146 Static Function FromLTRB(l As Single, t As Single, r As Single, b As Single) As Rectangle 147 Dim r As Rectangle(left, top, right  left, bottom  top)148 return r 147 Dim rect As Rectangle(l, t, r  l, r  b) 148 return rect 149 149 End Function 150 150 … … 162 162 163 163 Function Contains(ByRef rc As Rectangle) As BOOL 164 If X <= rc.X && rc.Right <= Right && Y <= rc.Y &&rc.Bottom <= Bottom Then164 If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then 165 165 ContainsRCF = _System_TRUE 166 166 Else … … 172 172 X = dx 173 173 Y = dy 174 Width = dx + dx175 Height = dy + dy174 Width += dx + dx 175 Height += dy + dy 176 176 End Sub 177 177 178 178 Sub Inflate(sz As Size) 179 179 Inflate(sz.Width, sz.Height) 180 End Sub181 182 Sub Inflate(pt As Point)183 Inflate(pt.X, pt.Y)184 180 End Sub 185 181 … … 189 185 End Function 190 186 191 Function Intersect(ByRef rect As Rectangle) As BOOL192 Intersect = Intersect(This,This, rect)193 End Function187 Sub Intersect(ByRef rect As Rectangle) 188 This = Rectangle.Intersect(This, rect) 189 End Sub 194 190 195 191 Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle … … 199 195 left = Math.Min(a.Left, b.Left) 200 196 top = Math.Min(a.Top, b.Top) 201 Return FromLTRB(left, top, right, bottom)197 Return Rectangle.FromLTRB(left, top, right, bottom) 202 198 End Function 203 199 … … 215 211 Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle 216 212 Dim right As Single, bottom As Single, left As Single, top As Single 217 right = Math.Max(a. GetRight(), b.GetRight())218 bottom = Math.Max(a. GetBottom(), b.GetBottom())219 left = Math.Max(a. GetLeft(), b.GetLeft())220 top = Math.Max(a. GetTop(), b.GetTop())213 right = Math.Max(a.Right(), b.Right()) 214 bottom = Math.Max(a.Bottom(), b.Bottom()) 215 left = Math.Max(a.Left(), b.Left()) 216 top = Math.Max(a.Top(), b.Top()) 221 217 Return FromLTRB(left, top, right, bottom) 222 218 End Function
Note:
See TracChangeset
for help on using the changeset viewer.