public class LinePath
extends Object
LinePath
class allows to represent polygonal paths,
potentially composed by several disjoint polygonal segments.
It can be iterated by the LinePath.PathIterator
class including all
of its segment types and winding rulesModifier and Type | Class and Description |
---|---|
static class |
LinePath.PathIterator |
Modifier and Type | Field and Description |
---|---|
static int |
CAP_BUTT
Ends unclosed subpaths and dash segments with no added decoration.
|
static int |
CAP_ROUND
Ends unclosed subpaths and dash segments with a round decoration that has a
radius equal to half of the width of the pen.
|
static int |
CAP_SQUARE
Ends unclosed subpaths and dash segments with a square projection that
extends beyond the end of the segment to a distance equal to half of the
line width.
|
static int |
JOIN_BEVEL
Joins path segments by connecting the outer corners of their wide outlines
with a straight segment.
|
static int |
JOIN_MITER
Joins path segments by extending their outside edges until they meet.
|
static int |
JOIN_ROUND
Joins path segments by rounding off the corner at a radius of half the line
width.
|
static byte |
SEG_CLOSE
Closes segment at current position.
|
static byte |
SEG_LINETO
Extends segment by adding a line to a given position.
|
static byte |
SEG_MOVETO
Starts segment at a given position.
|
static int |
WIND_EVEN_ODD
The winding rule constant for specifying an even-odd rule
for determining the interior of a path.
|
static int |
WIND_NON_ZERO
The winding rule constant for specifying a non-zero rule
for determining the interior of a path.
|
Constructor and Description |
---|
LinePath()
Constructs a new empty single precision
LinePath object with a
default winding rule of WIND_NON_ZERO . |
LinePath(int rule)
Constructs a new empty single precision
LinePath object with the
specified winding rule to control operations that require the interior of
the path to be defined. |
LinePath(int rule,
int initialCapacity)
Constructs a new
LinePath object from the given specified initial
values. |
Modifier and Type | Method and Description |
---|---|
void |
closePath()
Closes the current subpath by drawing a straight line back to the
coordinates of the last
moveTo . |
static byte[] |
copyOf(byte[] source,
int length) |
static float[] |
copyOf(float[] source,
int length) |
static int[] |
copyOf(int[] source,
int length) |
static LinePath |
createStrokedPath(LinePath src,
float weight,
int caps,
int join) |
static LinePath |
createStrokedPath(LinePath src,
float weight,
int caps,
int join,
float miterlimit) |
static LinePath |
createStrokedPath(LinePath src,
float weight,
int caps,
int join,
float miterlimit,
PMatrix2D transform)
Constructs a solid
LinePath with the specified attributes. |
LinePath.PathIterator |
getPathIterator()
The iterator for this class is not multi-threaded safe, which means that
the
LinePath class does not guarantee that modifications to the
geometry of this LinePath object do not affect any iterations of that
geometry that are already in process. |
int |
getWindingRule()
Returns the fill style winding rule.
|
static double |
hypot(double x,
double y) |
static int |
hypot(int x,
int y) |
static long |
hypot(long x,
long y) |
static int |
isqrt(int x) |
void |
lineTo(float x,
float y,
int c)
Adds a point to the path by drawing a straight line from the current
coordinates to the new specified coordinates specified in float precision.
|
static long |
lsqrt(long x) |
void |
moveTo(float x,
float y,
int c)
Adds a point to the path by moving to the specified coordinates specified
in float precision.
|
void |
reset()
Resets the path to empty.
|
void |
setWindingRule(int rule)
Sets the winding rule for this path to the specified value.
|
public static final int WIND_EVEN_ODD
public static final int WIND_NON_ZERO
public static final byte SEG_MOVETO
public static final byte SEG_LINETO
public static final byte SEG_CLOSE
public static final int JOIN_MITER
public static final int JOIN_ROUND
public static final int JOIN_BEVEL
public static final int CAP_BUTT
public static final int CAP_ROUND
public static final int CAP_SQUARE
public LinePath()
LinePath
object with a
default winding rule of WIND_NON_ZERO
.public LinePath(int rule)
LinePath
object with the
specified winding rule to control operations that require the interior of
the path to be defined.rule
- the winding ruleWIND_EVEN_ODD
,
WIND_NON_ZERO
public LinePath(int rule, int initialCapacity)
LinePath
object from the given specified initial
values. This method is only intended for internal use and should not be
made public if the other constructors for this class are ever exposed.rule
- the winding ruleinitialCapacity
- the size to make the initial array to store the path segment typespublic final void moveTo(float x, float y, int c)
This method provides a single precision variant of the double precision
moveTo()
method on the base LinePath
class.
x
- the specified X coordinatey
- the specified Y coordinatemoveTo(float, float, int)
public final void lineTo(float x, float y, int c)
This method provides a single precision variant of the double precision
lineTo()
method on the base LinePath
class.
x
- the specified X coordinatey
- the specified Y coordinatelineTo(float, float, int)
public LinePath.PathIterator getPathIterator()
LinePath
class does not guarantee that modifications to the
geometry of this LinePath
object do not affect any iterations of that
geometry that are already in process.public final void closePath()
moveTo
. If the path is already closed then
this method has no effect.public final int getWindingRule()
WIND_EVEN_ODD
,
WIND_NON_ZERO
,
setWindingRule(int)
public final void setWindingRule(int rule)
rule
- an integer representing the specified winding ruleIllegalArgumentException
- if rule
is not either WIND_EVEN_ODD
or
WIND_NON_ZERO
getWindingRule()
public final void reset()
public static LinePath createStrokedPath(LinePath src, float weight, int caps, int join)
public static LinePath createStrokedPath(LinePath src, float weight, int caps, int join, float miterlimit)
public static LinePath createStrokedPath(LinePath src, float weight, int caps, int join, float miterlimit, PMatrix2D transform)
LinePath
with the specified attributes.src
- the original path to be strokedweight
- the weight of the stroked pathcaps
- the decoration of the ends of the segments in the pathjoin
- the decoration applied where path segments meetmiterlimit
- transform
- public static float[] copyOf(float[] source, int length)
public static byte[] copyOf(byte[] source, int length)
public static int[] copyOf(int[] source, int length)
public static int isqrt(int x)
public static long lsqrt(long x)
public static double hypot(double x, double y)
public static int hypot(int x, int y)
public static long hypot(long x, long y)