Changeset 303 for trunk/Include/Classes/System/Drawing/RectangleF.ab
- Timestamp:
- Aug 24, 2007, 11:14:46 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Include/Classes/System/Drawing/RectangleF.ab
r212 r303 106 106 107 107 Function IsEmpty() As Boolean 108 If Width <= 0 Or Height <= 0 Then 109 IsEmpty = _System_TRUE 110 Else 111 IsEmpty = _System_FALSE 112 End If 113 End Function 114 /* 115 Function Operator =(ByRef rc As RectangleF) 116 With rc 117 x = .x 118 y = .y 119 width = .width 120 height = .height 121 End With 122 End Function 123 */ 124 Function Operator ==(rc As RectangleF) 108 Return Width <= 0 Or Height <= 0 109 End Function 110 111 Function Operator ==(rc As RectangleF) As Boolean 125 112 Return Equals(rc) 126 113 End Function 127 114 128 Function Operator <>(rc As RectangleF) 115 Function Operator <>(rc As RectangleF) As Boolean 129 116 Return Not Equals(rc) 130 117 End Function 131 118 132 119 Function Equals(rc As RectangleF) As Boolean 133 If X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height Then 134 Return True 135 Else 136 Return False 137 End If 120 Equals = (X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height) 138 121 End Function 139 122 … … 147 130 148 131 Function Contains(x As Single, y As Single) As Boolean 149 If x >= X And x < X + Width And y >= Y And y < Y + Height Then 150 Contains = _System_TRUE 151 Else 152 Contains = _System_FALSE 153 End If 132 Contains = (x >= X And x < X + Width And y >= Y And y < Y + Height) 154 133 End Function 155 134 … … 159 138 160 139 Function Contains(rc As RectangleF) As Boolean 161 If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then 162 Return True 163 Else 164 Return False 165 End If 140 Contains = (X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom) 166 141 End Function 167 142 168 143 Sub Inflate(dx As Single, dy As Single) 169 X-= dx170 Y-= dy171 Width += dx + dx172 Height += dy + dy144 x -= dx 145 y -= dy 146 width += dx + dx 147 height += dy + dy 173 148 End Sub 174 149 … … 178 153 179 154 Static Function Inflate(rc As RectangleF, x As Single, y As Single) As RectangleF 180 Inflate = New Rectangle (rc)155 Inflate = New RectangleF(rc.X, rc.Y, rc.Width, rc.Height) 181 156 Inflate.Inflate(x, y) 182 157 End Function 183 158 184 159 Sub Intersect(rect As RectangleF) 185 This = RectangleF.Intersect(This, rect) 160 Dim r = RectangleF.Intersect(This, rect) 161 x = r.x 162 y = r.y 163 width = r.width 164 height = r.height 186 165 End Sub 187 166 188 167 Static Function Intersect(a As RectangleF, b As RectangleF) As RectangleF 189 168 Dim right As Single, bottom As Single, left As Single, top As Single 190 right = Math.Min(a.Right, b.Right)191 bottom = Math.Min(a.Bottom, b.Bottom)192 left = Math.Min(a.Left, b.Left)193 top = Math.Min(a.Top, b.Top)169 right = System.Math.Min(a.Right, b.Right) 170 bottom = System.Math.Min(a.Bottom, b.Bottom) 171 left = System.Math.Min(a.Left, b.Left) 172 top = System.Math.Min(a.Top, b.Top) 194 173 Return FromLTRB(left, top, right, bottom) 195 174 End Function … … 200 179 Right > rc.Left And _ 201 180 Bottom > rc.Top Then 202 IntersectsWith = _System_TRUE181 IntersectsWith = True 203 182 Else 204 IntersectsWith = _System_FALSE183 IntersectsWith = False 205 184 End If 206 185 End Function … … 208 187 Static Function Union(a As RectangleF, b As RectangleF) As RectangleF 209 188 Dim right As Single, bottom As Single, left As Single, top As Single 210 right = Math.Max(a.Right(), b.Right())211 bottom = Math.Max(a.Bottom(), b.Bottom())212 left = Math.Max(a.Left(), b.Left())213 top = Math.Max(a.Top(), b.Top())189 right = System.Math.Max(a.Right(), b.Right()) 190 bottom = System.Math.Max(a.Bottom(), b.Bottom()) 191 left = System.Math.Max(a.Left(), b.Left()) 192 top = System.Math.Max(a.Top(), b.Top()) 214 193 Return FromLTRB(left, top, right, bottom) 215 194 End Function … … 220 199 221 200 Sub Offset(dx As Single, dy As Single) 222 X+= dx223 Y+= dy201 x += dx 202 y += dy 224 203 End Sub 225 204
Note:
See TracChangeset
for help on using the changeset viewer.