|
TinyLine v2.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tinyline.tiny2d.TinyPath
The TinyPath class represents a geometric path constructed from straight lines, and quadratic and cubic (Bézier) curves. Paths are used to represent lines, curves and regions. A path consists of a series of path segments. Path segments may be staright lines or quadratic and cubic(Bézier) curves. It can contain multiple subpaths.
Multiple subpaths can be expressed by using a "moveTo" segment operator to create a discontinuity in the geometry to move from the end of one subpath to the beginning of the next.
| Field Summary | |
static byte |
TYPE_CLOSE
The segment type constant for a closePath. |
static byte |
TYPE_CURVETO
The segment type constant for a curveTo. |
static byte |
TYPE_CURVETO_CUBIC
The segment type constant for a curveTo. |
static byte |
TYPE_LINETO
The segment type constant for a lineTo. |
static byte |
TYPE_MOVETO
The segment type constant for a moveTo. |
| Constructor Summary | |
TinyPath(int i)
Constructs a new TinyPath object with the specified initial capacity to store path coordinates. |
|
TinyPath(TinyPath tinypath)
Constructs a new TinyPath object as a copy of the given source 'tinypath' object. |
|
| Method Summary | |
void |
addPoint(int x,
int y,
byte t)
Adds a segment to the TinyPath. |
void |
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo. |
void |
compact()
Compacts the TinyPath object data storage. |
void |
curveTo(int x2,
int y2,
int x3,
int y3)
Adds a Bézier curve to the TinyPath between the current point to (x3,y3) using the current point and (x2,y2) as Bézier control point. |
void |
curveToCubic(int x1,
int y1,
int x2,
int y2,
int x3,
int y3)
Adds a Bézier curve to the TinyPath between the current point to (x3,y3) using the current point and (x1,y1), (x2,y2) as Bézier control points. |
TinyRect |
getBBox()
Returns the bounding box of the TinyPath. |
TinyPoint |
getCurrentPoint()
Returns the coordinates most recently added to the end of the path as a TinyPoint object. |
byte |
getType(int i)
Returns the type of the path segment at the specified index. |
int |
getX(int i)
Returns the X coordinate of the path segment at the specified index. |
int |
getY(int i)
Returns the Y coordinate of the path segment at the specified index. |
void |
lineTo(int x,
int y)
Adds a straight line segment from the current point to (x,y). |
void |
moveTo(int x,
int y)
Moves the current point to (x,y) |
int |
numPoints()
Returns the number of points in the path. |
void |
reset()
Resets the path to empty. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final byte TYPE_MOVETO
public static final byte TYPE_LINETO
public static final byte TYPE_CURVETO
public static final byte TYPE_CURVETO_CUBIC
public static final byte TYPE_CLOSE
| Constructor Detail |
public TinyPath(int i)
i - initial capacitypublic TinyPath(TinyPath tinypath)
tinypath - the source TinyPath object.| Method Detail |
public void compact()
public void lineTo(int x,
int y)
x - The specified X coordinate.y - The specified Y coordinate.
public void moveTo(int x,
int y)
x - The specified X coordinate.y - The specified Y coordinate.public int numPoints()
public void reset()
public void closePath()
public void curveTo(int x2,
int y2,
int x3,
int y3)
x2 - the Bézier control point X coord.y2 - the Bézier control point Y coord.x3 - the final endpoint X coord.y3 - the final endpoint Y coord.
public void curveToCubic(int x1,
int y1,
int x2,
int y2,
int x3,
int y3)
x1 - the first Bézier control point X coord.y1 - the first Bézier control point Y coord.x2 - the second Bézier control point X coord.y2 - the second Bézier control point Y coord.x3 - the final endpoint X coord.y3 - the final endpoint Y coord.public TinyRect getBBox()
public void addPoint(int x,
int y,
byte t)
x - the specified X coordinate.y - the specified Y coordinate.t - the segment typepublic TinyPoint getCurrentPoint()
TinyPoint object.
TinyPoint object containing the ending
coordinates of the path or null if there are no points
in the path.public int getX(int i)
i - an index into this path.
public int getY(int i)
i - an index into this path.
public byte getType(int i)
i - an index into this path.
|
TinyLine v2.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||