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).


Variable Index

 o height
The height of the rectangle's size.
 o MaxXEdge
 o MaxYEdge
 o MinXEdge
 o MinYEdge
 o width
The width of the rectangle's size.
 o x
The x-coordinate of the rectangle's origin.
 o y
The y-coordinate of the rectangle's origin.
 o ZeroRect
A null rectangle, that is one whose origin is the origin of the coordinates system and whose width and height are null.

Constructor Index

 o Rect()
Create a Rect whose origin is the origin of the coordinates system and whose width and height are null.
 o Rect(float, float, float, float)
Create a Rect with the given coordinates, width and height.

Method Index

 o insetRect(float, float)
Return a copy of the receiver, inset by a specified amount.
 o integralRect()
Return a copy of the receiver, without fractional defining values.
 o maxX()
Return the maximum x-coordinate of the receiver.
 o maxY()
Return the maximum y-coordinate of the receiver.
 o midX()
Return the x-coordinate of the receiver's midpoint.
 o midY()
Return the y-coordinate of the receiver's midpoint.
 o minX()
Return the minimum x-coordinate of the receiver.
 o minY()
Return the minimum y-coordinate of the receiver.
 o offsetRect(float, float)
Return a copy of the receiver, offset by a specified amount.
 o origin()
Return the origin of the receiver.
 o setOrigin(Point)
Set the origin of the receiver.
 o setSize(Size)
Set the size of the receiver.
 o size()
Return the size of the receiver.
 o toString()
Return a textual representation of the receiver.

Variables

 o MinXEdge
 public static final int MinXEdge
 o MinYEdge
 public static final int MinYEdge
 o MaxXEdge
 public static final int MaxXEdge
 o MaxYEdge
 public static final int MaxYEdge
 o 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.

 o x
 public float x
The x-coordinate of the rectangle's origin.

 o y
 public float y
The y-coordinate of the rectangle's origin.

 o width
 public float width
The width of the rectangle's size.

 o height
 public float height
The height of the rectangle's size.

Constructors

 o Rect
 public Rect()
Create a Rect whose origin is the origin of the coordinates system and whose width and height are null.

 o 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.

Methods

 o maxX
 public float maxX()
Return the maximum x-coordinate of the receiver.

 o maxY
 public float maxY()
Return the maximum y-coordinate of the receiver.

 o midX
 public float midX()
Return the x-coordinate of the receiver's midpoint.

 o midY
 public float midY()
Return the y-coordinate of the receiver's midpoint.

 o minX
 public float minX()
Return the minimum x-coordinate of the receiver.

 o minY
 public float minY()
Return the minimum y-coordinate of the receiver.

 o size
 public Size size()
Return the size of the receiver.

 o setSize
 public void setSize(Size s)
Set the size of the receiver.

Parameters:
s - the new size of the receiver.
 o origin
 public Point origin()
Return the origin of the receiver.

 o setOrigin
 public void setOrigin(Point o)
Set the origin of the receiver.

Parameters:
o - the new origin of the receiver.
 o 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
 o 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.
 o 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.

 o 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