Ignore:
Timestamp:
Apr 13, 2007, 5:12:31 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

Object.ReferenceEqualsを追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Drawing/Rectangle.ab

    r166 r212  
    4848    End Function
    4949
    50     Sub Location(ByRef point As Point)
     50    Sub Location(point As Point)
    5151        x = point.X
    5252        y = point.Y
     
    5757    End Function
    5858
    59     Sub Size(ByRef size As Size)
     59    Sub Size(size As Size)
    6060        width = size.Width
    6161        height = size.Height
     
    117117        End If
    118118    End Function
    119 
    120     Function Operator = (ByRef rc As Rectangle)
     119/*
     120    Function Operator = (rc As Rectangle)
    121121        With rc
    122122            x = .x
     
    126126        End With
    127127    End Function
    128 
    129     Function Operator == (ByRef rc As Rectangle)
     128*/
     129    Function Operator == (rc As Rectangle)
    130130        Return Equals(rc)
    131131    End Function
    132132
    133     Function Operator <> (ByRef rc As Rectangle)
     133    Function Operator <> (rc As Rectangle)
    134134        Return Not Equals(rc)
    135135    End Function
    136136
    137137    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
    143142        If X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height Then
    144             Equals = _System_TRUE
    145         Else
    146             Equals = _System_FALSE
     143            Return True
     144        Else
     145            Return False
    147146        End If
    148147    End Function
     
    153152
    154153    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)
    157155    End Function
    158156
    159157    Function Contains(x As Long, y As Long) As Boolean
    160158        If x >= X And x < X + Width And y >= Y And y < Y + Height Then
    161             Contains = _System_TRUE
    162         Else
    163             Contains = _System_FALSE
    164         End If
    165     End Function
    166 
    167     Function Contains(ByRef pt As Point) As Boolean
    168         ContainsPTF = Contains(pt.X, pt.Y)
    169     End Function
    170 
    171     Function Contains(ByRef rc As Rectangle) As Boolean
     159            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
    172170        If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then
    173             ContainsRCF = _System_TRUE
    174         Else
    175             ContainsRCF = _System_FALSE
     171            Return True
     172        Else
     173            Return False
    176174        End If
    177175    End Function
     
    188186    End Sub
    189187
    190     Static Function Inflate(ByRef rc As Rectangle, x As Long, y As Long) As Rectangle
    191         Inflate = rc
     188    Static Function Inflate(rc As Rectangle, x As Long, y As Long) As Rectangle
     189        Inflate = New Rectangle(rc)
    192190        Inflate.Inflate(x, y)
    193191    End Function
    194192
    195     Sub Intersect(ByRef rect As Rectangle)
     193    Sub Intersect(rect As Rectangle)
    196194        This = Rectangle.Intersect(This, rect)
    197195    End Sub
    198196
    199     Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
     197    Static Function Intersect(a As Rectangle, ByRef b As Rectangle) As Rectangle
    200198        Dim right As Long, bottom As Long, left As Long, top As Long
    201199        right = Math.Min(a.Right, b.Right)
     
    206204    End Function
    207205
    208     Function IntersectsWith(ByRef rc As Rectangle) As Boolean
     206    Function IntersectsWith(rc As Rectangle) As Boolean
    209207        If Left < rc.Right And _
    210208            Top < rc.Bottom And _
    211209            Right > rc.Left And _
    212210            Bottom > rc.Top Then
    213             IntersectsWith = _System_TRUE
    214         Else
    215             IntersectsWith = _System_FALSE
    216         End If
    217     End Function
    218 
    219     Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
     211            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
    220218        Dim right As Long, bottom As Long, left As Long, top As Long
    221219        right = Math.Max(a.Right(), b.Right())
Note: See TracChangeset for help on using the changeset viewer.