Package com.jogamp.opengl.util.packrect
Class Rect
java.lang.Object
com.jogamp.opengl.util.packrect.Rect
Represents a rectangular region on the backing store. The edges of
the rectangle are the infinitely thin region between adjacent
pixels on the screen. The origin of the rectangle is its
upper-left corner. It is inclusive of the pixels on the top and
left edges and exclusive of the pixels on the bottom and right
edges. For example, a rect at position (0, 0) and of size (1, 1)
would include only the pixel at (0, 0).
Negative coordinates and sizes are not supported, since they make no sense in the context of the packer, which deals only with positively sized regions.
This class contains a user data field for efficient hookup to external data structures as well as enough other hooks to efficiently plug into the rectangle packer.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canContain
(Rect other) int
h()
int
maxX()
Returns the maximum x-coordinate contained within this rectangle.int
maxY()
Returns the maximum y-coordinate contained within this rectangle.void
setNextLocation
(Rect nextLocation) void
setPosition
(int x, int y) void
setSize
(int w, int h) void
setUserData
(Object obj) toString()
int
w()
int
x()
int
y()
-
Constructor Details
-
Rect
public Rect() -
Rect
-
Rect
-
-
Method Details
-
x
public int x() -
y
public int y() -
w
public int w() -
h
public int h() -
getUserData
-
getNextLocation
-
setPosition
public void setPosition(int x, int y) -
setSize
- Throws:
IllegalArgumentException
-
setUserData
-
setNextLocation
-
maxX
public int maxX()Returns the maximum x-coordinate contained within this rectangle. Note that this returns a different result than Java 2D's rectangles; for a rectangle of position (0, 0) and size (1, 1) this will return 0, not 1. Returns -1 if the width of this rectangle is 0. -
maxY
public int maxY()Returns the maximum y-coordinate contained within this rectangle. Note that this returns a different result than Java 2D's rectangles; for a rectangle of position (0, 0) and size (1, 1) this will return 0, not 1. Returns -1 if the height of this rectangle is 0. -
canContain
-
toString
-