| java.lang.Object com.sun.perseus.j2d.Path
Path | public class Path implements SVGPath(Code) | | Class for Path Data.
version: $Id: Path.java,v 1.7 2006/04/21 06:35:11 st125089 Exp $ |
Field Summary | |
final public static int | CLOSE_IMPL The internal value for close commands. | final public static int[] | COMMAND_OFFSET Delta offset for each command type. | final public static byte | CURVE_TO_IMPL The internal value for curveTo commands. | final static int | INITIAL_COMMAND_CAPACITY The default initial number of commands. | final static int | INITIAL_DATA_CAPACITY The default initial number of data entries. | final public static byte | LINE_TO_IMPL | final public static byte | MOVE_TO_IMPL The internal value for moveTo commands. | final public static byte | QUAD_TO_IMPL | final public static int | WIND_EVEN_ODD The event-odd winding rule. | final public static int | WIND_NON_ZERO The non-zero winding rule. | protected byte[] | commands An array storing the path command types. | protected float[] | data An array storing the path data. | protected int | lastCmdIndex Keeps track of the last requested command index. | protected int | lastOffset The offset in the data array for the last requested command. | protected int | nData The number of used entries in the data array. | protected int | nSegments The current number of segments. |
Constructor Summary | |
public | Path() Default constructor. | public | Path(int commandCapacity, int dataCapacity) Initial constructor. | public | Path(Path model) Copy constructor. |
Method Summary | |
final int | checkOffset(int cmdIndex) Implementation helper. | public void | close() | public void | curveTo(float x1, float y1, float x2, float y2, float x3, float y3) | public boolean | equals(Object obj) | public Box | getBounds() Compute the path's bounds. | public byte[] | getCommands() | public float[] | getData() | public int | getNumberOfSegments() | public short | getSegment(int cmdIndex) | public float | getSegmentParam(int cmdIndex, int paramIndex) | public Box | getTransformedBounds(Transform t) Compute the path's bounds in the transformed coordinate system. | public void | lineTo(float x, float y) | public void | moveTo(float x, float y) | void | newCommand(int nPoints) Adjust the internal arrays for the requested number of points. | public void | quadTo(float x1, float y1, float x2, float y2) | public void | setData(float[] newData) Parameters: newData - the new path data. | public String | toPointsString() a string descriton of this Path using the points syntax. | public String | toPointsString(float[] d) Parameters: d - the set of data values to use for the string conversion. | static short | toSVGPathCommand(int command) | public String | toString() | public String | toString(float[] d) Parameters: d - the set of data values to use for the string conversion. |
CLOSE_IMPL | final public static int CLOSE_IMPL(Code) | | The internal value for close commands.
|
COMMAND_OFFSET | final public static int[] COMMAND_OFFSET(Code) | | Delta offset for each command type.
2 for moveto and lineto.
4 for quadto.
6 for curveto.
0 for close.
|
CURVE_TO_IMPL | final public static byte CURVE_TO_IMPL(Code) | | The internal value for curveTo commands.
|
INITIAL_COMMAND_CAPACITY | final static int INITIAL_COMMAND_CAPACITY(Code) | | The default initial number of commands.
|
INITIAL_DATA_CAPACITY | final static int INITIAL_DATA_CAPACITY(Code) | | The default initial number of data entries.
|
LINE_TO_IMPL | final public static byte LINE_TO_IMPL(Code) | | The internal value for lineTo commands
|
MOVE_TO_IMPL | final public static byte MOVE_TO_IMPL(Code) | | The internal value for moveTo commands.
|
QUAD_TO_IMPL | final public static byte QUAD_TO_IMPL(Code) | | The internal value for quadTo commands
|
WIND_EVEN_ODD | final public static int WIND_EVEN_ODD(Code) | | The event-odd winding rule.
|
WIND_NON_ZERO | final public static int WIND_NON_ZERO(Code) | | The non-zero winding rule.
|
commands | protected byte[] commands(Code) | | An array storing the path command types. One of MOVE_TO_IMPL,
LINE_TO_IMPL, QUAD_TO_IMPL, CURVE_TO_IMPL.
|
data | protected float[] data(Code) | | An array storing the path data. The array is a list of even
length made of consecutive x/y coordinate pairs.
|
lastCmdIndex | protected int lastCmdIndex(Code) | | Keeps track of the last requested command index.
|
lastOffset | protected int lastOffset(Code) | | The offset in the data array for the last requested command.
This is used to minimize the computation of the offset
in getSegmentParam.
|
nData | protected int nData(Code) | | The number of used entries in the data array.
|
nSegments | protected int nSegments(Code) | | The current number of segments.
|
Path | public Path()(Code) | | Default constructor. The initial capacity is defined by
the INITIAL_COMMAND_CAPACITY and INITIAL_DATA_CAPACITY
static variables.
|
Path | public Path(int commandCapacity, int dataCapacity)(Code) | | Initial constructor. The initial capacity is defined by
the capacity parameters.
Parameters: commandCapacity - the number of intended commands for this object. Must be positive or zero. Parameters: dataCapacity - the number of intended data parametersfor this object. Must be positive or zero. |
Path | public Path(Path model)(Code) | | Copy constructor.
Parameters: model - the Path object to duplicate. |
checkOffset | final int checkOffset(int cmdIndex)(Code) | | Implementation helper. Sets the lastCmdIndex to the requested index
after computing the offset corresponding to that index.
Parameters: cmdIndex - the new index for which the offset should be computed. |
close | public void close()(Code) | | |
curveTo | public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)(Code) | | |
equals | public boolean equals(Object obj)(Code) | | true if obj is a path and all its commands are the same as this instance. |
getBounds | public Box getBounds()(Code) | | Compute the path's bounds.
the path's bounds. |
getCommands | public byte[] getCommands()(Code) | | this path's commands data. |
getData | public float[] getData()(Code) | | this path's data. |
getNumberOfSegments | public int getNumberOfSegments()(Code) | | |
getSegmentParam | public float getSegmentParam(int cmdIndex, int paramIndex) throws DOMException(Code) | | |
getTransformedBounds | public Box getTransformedBounds(Transform t)(Code) | | Compute the path's bounds in the transformed coordinate system.
|
lineTo | public void lineTo(float x, float y)(Code) | | |
moveTo | public void moveTo(float x, float y)(Code) | | |
newCommand | void newCommand(int nPoints)(Code) | | Adjust the internal arrays for the requested number of points.
Parameters: nParams - the number of points to add to the array. |
quadTo | public void quadTo(float x1, float y1, float x2, float y2)(Code) | | |
setData | public void setData(float[] newData)(Code) | | Parameters: newData - the new path data. The Path is only guaranteed to work afterthis method is invoked if the input data array has at least as manyentries as the current path data array and if each entry is a float array of at least two values. |
toPointsString | public String toPointsString()(Code) | | a string descriton of this Path using the points syntax. Thismethods throws an IllegalStateException if the path does not have the commands corresponding to the points syntax (initial move to followedby linetos and closes |
toPointsString | public String toPointsString(float[] d)(Code) | | Parameters: d - the set of data values to use for the string conversion. Thiswill fail if the input data array does not have an even number of values. a string descriton of this Path using the points syntax. Thismethods throws an IllegalStateException if the path does not have thecommands corresponding to the points syntax (initial move to followed bylinetos and closes |
toSVGPathCommand | static short toSVGPathCommand(int command)(Code) | | |
toString | public String toString()(Code) | | a String representation of this path, using the SVG notation. |
toString | public String toString(float[] d)(Code) | | Parameters: d - the set of data values to use for the string conversion. Thiswill fail if the input data array does not have at least nData entries of at least 2 values. a String representation of this path, using the SVG notation. |
|
|