|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.alchemy.core.AlcShape
public class AlcShape
A shape class used by Alchemy
The main shape is stored as a GeneralPath object
with other variables defining the color, style, alpha etc...
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
AlcShape()
Creates a blank AlcShape object |
|
AlcShape(java.awt.geom.GeneralPath path)
Creates a new instance of AlcShape with the default values |
|
AlcShape(java.awt.geom.GeneralPath path,
java.awt.Color color,
int alpha,
int style,
float lineWidth)
Creates a new instance of AlcShape with defined values |
|
AlcShape(java.awt.Point p)
Creates a new instance of AlcShape with the default values |
|
AlcShape(java.awt.geom.Point2D.Float p)
Creates a new instance of AlcShape with the default values |
|
AlcShape(java.awt.geom.Point2D.Float p,
java.awt.Color color,
int alpha,
int style,
float lineWidth)
Creates a new instance of AlcShape with defined values |
|
AlcShape(java.awt.Point p,
java.awt.Color color,
int alpha,
int style,
float lineWidth)
Creates a new instance of AlcShape with defined values |
|
| Method Summary | |
|---|---|
void |
append(java.awt.geom.GeneralPath newPath,
boolean connect)
Append a GeneralPath to this shape |
java.lang.Object |
clone()
'Deep' Clone this object using the existing style/color etc.. |
void |
closePath()
Closes the current subpath by drawing a straight line back to the coordinates of the last moveTo |
void |
createSpine()
Create the spine - redraws the variable width line based on the spine points |
void |
curveTo(java.awt.Point p)
Add a curve point to the shape This method uses a simple smoothing algorithm to get rid of hard edges |
void |
curveTo(java.awt.geom.Point2D.Float p)
Add a curve point to the shape This method uses a simple smoothing algorithm to get rid of hard edges |
AlcShape |
customClone(java.util.ArrayList<java.awt.geom.Point2D.Float> spine,
java.util.ArrayList<java.lang.Float> spineWidth)
A custom clone that adds a new spine (variable width line) to the shape the creates the path while keeping all of the style infomation. |
AlcShape |
customClone(java.awt.geom.GeneralPath tempPath)
A custom clone that adds a new GeneralPath to the shape while keeping all of the style infomation. |
int |
getAlpha()
Get the alpha (transparency) value of this shape |
java.awt.Rectangle |
getBounds()
Get the bounds of this shape |
java.awt.Color |
getColor()
Get the color of this shape |
java.awt.GradientPaint |
getGradientPaint()
Get this shapes Gradient |
java.awt.geom.Point2D.Float |
getLastPoint()
Return the last point |
float |
getLineWidth()
Get the line width of this shape |
java.awt.geom.GeneralPath |
getPath()
Return the GeneralPath path |
java.util.ArrayList<java.awt.geom.Point2D.Float> |
getPoints()
Return a simple list of x,y points from this AlcShape object |
java.util.ArrayList<java.awt.geom.Point2D.Float> |
getSpine()
Get the spine (used for variable width lines) of this shape |
java.util.ArrayList<java.lang.Float> |
getSpineWidth()
Get the spine width (used for variable width lines) of this shape |
int |
getStyle()
Get the style of this shape |
int |
getTotalPoints()
Return the total number of points in this shape |
boolean |
hasSpine()
Return if this shape uses a spine or not |
static boolean |
isLineSmoothing()
Check if line smoothing is on or off |
boolean |
isPathClosed()
Return if the path has been closed or not |
boolean |
isPenShape()
Return if this shape has been created with pen strokes or not |
void |
lineTo(java.awt.Point p)
Add a straight line point to the shape |
void |
lineTo(java.awt.geom.Point2D.Float p)
Add a straight line point to the shape |
void |
move(double x,
double y)
Move the shape by the specified distance. |
void |
moveTo(java.awt.Point p)
Move to the given Point |
void |
moveTo(java.awt.geom.Point2D.Float p)
Move to the given Point |
void |
recalculateTotalPoints()
Recalculates the number of points for this shape Useful when shapes have been merged together |
static java.awt.geom.Point2D.Float |
rightAngle(java.awt.geom.Point2D.Float p1,
java.awt.geom.Point2D.Float p2,
double distance)
Calculate a right angle perpendicular to the two given points at the given distance |
void |
rotate(double theta)
Rotate the shape using the shapes centre as the anchor point |
void |
rotate(double theta,
double x,
double y)
Rotate the shape |
void |
scale(double sx,
double sy)
Scale the shape by a certain factor |
void |
setAlpha(int alpha)
Set the alpha (transparency) value of this shape |
void |
setAlphaColor(java.awt.Color color)
Set a color with alpha directly |
void |
setColor(java.awt.Color color)
Set the color of this shape |
void |
setGradientPaint(java.awt.GradientPaint gradientPaint)
Set this shapes gradient |
void |
setLastPoint(java.awt.geom.Point2D.Float lastPt)
Set the last point for this shape Useful when creating a duplicate object |
static void |
setLineSmoothing(boolean lineSmoothing)
Set the line smoothing variable for AlcShape |
void |
setLineWidth(float lineWidth)
Set the line width of this shape |
void |
setPath(java.awt.geom.GeneralPath path)
Set the path using a GeneralPath |
void |
setPoint(java.awt.Point p)
Set (or reset perhaps) the shape with a single Point |
void |
setPoint(java.awt.geom.Point2D.Float p)
Set (or reset perhaps) the shape with a single Point |
void |
setSpine(java.util.ArrayList<java.awt.geom.Point2D.Float> spine)
Set the spine (used for variable width lines) of this shape |
void |
setSpineWidth(java.util.ArrayList<java.lang.Float> spineWidth)
Set the spine width (used for variable width lines) of this shape |
void |
setStyle(int style)
Set the style of this shape |
void |
setTotalPoints(int totalPoints)
Set the total number of points for this shape Useful when creating a duplicate object |
void |
setup()
Set the attributes of this shape (Alpha/Color/Style/LineWidth) to the current values of the canvas |
void |
setup(java.awt.Color color,
int alpha,
int style,
float lineWidth)
Setup the attributes of a shape |
void |
spineTo(java.awt.geom.Point2D.Float p,
float width)
Add a spine point for variable width lines |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AlcShape(java.awt.Point p)
p - Initial point to set the GeneralPath movetopublic AlcShape(java.awt.geom.Point2D.Float p)
p - Initial point to set the GeneralPath moveto
public AlcShape(java.awt.Point p,
java.awt.Color color,
int alpha,
int style,
float lineWidth)
p - Initial point to set the GeneralPath movetocolor - Color of the shapealpha - Alpha value of the shapestyle - Style of the shape - (1) LINE or (2) SOLID FILLlineWidth - Line width of the shape
public AlcShape(java.awt.geom.Point2D.Float p,
java.awt.Color color,
int alpha,
int style,
float lineWidth)
p - Initial point to set the GeneralPath movetocolor - color of the shapealpha - Alpha value of the shapestyle - Style of the shape - (1) LINE or (2) SOLID FILLlineWidth - Line width of the shapepublic AlcShape()
public AlcShape(java.awt.geom.GeneralPath path)
path - GeneralPath path
public AlcShape(java.awt.geom.GeneralPath path,
java.awt.Color color,
int alpha,
int style,
float lineWidth)
path - GeneralPath pathcolor - Color of the shapealpha - Alpha value of the shapestyle - Style of the shape - (1) LINE or (2) SOLID FILLlineWidth - Line width of the shape| Method Detail |
|---|
public void setup(java.awt.Color color,
int alpha,
int style,
float lineWidth)
color - Color of the shapealpha - Alpha value of the shapestyle - Style of the shape - (1) LINE or (2) SOLID FILLlineWidth - Line width of the shapepublic void setup()
public void curveTo(java.awt.Point p)
p - Point to curve topublic void curveTo(java.awt.geom.Point2D.Float p)
p - Point to curve topublic void lineTo(java.awt.Point p)
p - Point to draw a line topublic void lineTo(java.awt.geom.Point2D.Float p)
p - Point to draw a line to
public void spineTo(java.awt.geom.Point2D.Float p,
float width)
p - The point to addwidth - The width of the linepublic void createSpine()
public void append(java.awt.geom.GeneralPath newPath,
boolean connect)
newPath - The path to be appendedconnect - Connect the two paths together or notpublic void moveTo(java.awt.Point p)
p - Point to draw a line topublic void moveTo(java.awt.geom.Point2D.Float p)
p - Point to draw a line topublic void closePath()
public void move(double x,
double y)
x - x distancey - y distance
public void scale(double sx,
double sy)
sx - X scale factorsy - Y scale factorpublic void rotate(double theta)
theta - The angle of rotation in radians
public void rotate(double theta,
double x,
double y)
theta - The angle of rotation in radiansx - The coordinates of the x anchor pointy - The coordinates of the y anchor pointpublic java.awt.geom.GeneralPath getPath()
public void setPath(java.awt.geom.GeneralPath path)
path - public void setPoint(java.awt.Point p)
p - public void setPoint(java.awt.geom.Point2D.Float p)
p - public int getTotalPoints()
public void setTotalPoints(int totalPoints)
totalPoints - Total number of pointspublic void recalculateTotalPoints()
public java.awt.geom.Point2D.Float getLastPoint()
public void setLastPoint(java.awt.geom.Point2D.Float lastPt)
lastPt - The last pointpublic java.awt.Color getColor()
public void setColor(java.awt.Color color)
color - The colorpublic int getAlpha()
public void setAlpha(int alpha)
alpha - Alpha valuepublic void setAlphaColor(java.awt.Color color)
color - public int getStyle()
AlcConstants.STYLE_STROKE or AlcConstants.STYLE_FILLpublic void setStyle(int style)
style - The style of this shape either AlcConstants.STYLE_STROKE or AlcConstants.STYLE_FILLpublic java.awt.GradientPaint getGradientPaint()
public void setGradientPaint(java.awt.GradientPaint gradientPaint)
gradientPaint - The gradientpublic float getLineWidth()
public void setLineWidth(float lineWidth)
lineWidth - The line widthpublic static boolean isLineSmoothing()
public static void setLineSmoothing(boolean lineSmoothing)
lineSmoothing - boolean to set line smoothing on or offpublic java.awt.Rectangle getBounds()
public boolean isPathClosed()
public boolean isPenShape()
public boolean hasSpine()
public java.util.ArrayList<java.awt.geom.Point2D.Float> getSpine()
public void setSpine(java.util.ArrayList<java.awt.geom.Point2D.Float> spine)
spine - An arraylist containing the new spinepublic java.util.ArrayList<java.lang.Float> getSpineWidth()
public void setSpineWidth(java.util.ArrayList<java.lang.Float> spineWidth)
spineWidth - An arraylist containing the new spine widthpublic java.util.ArrayList<java.awt.geom.Point2D.Float> getPoints()
public static java.awt.geom.Point2D.Float rightAngle(java.awt.geom.Point2D.Float p1,
java.awt.geom.Point2D.Float p2,
double distance)
p1 - The first pointp2 - The second pointdistance - The distance away from the two points
public java.lang.Object clone()
clone in class java.lang.Objectpublic AlcShape customClone(java.awt.geom.GeneralPath tempPath)
tempPath - A GeneralPath to be added to the AlcShape
public AlcShape customClone(java.util.ArrayList<java.awt.geom.Point2D.Float> spine,
java.util.ArrayList<java.lang.Float> spineWidth)
spine - The spine of the shapespineWidth - The width of the spine
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||