| Modifier and Type | Field and Description |
|---|---|
protected boolean |
absolute |
protected List<PathCommand> |
commands |
protected boolean |
curved |
protected double |
miterLimit |
protected boolean |
miterLimitDirty |
protected boolean |
pathDirty |
protected LineCap |
strokeLineCap |
protected boolean |
strokeLineCapDirty |
protected LineJoin |
strokeLineJoin |
protected boolean |
strokeLineJoinDirty |
clipRectangle, clipRectangleDirty, component, fill, fillDirty, fillOpacity, fillOpacityDirty, hidden, hiddenDirty, matrix, opacity, opacityDirty, rotation, scaling, stroke, strokeDirty, strokeOpacity, strokeOpacityDirty, strokeWidth, strokeWidthDirty, surface, transformDirty, translation, zIndex, zIndexDirty| Constructor and Description |
|---|
PathSprite()
Creates a path with no values.
|
PathSprite(CircleSprite sprite)
Creates a path sprite by converting the given
CircleSprite. |
PathSprite(EllipseSprite sprite)
Creates a path sprite by converting the given
EllipseSprite. |
PathSprite(PathSprite path)
Creates a copy of the given path.
|
PathSprite(RectangleSprite sprite)
Creates a path sprite by converting the given
RectangleSprite. |
PathSprite(TextSprite sprite)
Creates a path sprite by converting the given
TextSprite. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommand(int index,
PathCommand command)
Adds a
PathCommand to the path at the given index. |
void |
addCommand(PathCommand command)
Adds a
PathCommand to the path. |
void |
clearCommands()
Clears all
PathCommand in the path. |
void |
clearDirtyFlags()
Clears all of the dirty flags on the sprite.
|
protected PrecisePoint |
commandEnd(PathCommand command)
Returns the ending coordinates of the given
PathCommand. |
protected void |
commandEndSet(PrecisePoint point,
PathCommand command)
Sets the given point to the end of the given command.
|
PathSprite |
copy()
Returns a copy of the sprite.
|
static List<PathCommand> |
copyCommands(List<PathCommand> commands)
Returns a new list of
PathCommands by making copies of the given
commands. |
protected PreciseRectangle |
curveDimensions(PrecisePoint start,
CurveTo curve)
Determines the dimensions of the given
CurveTo command. |
PreciseRectangle |
dimensions()
Returns the calculated dimensions of the path.
|
protected ArrayList<PathCommand> |
ellipseCommands(double x,
double y,
double rx,
double ry)
Converts an ellipse to a set of
EllipticalArc commands. |
protected PrecisePoint |
findCurvePoint(PrecisePoint start,
CurveTo curve,
double t)
Finds the point on the curve given the time t using the cubic bezier
equation.
|
static List<PathSprite> |
findDelta(PathSprite origin,
List<PathCommand> commands)
Ensures
PathCommand parity between this path and the given path. |
protected PrecisePoint[] |
getAnchors(CurveTo curve,
double subsections)
Calculates new anchor points for the segment given the number of
subsections.
|
PathCommand |
getCommand(int index)
Returns the
PathCommand at the given index. |
List<PathCommand> |
getCommands()
Returns a
List of all the PathCommands in the sprite. |
double |
getMiterLimit()
Returns the miter limit of the path.
|
PathSprite |
getPathSprite()
Returns the
Sprite as a path. |
LineCap |
getStrokeLineCap()
Returns the shape to be used at the end of open subpaths when they are
stroked.
|
LineJoin |
getStrokeLineJoin()
Returns the
LineJoin of the path. |
boolean |
isAbsolute()
Returns true if all path commands are absolute.
|
boolean |
isCurved()
|
boolean |
isDirty()
Returns true if the sprite changed since the last render.
|
boolean |
isMiterLimitDirty()
Returns true if the miter limit changed since the last render.
|
boolean |
isPathDirty()
Returns true if the path changed since the last render.
|
boolean |
isStrokeLineCapDirty()
Returns true if the line cap changed since the last render.
|
boolean |
isStrokeLineJoinDirty()
Returns true if the line join changed since the last render.
|
PathSprite |
map(Matrix matrix)
Transforms the
PathSprite by the passed Matrix. |
protected ArrayList<PathCommand> |
rectangleCommands(PreciseRectangle rect,
double radius)
Converts the given rectangle to a set of
PathCommands. |
void |
removeCommand(int index)
Removes the
PathCommand at the given index. |
protected void |
setAbsolute(boolean absolute) |
void |
setCommand(int index,
PathCommand command)
Sets the
PathCommand of the path at given index. |
void |
setCommands(List<PathCommand> commands)
Replace the path's
PathCommands with the given List of
commands. |
protected static void |
setCurrentPoint(PathCommand command,
PrecisePoint currentPoint,
PrecisePoint curvePoint)
Updates the current point of the path using the given command.
|
protected void |
setCurved(boolean curved) |
void |
setMiterLimit(double miterLimit)
Sets miter limit of the path.
|
void |
setStrokeLineCap(LineCap strokeLineCap)
Sets the
LineCap of the path. |
void |
setStrokeLineJoin(LineJoin strokeLineJoin)
Sets the
LineJoin of the path. |
int |
size()
Returns the number of
PathCommands added to the sprite. |
PathSprite |
toAbsolute()
Returns the path converted to only absolute
PathCommands. |
PathSprite |
toCurve()
|
PathSprite |
toSmooth(int subsections)
Returns the path smoothed by increasing the number of subsections.
|
String |
toString() |
getBBox, getClipRectangle, getComponent, getFill, getFillOpacity, getOpacity, getRotation, getScaling, getStroke, getStrokeOpacity, getStrokeWidth, getSurface, getTranslation, getZIndex, isClipRectangleDirty, isFillDirty, isFillOpacityDirty, isHidden, isHiddenDirty, isOpacityDirty, isStrokeDirty, isStrokeOpacityDirty, isStrokeWidthDirty, isTransformDirty, isZIndexDirty, redraw, remove, setClipRectangle, setComponent, setCursor, setFill, setFillOpacity, setHidden, setOpacity, setRotation, setRotation, setRotation, setScaling, setScaling, setScaling, setStroke, setStrokeOpacity, setStrokeWidth, setSurface, setTranslation, setTranslation, setZIndex, transformed, transformMatrix, updateprotected List<PathCommand> commands
protected boolean pathDirty
protected LineCap strokeLineCap
protected boolean strokeLineCapDirty
protected LineJoin strokeLineJoin
protected boolean strokeLineJoinDirty
protected double miterLimit
protected boolean miterLimitDirty
protected boolean absolute
protected boolean curved
public PathSprite()
public PathSprite(CircleSprite sprite)
CircleSprite.sprite - the circle sprite to be converted to a pathpublic PathSprite(EllipseSprite sprite)
EllipseSprite.sprite - the ellipse sprite to be converted to a pathpublic PathSprite(PathSprite path)
path - the sprite to be copiedpublic PathSprite(RectangleSprite sprite)
RectangleSprite.sprite - the rectangle sprite to be converted to a pathpublic PathSprite(TextSprite sprite)
TextSprite.sprite - the text sprite to be converted to a pathpublic static List<PathCommand> copyCommands(List<PathCommand> commands)
PathCommands by making copies of the given
commands.commands - the commands to be copiedpublic static List<PathSprite> findDelta(PathSprite origin, List<PathCommand> commands)
PathCommand parity between this path and the given path.origin - the path to be comparedcommands - the path commands to compare againstprotected static void setCurrentPoint(PathCommand command, PrecisePoint currentPoint, PrecisePoint curvePoint)
command - the current commandcurrentPoint - the point that stores the current pointpublic void addCommand(int index,
PathCommand command)
PathCommand to the path at the given index.index - the index to add the commandcommand - the path command to addpublic void addCommand(PathCommand command)
PathCommand to the path.command - the path command to addpublic void clearCommands()
PathCommand in the path.public void clearDirtyFlags()
SpriteclearDirtyFlags in class Spritepublic PathSprite copy()
Spritepublic PreciseRectangle dimensions()
public PathCommand getCommand(int index)
PathCommand at the given index.index - the index of the command to returnpublic List<PathCommand> getCommands()
List of all the PathCommands in the sprite. Note that modifying this will not cause the
path to be marked as dirty, either use the other command manipulation methods, or force redraw some other way.addCommand(int, PathCommand),
addCommand(PathCommand),
clearCommands(),
setCommand(int, PathCommand),
setCommands(java.util.List)public double getMiterLimit()
public PathSprite getPathSprite()
SpriteSprite as a path.getPathSprite in class Spritepublic LineCap getStrokeLineCap()
public LineJoin getStrokeLineJoin()
LineJoin of the path.public boolean isAbsolute()
public boolean isCurved()
public boolean isDirty()
Spritepublic boolean isMiterLimitDirty()
public boolean isPathDirty()
public boolean isStrokeLineCapDirty()
public boolean isStrokeLineJoinDirty()
public PathSprite map(Matrix matrix)
PathSprite by the passed Matrix.matrix - the transformation MatrixPathSpritepublic void removeCommand(int index)
PathCommand at the given index.index - the index of the commandpublic void setCommand(int index,
PathCommand command)
PathCommand of the path at given index.index - the index of the command to be setcommand - the command to be setpublic void setCommands(List<PathCommand> commands)
PathCommands with the given List of
commands.commands - the new list of commandspublic void setMiterLimit(double miterLimit)
miterLimit - the new miter limit of the pathpublic void setStrokeLineCap(LineCap strokeLineCap)
LineCap of the path. Determines the shape to be used at
the end of open subpaths.strokeLineCap - the line cap of the pathpublic void setStrokeLineJoin(LineJoin strokeLineJoin)
LineJoin of the path. Determines the shape to be used at
the corners of paths.strokeLineJoin - the line join of the pathpublic int size()
PathCommands added to the sprite.public PathSprite toAbsolute()
PathCommands.public PathSprite toCurve()
public PathSprite toSmooth(int subsections)
CurveTo commands.subsections - the number of subdivisions used in the smoothing
function; must be no less than 4protected PreciseRectangle curveDimensions(PrecisePoint start, CurveTo curve)
CurveTo command. The
starting point of the curve must also be given.start - the starting point of the curvecurve - the curve to have its dimensions calculatedprotected PrecisePoint commandEnd(PathCommand command)
PathCommand.command - the command to have its end point foundprotected void commandEndSet(PrecisePoint point, PathCommand command)
point - the point to be set at the end of the commandcommand - the command to have its end setprotected ArrayList<PathCommand> ellipseCommands(double x, double y, double rx, double ry)
EllipticalArc commands.x - the x-coordinate of the ellipsey - the y-coordinate of the ellipserx - the radius of the ellipse on its x-axisry - the radius of the ellipse on its y-axisprotected PrecisePoint findCurvePoint(PrecisePoint start, CurveTo curve, double t)
start - the starting point of the curvecurve - the curve to get the point fromt - the time index of the pointprotected PrecisePoint[] getAnchors(CurveTo curve, double subsections)
curve - the curve to be subdividedsubsections - number of subsections in the new segment; must be no
less than 4protected ArrayList<PathCommand> rectangleCommands(PreciseRectangle rect, double radius)
PathCommands.rect - the rectangle to be convertedradius - the radius of the rectangles cornersprotected void setAbsolute(boolean absolute)
protected void setCurved(boolean curved)
Copyright © 2018. All rights reserved.