All Packages Class Hierarchy This Package Previous Next Index
Class com.apple.alpha.core.Rect
java.lang.Object
|
+----com.apple.alpha.core.Rect
- public class Rect
- extends Object
This class is used to represent a rectangle. A rectangle has two
attributes, its x- and y-coordinates (marking its origin), and its
width and height (indicating its size).
-
height
- The height of the rectangle's size.
-
MaxXEdge
-
-
MaxYEdge
-
-
MinXEdge
-
-
MinYEdge
-
-
width
- The width of the rectangle's size.
-
x
- The x-coordinate of the rectangle's origin.
-
y
- The y-coordinate of the rectangle's origin.
-
ZeroRect
- A null rectangle, that is one whose origin is the origin of the coordinates
system and whose width and height are null.
-
Rect()
- Create a Rect whose origin is the origin of the coordinates system and whose
width and height are null.
-
Rect(float, float, float, float)
- Create a Rect with the given coordinates, width and height.
-
insetRect(float, float)
- Return a copy of the receiver, inset by a specified amount.
-
integralRect()
- Return a copy of the receiver, without fractional defining values.
-
maxX()
- Return the maximum x-coordinate of the receiver.
-
maxY()
- Return the maximum y-coordinate of the receiver.
-
midX()
- Return the x-coordinate of the receiver's midpoint.
-
midY()
- Return the y-coordinate of the receiver's midpoint.
-
minX()
- Return the minimum x-coordinate of the receiver.
-
minY()
- Return the minimum y-coordinate of the receiver.
-
offsetRect(float, float)
- Return a copy of the receiver, offset by a specified amount.
-
origin()
- Return the origin of the receiver.
-
setOrigin(Point)
- Set the origin of the receiver.
-
setSize(Size)
- Set the size of the receiver.
-
size()
- Return the size of the receiver.
-
toString()
- Return a textual representation of the receiver.
MinXEdge
public static final int MinXEdge
MinYEdge
public static final int MinYEdge
MaxXEdge
public static final int MaxXEdge
MaxYEdge
public static final int MaxYEdge
ZeroRect
public static final Rect ZeroRect
- A null rectangle, that is one whose origin is the origin of the coordinates
system and whose width and height are null.
x
public float x
- The x-coordinate of the rectangle's origin.
y
public float y
- The y-coordinate of the rectangle's origin.
width
public float width
- The width of the rectangle's size.
height
public float height
- The height of the rectangle's size.
Rect
public Rect()
- Create a Rect whose origin is the origin of the coordinates system and whose
width and height are null.
Rect
public Rect(float u,
float v,
float w,
float h)
- Create a Rect with the given coordinates, width and height.
- Parameters:
- u - the x-coordinate of the new rectangle's origin.
- v - the y-coordinate of the new rectangle's origin.
- w - the width of the new rectangle's size.
- h - the height of the new rectangle's size.
maxX
public float maxX()
- Return the maximum x-coordinate of the receiver.
maxY
public float maxY()
- Return the maximum y-coordinate of the receiver.
midX
public float midX()
- Return the x-coordinate of the receiver's midpoint.
midY
public float midY()
- Return the y-coordinate of the receiver's midpoint.
minX
public float minX()
- Return the minimum x-coordinate of the receiver.
minY
public float minY()
- Return the minimum y-coordinate of the receiver.
size
public Size size()
- Return the size of the receiver.
setSize
public void setSize(Size s)
- Set the size of the receiver.
- Parameters:
- s - the new size of the receiver.
origin
public Point origin()
- Return the origin of the receiver.
setOrigin
public void setOrigin(Point o)
- Set the origin of the receiver.
- Parameters:
- o - the new origin of the receiver.
toString
public String toString()
- Return a textual representation of the receiver. A rectangle with origin
(5, 7), width 10 and height 27 will be represented as the string
"{x = 5; y = 7; width = 10; height = 27}".
- Overrides:
- toString in class Object
insetRect
public Rect insetRect(float dx,
float dy)
- Return a copy of the receiver, inset by a specified amount.
The rectangle is altered by moving its sides inwards by the specified amount.
- Parameters:
- dx - the amount to inset in the x-direction.
- dy - the amount to inset in the y-direction.
integralRect
public Rect integralRect()
- Return a copy of the receiver, without fractional defining values.
The rectangle is expanded outwards just enough to ensure that
none of its four defining values (x, y, width, and height) have fractional parts.
If the receiver's width or height is zero or negative, return a rectangle with
origin at (0, 0.) and with zero width and height.
offsetRect
public Rect offsetRect(float dx,
float dy)
- Return a copy of the receiver, offset by a specified amount.
The rectangle's coordinates are shifted by the specified amount.
- Parameters:
- dx - the amount to offset in the x-direction.
- dy - the amount to offset in the y-direction.
All Packages Class Hierarchy This Package Previous Next Index