public class Viewport
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
height
The viewport's height.
|
int |
width
The viewport's width.
|
int |
x
The X component of the viewport's origin.
|
int |
y
The Y component of the viewport's origin.
|
Constructor and Description |
---|
Viewport()
Constructs an empty viewport width X, Y, width and height all zero.
|
Viewport(int x,
int y,
int width,
int height)
Constructs a viewport with a specified origin and dimensions.
|
Viewport(Viewport viewport)
Constructs a viewport with the origin and dimensions of a specified viewport.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Indicates whether this viewport contains a specified point.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
intersect(int x,
int y,
int width,
int height)
Computes the intersection of this viewport and a specified viewport, storing the result in this viewport and
returning whether or not the viewport intersect.
|
boolean |
intersect(Viewport viewport)
Computes the intersection of this viewport and a specified viewport, storing the result in this viewport and
returning whether or not the viewport intersect.
|
boolean |
intersects(int x,
int y,
int width,
int height)
Indicates whether this viewport intersects a specified viewport.
|
boolean |
intersects(Viewport viewport)
Indicates whether this viewport intersects a specified viewport.
|
boolean |
isEmpty()
Indicates whether or not this viewport is empty.
|
Viewport |
set(int x,
int y,
int width,
int height)
Sets this viewport to the specified origin and dimensions.
|
Viewport |
set(Viewport viewport)
Sets this viewport to the origin and dimensions of a specified viewport.
|
Viewport |
setEmpty()
Sets this viewport to an empty viewport.
|
java.lang.String |
toString() |
public int x
public int y
public int width
public int height
public Viewport()
public Viewport(int x, int y, int width, int height)
x
- the X component of the viewport's lower left cornery
- the Y component of the viewport's lower left cornerwidth
- the viewport's widthheight
- the viewport's heightpublic Viewport(Viewport viewport)
viewport
- the viewport specifying the valuesjava.lang.IllegalArgumentException
- If the viewport is nullpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public Viewport set(int x, int y, int width, int height)
x
- the new X component of the viewport's lower left cornery
- the new Y component of the viewport's lower left cornerwidth
- the viewport's new widthheight
- the viewport's new heightpublic Viewport set(Viewport viewport)
viewport
- the viewport specifying the new valuesjava.lang.IllegalArgumentException
- If the viewport is nullpublic Viewport setEmpty()
public boolean isEmpty()
public boolean intersects(int x, int y, int width, int height)
x
- the X component of the viewport to test intersection withy
- the Y component of the viewport to test intersection withwidth
- the viewport width to test intersection withheight
- the viewport height to test intersection withpublic boolean intersects(Viewport viewport)
viewport
- the viewport to test intersection withjava.lang.IllegalArgumentException
- If the viewport is nullpublic boolean intersect(int x, int y, int width, int height)
intersects(int, int, int, int)
.x
- the X component of the viewport to intersect withy
- the Y component of the viewport to intersect withwidth
- the viewport width to intersect withheight
- the viewport height to intersect withpublic boolean intersect(Viewport viewport)
intersects(int, int, int, int)
.viewport
- the viewport to intersect withjava.lang.IllegalArgumentException
- If the viewport is nullpublic boolean contains(int x, int y)
x
- the point's X componenty
- the point's Y component