|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--agile2d.geom.VertexArray
A VertexArray is a special Shape, made of several simple primitives such as points, lines, triangles, quadrilaterals or convex polygons.
VertexArray manage a list of primitives and are rendered very efficiently by hardware accelerated graphics cards when they are available. A VertexArray can hold 9 types of primitives:
| Field Summary | |
static short |
MODE_INVALID
Constant for an invalid mode |
static short |
MODE_LINE_LOOP
Constant for the line loop mode |
static short |
MODE_LINE_STRIP
Constant for the line strip mode |
static short |
MODE_LINES
Constant for the lines mode |
static short |
MODE_POINTS
Constant for the points mode |
static short |
MODE_POLYGON
Constant for the polygon mode |
static short |
MODE_QUAD_STRIP
Constant for the quad strip mode |
static short |
MODE_QUADS
Constant for the quads mode |
static short |
MODE_TRIANGLE_FAN
Constant for the triangle fan mode |
static short |
MODE_TRIANGLE_STRIP
Constant for the triangle strip mode |
static short |
MODE_TRIANGLES
Constant for the triangles mode |
| Constructor Summary | |
VertexArray()
Constructor for VertexArray. |
|
VertexArray(int reserve)
Constructor for VertexArray. |
|
| Method Summary | |
void |
addLine(float[] coords)
Add a line. |
void |
addLine(float x1,
float y1,
float x2,
float y2)
Add a line. |
void |
addQuad(float[] coords)
Add a quadrilateral. |
void |
addQuad(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
Add a quadrilateral. |
void |
addRect(float x,
float y,
float w,
float h)
Add a quadrilateral specified as a rectangle. |
void |
addTriangle(float[] coords)
Add a triangle. |
void |
addTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Add a triangle. |
void |
addVertex(double[] coords)
Add a vertex |
void |
addVertex(double x,
double y)
Add a vertex |
void |
addVertex(float[] coords)
Add a vertex |
void |
addVertex(float x,
float y)
Add a vertex |
void |
clear()
Clear the vertex. |
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(Point2D p)
|
boolean |
contains(Rectangle2D r)
|
void |
draw(Graphics g)
|
void |
draw(Graphics g,
VertexAttributes va)
|
void |
drawSmooth(Graphics2D g,
PolygonShape s,
VertexAttributes ca,
int index)
|
void |
fill(Graphics g)
|
void |
fill(Graphics g,
VertexAttributes va)
|
void |
fillSmooth(Graphics2D g,
PolygonShape s,
VertexAttributes ca,
int index)
|
Rectangle |
getBounds()
|
Rectangle2D |
getBounds2D()
|
int |
getCoordsCount()
Return the number of coordinates. |
float[] |
getData()
Return a copy of the array of coordinates. |
float[] |
getDataRef()
Return the array of coordinates. |
int |
getMode()
Returns the mode. |
PathIterator |
getPathIterator(AffineTransform at)
|
PathIterator |
getPathIterator(AffineTransform at,
double flatness)
|
void |
getVertex(int index,
float[] coords)
Return the coordinates of a specified vertex. |
int |
getVertexCount()
Return the number of vertices. |
boolean |
intersects(double x,
double y,
double w,
double h)
|
boolean |
intersects(Rectangle2D r)
|
static void |
render(VertexArray va,
gl4java.GLFunc gl)
Renders the VertexArray on a GL context. |
static void |
render(VertexArray va,
VertexAttributes ca,
gl4java.GLFunc gl)
|
void |
reserve(int size)
Make sure enough room is allocated to store as many coordinates. |
void |
setMode(int primitive)
Set the mode and clears the array. |
GeneralPath |
toGeneralPath()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final short MODE_INVALID
public static final short MODE_POINTS
public static final short MODE_LINES
public static final short MODE_LINE_STRIP
public static final short MODE_LINE_LOOP
public static final short MODE_TRIANGLES
public static final short MODE_TRIANGLE_STRIP
public static final short MODE_TRIANGLE_FAN
public static final short MODE_QUADS
public static final short MODE_QUAD_STRIP
public static final short MODE_POLYGON
| Constructor Detail |
public VertexArray(int reserve)
reserve - available number of coords before reallocation is
needer.public VertexArray()
| Method Detail |
public int getVertexCount()
public int getCoordsCount()
public float[] getData()
public float[] getDataRef()
public void clear()
public int getMode()
public void setMode(int primitive)
primitive - The mode to setpublic void reserve(int size)
size - the number of vertex coordinates to reserve.public void addVertex(double[] coords)
coords - an array of at least two double values.
public void addVertex(double x,
double y)
x - the X coordinatey - the Y coordinatepublic void addVertex(float[] coords)
coords - an array of at least two float values.
public void addVertex(float x,
float y)
x - the X coordinatey - the Y coordinate
public void getVertex(int index,
float[] coords)
index - the specified vertexcoords - an array where the coordinates will be stored.
ArrayIndexOutOfBoundsException - DOCUMENT ME!public void addLine(float[] coords)
coords - the two vertices (four coordinates) of the line.
public void addLine(float x1,
float y1,
float x2,
float y2)
x1 - the X coordinate of the first vertexy1 - the Y coordinate of the first vertexx2 - the X coordinate of the second vertexy2 - the Y coordinate of the second vertexpublic void addTriangle(float[] coords)
coords - the three vertices (six coordinates) of the triangle.
public void addTriangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
x1 - the X coordinate of the first vertexy1 - the Y coordinate of the first vertexx2 - the X coordinate of the second vertexy2 - the Y coordinate of the second vertexx3 - the X coordinate of the third vertexy3 - the Y coordinate of the third vertexpublic void addQuad(float[] coords)
coords - the four vertices (eight coordinates) of the quad.
public void addQuad(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
x1 - the X coordinate of the first vertexy1 - the Y coordinate of the first vertexx2 - the X coordinate of the second vertexy2 - the Y coordinate of the second vertexx3 - the X coordinate of the third vertexy3 - the Y coordinate of the third vertexx4 - the X coordinate of the fourth vertexy4 - the Y coordinate of the fourth vertex
public void addRect(float x,
float y,
float w,
float h)
x - the X coordinatey - the Y coordinatew - the widthh - the height
public boolean contains(double x,
double y,
double w,
double h)
contains in interface ShapeShape.contains(double, double, double, double)
public boolean contains(double x,
double y)
contains in interface ShapeShape.contains(double, double)public boolean contains(Point2D p)
contains in interface ShapeShape.contains(Point2D)public boolean contains(Rectangle2D r)
contains in interface ShapeShape.contains(Rectangle2D)public Rectangle getBounds()
getBounds in interface ShapeShape.getBounds()public Rectangle2D getBounds2D()
getBounds2D in interface ShapeShape.getBounds2D()public GeneralPath toGeneralPath()
public PathIterator getPathIterator(AffineTransform at,
double flatness)
getPathIterator in interface ShapeShape.getPathIterator(AffineTransform, double)public PathIterator getPathIterator(AffineTransform at)
getPathIterator in interface ShapeShape.getPathIterator(AffineTransform)
public boolean intersects(double x,
double y,
double w,
double h)
intersects in interface ShapeShape.intersects(double, double, double, double)public boolean intersects(Rectangle2D r)
intersects in interface ShapeShape.intersects(Rectangle2D)
public void drawSmooth(Graphics2D g,
PolygonShape s,
VertexAttributes ca,
int index)
public void draw(Graphics g)
public void draw(Graphics g,
VertexAttributes va)
public void fillSmooth(Graphics2D g,
PolygonShape s,
VertexAttributes ca,
int index)
public void fill(Graphics g)
public void fill(Graphics g,
VertexAttributes va)
public static void render(VertexArray va,
gl4java.GLFunc gl)
va - the VertexArraygl - the GL context
public static void render(VertexArray va,
VertexAttributes ca,
gl4java.GLFunc gl)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||