Changeset 77 for Include/Classes/System/Drawing/Rectangle.ab
- Timestamp:
- Jan 27, 2007, 12:04:09 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/Drawing/Rectangle.ab
r28 r77 18 18 End Sub 19 19 20 Sub Rectangle(x As Single, y As Single, width As Single, height As Single)20 Sub Rectangle(x As Long, y As Long, width As Long, height As Long) 21 21 x = x 22 22 y = y … … 25 25 End Sub 26 26 27 Sub Rectangle(location As Point, size As Size) 28 x = location.X 29 y = location.Y 30 width = size.Height 31 height = size.Height 32 End Sub 33 34 Sub Rectangle(ByRef rc As Rectangle) 35 x = rc.x 36 y = rc.y 37 width = rc.width 38 height = rc.height 27 Sub Rectangle(l As Point, s As Size) 28 x = l.X 29 y = l.Y 30 width = s.Height 31 height = s.Height 32 End Sub 33 34 Sub Rectangle(ByRef r As Rectangle) 35 x = r.x 36 y = r.y 37 width = r.width 38 height = r.height 39 End Sub 40 41 Sub Rectangle(ByRef r As RECT) 42 This = FromLTRB(r.left, r.top, r.right, r.bottom) 39 43 End Sub 40 44 … … 58 62 End Sub 59 63 60 Function X() As Single64 Function X() As Long 61 65 Return x 62 66 End Function 63 67 64 Sub X(value As Single)68 Sub X(value As Long) 65 69 x = value 66 70 End Sub 67 71 68 Function Y() As Single72 Function Y() As Long 69 73 Return y 70 74 End Function 71 75 72 Sub Y(value As Single)76 Sub Y(value As Long) 73 77 y = value 74 78 End Sub 75 79 76 Function Width() As Single80 Function Width() As Long 77 81 Return width 78 82 End Function 79 83 80 Sub Width(value As Single)84 Sub Width(value As Long) 81 85 width = value 82 86 End Sub 83 87 84 Function Height() As Single88 Function Height() As Long 85 89 Return height 86 90 End Function 87 91 88 Sub Height(value As Single)92 Sub Height(value As Long) 89 93 height = value 90 94 End Sub 91 95 92 Function Left() As Single96 Function Left() As Long 93 97 Return X 94 98 End Function 95 99 96 Function Top() As Single100 Function Top() As Long 97 101 Return Y 98 102 End Function 99 103 100 Function Right() As Single104 Function Right() As Long 101 105 Return X + Width 102 106 End Function 103 107 104 Function Bottom() As Single108 Function Bottom() As Long 105 109 Return Y + Height 106 110 End Function … … 144 148 End Function 145 149 146 Static Function FromLTRB(l As Single, t As Single, r As Single, b As Single) As Rectangle150 Static Function FromLTRB(l As Long, t As Long, r As Long, b As Long) As Rectangle 147 151 Dim rect As Rectangle(l, t, r - l, r - b) 148 152 return rect 149 153 End Function 150 154 151 Function Contains(x As Single, y As Single) As BOOL155 Function Contains(x As Long, y As Long) As BOOL 152 156 If x >= X And x < X + Width And y >= Y And y < Y + Height Then 153 157 Contains = _System_TRUE … … 169 173 End Function 170 174 171 Sub Inflate(dx As Single, dy As Single)175 Sub Inflate(dx As Long, dy As Long) 172 176 X -= dx 173 177 Y -= dy … … 180 184 End Sub 181 185 182 Static Function Inflate(ByRef rc As Rectangle, x As Single, y As Single) As Rectangle186 Static Function Inflate(ByRef rc As Rectangle, x As Long, y As Long) As Rectangle 183 187 Inflate = rc 184 188 Inflate.Inflate(x, y) … … 190 194 191 195 Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle 192 Dim right As Single, bottom As Single, left As Single, top As Single196 Dim right As Long, bottom As Long, left As Long, top As Long 193 197 right = Math.Min(a.Right, b.Right) 194 198 bottom = Math.Min(a.Bottom, b.Bottom) … … 210 214 211 215 Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle 212 Dim right As Single, bottom As Single, left As Single, top As Single216 Dim right As Long, bottom As Long, left As Long, top As Long 213 217 right = Math.Max(a.Right(), b.Right()) 214 218 bottom = Math.Max(a.Bottom(), b.Bottom()) … … 222 226 End Sub 223 227 224 Sub Offset(dx As Single, dy As Single)228 Sub Offset(dx As Long, dy As Long) 225 229 X += dx 226 230 Y += dy … … 254 258 End Function 255 259 260 Function ToRECT() As RECT 261 With ToRECT 262 .left = x 263 .top = y 264 .right = x + width 265 .bottom = y + height 266 End With 267 End Function 268 256 269 Public 257 x As Single258 y As Single259 width As Single260 height As Single270 x As Long 271 y As Long 272 width As Long 273 height As Long 261 274 End Class 262 275
Note:
See TracChangeset
for help on using the changeset viewer.