Package com.adobe.xfa.ut
Class Rect
java.lang.Object
com.adobe.xfa.ut.Rect
A class to describe a rectangle. It consists of left, top, right, and, bottom
extents.
Instances of this class are immutable. All change operations
return a new instance of this Rect class.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRect()Instantiates aRectof zero extents.Instantiates aRectspecified by the givenCoordPair.Deprecated.Rect is immutable, so there is no need to copy an instance.Instantiates aRectspecified by the givenUnitSpanextents. -
Method Summary
Modifier and TypeMethodDescriptionReturns aRectrepresenting the shift of this object by the givenCoordPair.bottom()Gets this object's bottommost extent.bottomHeight(UnitSpan newBottom, UnitSpan newHeight) Returns aRectrepresenting the change in height of this object by the givenUnitSpanextents.Gets this object's bottom left coordinate.bottomLeft(CoordPair newBottomLeft) Returns aRectrepresenting the extention of this object using the given bottom leftCoordPair.Gets this object's bottom right coordinate.bottomRight(CoordPair newBottomRight) Returns aRectrepresenting the extention of this object using the given bottom rightCoordPair.centre()Gets this object's centre coordinate.changeUnits(int eNewUnits) Returns aRectrepresenting the change of this object's unit span units to the given unit code.booleanDetermines if this object contains the givenCoordPair.booleanDetermines if this object contains the givenRect.booleanDetermines if this object is disjoint from the givenRect.booleanDetermines if this object is equal to the givenObject.inthashCode()height()Gets this object's height.Returns aRectrepresenting the stretch in height of this object by the givenUnitSpan.intersection(Rect intersect) Returns aRectrepresenting the intersection of this object with the givenRect.booleanDetermines if this object is degenerate.left()Gets this object's leftmost extent.Returns aRectrepresenting the change in width of this object by the givenUnitSpanextents.Returns aRectrepresenting the change in width of this object by the givenUnitSpanextents.booleanDetermines if this object is not equal to the givenObject.booleanDetermines if this object overlaps the givenRect.right()Gets this object's rightmost extent.rightWidth(UnitSpan newRight, UnitSpan newWidth) Returns aRectrepresenting the change in width of this object by the givenUnitSpanextents.Returns aRectrepresenting the rotation of this object about the givenCoordPairandAngleof rotation.Returns aRectrepresenting the shift of this object and the givenCoordPair.top()Gets this object's topmost extent.Returns aRectrepresenting the change in height of this object by the givenUnitSpanextents.Returns aRectrepresenting the change in height of this object by the givenUnitSpanextents.topLeft()Gets this object's top left coordinate.Returns aRectrepresenting the extention of this object using the given top leftCoordPair.topRight()Gets this object's top right coordinate.Returns aRectrepresenting the extention of this object using the given top rightCoordPair.Returns aRectrepresenting the union of this object with the givenRect.width()Gets this object's width.Returns aRectrepresenting the stretch in width of this object by the givenUnitSpan.static Rectzero()The zero rectangle.
-
Field Details
-
ZERO
-
-
Constructor Details
-
Rect
public Rect()Instantiates aRectof zero extents. -
Rect
Deprecated.Rect is immutable, so there is no need to copy an instance.Instantiates aRectfrom the givenRect.- Parameters:
source- theRectto copy to this object.
-
Rect
Instantiates aRectspecified by the givenCoordPair.- Parameters:
topLeft- the top left coordinate of the rectangle.bottomRight- the bottom right coordinate of the rectangle.
-
Rect
Instantiates aRectspecified by the givenUnitSpanextents. The rectangle's extents are normalized such that:- the leftmost extent is set to
min(oLeft, oRight), - the rightmost extent is set to
max(oLeft, oRight), - the topmost extent is set to
min(oTop, oBottom), - the bottommost extent is set to
max(oTop, oBottom), - the width is set to
|oLeft - oRight|, and, - the height is set to
|oTop - oBottom|.
- Parameters:
left- the left extent of the rectangle.top- the top extent of the rectangle.right- the right extent of the rectangle.bottom- the bottom extent of the rectangle.
- the leftmost extent is set to
-
-
Method Details
-
left
Gets this object's leftmost extent.- Returns:
- the leftmost extent.
-
top
Gets this object's topmost extent.- Returns:
- the topmost extent.
-
right
Gets this object's rightmost extent.- Returns:
- the rightmost extent.
-
bottom
Gets this object's bottommost extent.- Returns:
- the bottommost extent.
-
leftRight
Returns aRectrepresenting the change in width of this object by the givenUnitSpanextents. The left/right extends are normalized.- Parameters:
newLeft- the new left extent.newRight- the new right extent.- Returns:
- a rectangle of the changed width.
-
topBottom
Returns aRectrepresenting the change in height of this object by the givenUnitSpanextents.- Parameters:
newTop- the new left extent.newBottom- the new bottom extent.- Returns:
- a rectangle of the changed height.
-
leftWidth
Returns aRectrepresenting the change in width of this object by the givenUnitSpanextents.- Parameters:
newLeft- the new left extent.newWidth- the new width.- Returns:
- a rectangle of the changed width.
-
rightWidth
Returns aRectrepresenting the change in width of this object by the givenUnitSpanextents.- Parameters:
newRight- the new right extent.newWidth- the new width.- Returns:
- a rectangle of the changed width.
-
topHeight
Returns aRectrepresenting the change in height of this object by the givenUnitSpanextents.- Parameters:
newTop- the new top extent.newHeight- the new height.- Returns:
- a rectangle of the changed height.
-
bottomHeight
Returns aRectrepresenting the change in height of this object by the givenUnitSpanextents.- Parameters:
newBottom- the new bottom extent.newHeight- the new height.- Returns:
- a rectangle of the changed height.
-
topLeft
Gets this object's top left coordinate.- Returns:
- the top left coordinate.
-
topRight
Gets this object's top right coordinate.- Returns:
- the top right coordinate.
-
bottomLeft
Gets this object's bottom left coordinate.- Returns:
- the bottom left coordinate.
-
bottomRight
Gets this object's bottom right coordinate.- Returns:
- the bottom right coordinate.
-
changeUnits
Returns aRectrepresenting the change of this object's unit span units to the given unit code.- Parameters:
eNewUnits- the new unit code.- Returns:
- a rectangle of the change.
-
topLeft
Returns aRectrepresenting the extention of this object using the given top leftCoordPair.- Parameters:
newTopLeft- the new top left coordinate.- Returns:
- a rectangle of the extention.
-
topRight
Returns aRectrepresenting the extention of this object using the given top rightCoordPair.- Parameters:
newTopRight- the new top right coordinate.- Returns:
- a rectangle of the extention.
-
bottomLeft
Returns aRectrepresenting the extention of this object using the given bottom leftCoordPair.- Parameters:
newBottomLeft- the new bottom left coordinate.- Returns:
- a rectangle of the extention.
-
bottomRight
Returns aRectrepresenting the extention of this object using the given bottom rightCoordPair.- Parameters:
newBottomRight- the new bottom right coordinate.- Returns:
- a rectangle of the extention.
-
height
Gets this object's height.- Returns:
- the height.
-
width
Gets this object's width.- Returns:
- the width.
-
height
Returns aRectrepresenting the stretch in height of this object by the givenUnitSpan.- Parameters:
newHeight- the new height.bStretchTop- stretch from the top when set; stretch from the bottom when not set.- Returns:
- a rectangle of the stretched height.
-
width
Returns aRectrepresenting the stretch in width of this object by the givenUnitSpan.- Parameters:
newWidth- the new width.bStretchLeft- stretch from the left when set; stretch from the right when not set.- Returns:
- a rectangle of the stretched width.
-
centre
Gets this object's centre coordinate.- Returns:
- the center of the rectangle.
-
contains
Determines if this object contains the givenCoordPair.- Parameters:
point- a coordinate.- Returns:
- true if the coordinate is contained, false otherwise
-
contains
Determines if this object contains the givenRect.- Parameters:
rect- a rectangle.- Returns:
- true if given the rectangle is contained, false otherwise
-
overlaps
Determines if this object overlaps the givenRect.- Parameters:
rect- a rectangle.- Returns:
- true if the rectangle overlaps, false otherwise
-
disjoint
Determines if this object is disjoint from the givenRect. This is slightly different than the result of! overlaps()in that, if the rectangles share an edge, this will return true.- Parameters:
rect- a rectangle.- Returns:
- true if the rectangle is disjoint, false otherwise
- See Also:
-
isDegenerate
public boolean isDegenerate()Determines if this object is degenerate. Only the zero rectangle is degenerate.- Returns:
- true if this rectangle is degenerate, false otherwise
- See Also:
-
rotate
Returns aRectrepresenting the rotation of this object about the givenCoordPairandAngleof rotation.- Parameters:
point- the point of rotation.angle- the angle of rotation.- Returns:
- a rectangle of the rotation.
-
equals
Determines if this object is equal to the givenObject. Comparisons with instances of non-Rectobjects are never equal. -
hashCode
public int hashCode() -
notEquals
Determines if this object is not equal to the givenObject. Comparisons with instances of non-Rectobjects are always not equal.- Parameters:
compare- theObjectto compare.- Returns:
- true if not equal, false otherwise
-
add
Returns aRectrepresenting the shift of this object by the givenCoordPair.- Parameters:
add- theCoordPairto add.- Returns:
- a rectangle of the shift.
-
subtract
Returns aRectrepresenting the shift of this object and the givenCoordPair.- Parameters:
subtract- theCoordPairto subtract.- Returns:
- a rectangle of the shift.
-
union
Returns aRectrepresenting the union of this object with the givenRect.- Parameters:
union- theRectto unite with.- Returns:
- a rectangle of the union.
-
intersection
Returns aRectrepresenting the intersection of this object with the givenRect.- Parameters:
intersect- theRectto intersect with.- Returns:
- a rectangle of the intersection.
-
zero
The zero rectangle.- Returns:
- the rectangle equal to zero.
-