Package com.jogamp.nativewindow.util
Class Rectangle
java.lang.Object
com.jogamp.nativewindow.util.Rectangle
- All Implemented Interfaces:
com.jogamp.common.type.WriteCloneable,RectangleImmutable,Cloneable,Comparable<RectangleImmutable>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares square of size 1st, if equal the square of position.final floatReturns the coverage of given rectangle w/ this this one, i.e.booleanChecks whether two rect objects are equal.final intfinal intgetWidth()final intgetX()final intgetY()inthashCode()final RectangleImmutableintersection(int rx1, int ry1, int rx2, int ry2) Returns the intersection of this rectangleand the given coordinates.final RectangleImmutableReturns the intersection of this rectangleand the given rectangle.final Rectanglescale(int sx, int sy) Scale this instance's components, i.e.final RectanglescaleInv(int sx, int sy) Inverse scale this instance's components, i.e.final voidset(int x, int y, int width, int height) final voidfinal voidfinal voidsetHeight(int height) final voidsetWidth(int width) final voidsetX(int x) final voidsetY(int y) toString()final RectangleImmutableunion(int rx1, int ry1, int rx2, int ry2) Returns the union of this rectangleand the given coordinates.final RectangleImmutableReturns the union of this rectangle and the given rectangle.final Rectangleunion(List<RectangleImmutable> rectangles) Calculates the union of the given rectangles, stores it in this instance and returns this instance.
-
Constructor Details
-
Rectangle
public Rectangle() -
Rectangle
public Rectangle(int x, int y, int width, int height) -
Rectangle
-
-
Method Details
-
cloneMutable
- Specified by:
cloneMutablein interfacecom.jogamp.common.type.WriteCloneable
-
getX
public final int getX()- Specified by:
getXin interfaceRectangleImmutable
-
getY
public final int getY()- Specified by:
getYin interfaceRectangleImmutable
-
getWidth
public final int getWidth()- Specified by:
getWidthin interfaceRectangleImmutable
-
getHeight
public final int getHeight()- Specified by:
getHeightin interfaceRectangleImmutable
-
set
public final void set(int x, int y, int width, int height) -
set
-
set
-
setX
public final void setX(int x) -
setY
public final void setY(int y) -
setWidth
public final void setWidth(int width) -
setHeight
public final void setHeight(int height) -
union
Description copied from interface:RectangleImmutableReturns the union of this rectangle and the given rectangle.- Specified by:
unionin interfaceRectangleImmutable
-
union
Description copied from interface:RectangleImmutableReturns the union of this rectangleand the given coordinates.- Specified by:
unionin interfaceRectangleImmutable
-
union
Calculates the union of the given rectangles, stores it in this instance and returns this instance.- Parameters:
rectangles- given list of rectangles- Returns:
- this instance holding the union of given rectangles.
-
intersection
Description copied from interface:RectangleImmutableReturns the intersection of this rectangleand the given rectangle.- Specified by:
intersectionin interfaceRectangleImmutable
-
intersection
Description copied from interface:RectangleImmutableReturns the intersection of this rectangleand the given coordinates.- Specified by:
intersectionin interfaceRectangleImmutable
-
coverage
Description copied from interface:RectangleImmutableReturns the coverage of given rectangle w/ this this one, i.e. between0.0and1.0.Coverage is computed by:
isect = this.intersection(r); coverage = area( isect ) / area( this ) ;- Specified by:
coveragein interfaceRectangleImmutable
-
scale
Scale this instance's components, i.e. multiply them by the given scale factors.- Parameters:
sx- scale factor for xsy- scale factor for y- Returns:
- this instance for scaling
-
scaleInv
Inverse scale this instance's components, i.e. divide them by the given scale factors.- Parameters:
sx- inverse scale factor for xsy- inverse scale factor for y- Returns:
- this instance for scaling
-
compareTo
Description copied from interface:RectangleImmutableCompares square of size 1st, if equal the square of position.
- Specified by:
compareToin interfaceComparable<RectangleImmutable>- Specified by:
compareToin interfaceRectangleImmutable
-
equals
Description copied from interface:RectangleImmutableChecks whether two rect objects are equal. Two instances ofRectangleare equal if the four integer values of the fieldsy,x,height, andwidthare all equal.- Specified by:
equalsin interfaceRectangleImmutable- Overrides:
equalsin classObject- Returns:
trueif the two rectangles are equal; otherwisefalse.
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceRectangleImmutable- Overrides:
hashCodein classObject
-
toString
-