|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcrystalspace.jbind.impl.csNativeObject
crystalspace.jbind.impl.csgeom.csrect.csRect
Rectangle class: simple class for manipulating 2D rectangles. This class is somewhat similar to Box, but uses integer coordinates.
| Field Summary |
| Fields inherited from class crystalspace.jbind.impl.csNativeObject |
ImplFactory, nPointer |
| Constructor Summary | |
csRect()
Create a empty rectangle. |
|
csRect(csRect copy)
Copy constructor. |
|
csRect(int ixmin,
int iymin,
int ixmax,
int iymax)
Create a new rectangle. |
|
csRect(iPointer nPointer)
Create a java csRect object which points to the native csRect nPointer. |
|
| Method Summary | |
void |
addAdjanced(csRect rect)
Add an adjanced rectangle if resulting rectangle will have larger area. |
int |
area()
Return area of this rectangle. |
boolean |
clipLine(int x1,
int y1,
int x2,
int y2)
Clip a line to make it fit to this rectangle. |
boolean |
clipLineGeneral(int x1,
int y1,
int x2,
int y2)
This function is the same as ClipLine() except that it doesn't check for two trivial cases (horizontal and vertical lines). |
boolean |
clipLineSafe(int x1,
int y1,
int x2,
int y2)
Clip a line to make it fit to this rectangle. |
boolean |
contains(int x,
int y)
Return true if a point lies within rectangle bounds. |
boolean |
containsRel(int x,
int y)
Return true if a relative point lies within rectangle bounds. |
boolean |
equal(int ixmin,
int iymin,
int ixmax,
int iymax)
Return true if rectangle is the same. |
boolean |
equals(csRect other)
Same but compare with another csRect. |
boolean |
equals(java.lang.Object rect)
Test equality of two rectangles. |
void |
exclude(csRect other)
Same but works on a csRect argument. |
void |
exclude(int ixmin,
int iymin,
int ixmax,
int iymax)
Subtract rectangle: find the minimal rectangle which embeds all parts of this rectangle which are not covered by given rectangle. |
void |
extend(int x,
int y)
Extend rectangle so that it will include given point. |
int |
height()
Return the height of rectangle. |
void |
inset(int n)
Contracts the whole rect by n units. |
void |
intersect(csRect other)
Intersect with another rectangle. |
void |
intersect(int ixmin,
int iymin,
int ixmax,
int iymax)
Intersect with another rectangle. |
boolean |
intersects(csRect target)
Return true if rectangle intersects with target. |
boolean |
isEmpty()
Return true if rectangle is empty. |
protected boolean |
isNativePointerValidSafe(long nPointer)
|
void |
join(csRect rect)
Joins two rects by their minimum and maximum bounds. |
void |
makeEmpty()
Make rectangle empty. |
void |
move(int dX,
int dY)
Move rectangle by deltaX, deltaY. |
protected void |
nDelete(long pointer)
|
boolean |
nEquals(csRect rect)
Test inequality of two rectangles. |
void |
normalize()
Normalize a rectangle such that xmin <= xmax and ymin <= ymax. |
void |
outset(int n)
Expands the whole rect by n units. |
void |
set(csRect target)
Copy rectangle. |
void |
set(int ixmin,
int iymin,
int ixmax,
int iymax)
Set rectangle to given ixmin,iymin,ixmax,iymax position. |
void |
setPos(int x,
int y)
Set rectangle xmin,ymin position. |
void |
setSize(int w,
int h)
Set rectangle size. |
void |
setXmax(int xmax)
Rectangle bounds. |
void |
setXmin(int xmin)
Rectangle bounds. |
void |
setYmax(int ymax)
Rectangle bounds. |
void |
setYmin(int ymin)
Rectangle bounds. |
void |
subtract(csRect rect)
Alternative subtraction: find maximal area of this rectangle that is not covered by argument. |
void |
union(csRect other)
Add a rectangle: find minimal rectangle that embeds both given rectangles. |
void |
union(int ixmin,
int iymin,
int ixmax,
int iymax)
Add a rectangle: find minimal rectangle that embeds both given rectangles. |
int |
width()
Return the width of rectangle. |
int |
xmax()
Rectangle bounds. |
int |
xmin()
Rectangle bounds. |
int |
ymax()
Rectangle bounds. |
int |
ymin()
Rectangle bounds. |
| Methods inherited from class crystalspace.jbind.impl.csNativeObject |
changePointer, finalize, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString |
| Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public csRect(iPointer nPointer)
nPointer - public csRect()
public csRect(int ixmin,
int iymin,
int ixmax,
int iymax)
ixmin - iymin - ixmax - iymax - public csRect(csRect copy)
copy - | Method Detail |
protected void nDelete(long pointer)
nDelete in class csNativeObjectcsNativeObject.nDelete(long)protected boolean isNativePointerValidSafe(long nPointer)
isNativePointerValidSafe in class csNativeObjectcrystalspace.jbind.impl.csNativeObject#isNativePointerValidSafe()
public final void intersect(int ixmin,
int iymin,
int ixmax,
int iymax)
ixmin - iymin - ixmax - iymax - public final void intersect(csRect other)
other - public final boolean intersects(csRect target)
target -
public final void union(int ixmin,
int iymin,
int ixmax,
int iymax)
ixmin - iymin - ixmax - iymax - public final void union(csRect other)
other -
public final void exclude(int ixmin,
int iymin,
int ixmax,
int iymax)
ixmin - iymin - ixmax - iymax - public final void exclude(csRect other)
other - public final void subtract(csRect rect)
rect - public final boolean isEmpty()
public final void makeEmpty()
public final void set(int ixmin,
int iymin,
int ixmax,
int iymax)
ixmin - iymin - ixmax - iymax - public final void set(csRect target)
target -
public final void setPos(int x,
int y)
x - y -
public final void setSize(int w,
int h)
w - h -
public final void move(int dX,
int dY)
dX - dY - public final int width()
public final int height()
public final boolean contains(int x,
int y)
x - y -
public final boolean containsRel(int x,
int y)
x - y -
public final boolean equal(int ixmin,
int iymin,
int ixmax,
int iymax)
ixmin - iymin - ixmax - iymax -
public final boolean equals(csRect other)
other -
public final void normalize()
public final int area()
public final void addAdjanced(csRect rect)
rect - public final boolean equals(java.lang.Object rect)
equals in class csNativeObjectrect -
Object.equals(java.lang.Object)public final boolean nEquals(csRect rect)
rect -
public final void extend(int x,
int y)
x - y - public final void join(csRect rect)
rect - public final void outset(int n)
n - public final void inset(int n)
n -
public final boolean clipLineGeneral(int x1,
int y1,
int x2,
int y2)
x1 - y1 - x2 - y2 -
public final boolean clipLine(int x1,
int y1,
int x2,
int y2)
x1 - y1 - x2 - y2 -
public final boolean clipLineSafe(int x1,
int y1,
int x2,
int y2)
x1 - y1 - x2 - y2 -
public final int xmin()
public final void setXmin(int xmin)
xmin - public final int ymin()
public final void setYmin(int ymin)
ymin - public final int xmax()
public final void setXmax(int xmax)
xmax - public final int ymax()
public final void setYmax(int ymax)
ymax -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||