Package snap.viewx
Class QuickDrawPen
java.lang.Object
snap.viewx.QuickDrawPen
This class supports convenient drawing methods for quick and convenient vector graphics drawing.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
A path subclass to hold color and width. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a close segment to current draw path.void
forward
(double aLength) Moves the default draw path forward by given length for current Direction.Returns an AnimPen.getColor()
Returns the current pen color.double
Returns the current angle in degrees of path drawing.protected QuickDrawPen.PenPath
Returns the current pen path.double
getWidth()
Returns the current pen width.boolean
Returns whether pen is animating.void
lineTo
(double aX, double aY) Adds a line segment to current draw path from last path point to given point.void
moveTo
(double aX, double aY) Moves the current path point to given point.protected void
paintPaths
(Painter aPntr) Override to paint the path.protected void
setAnimating
(boolean aValue) Sets whether pen is animating.void
Sets the current pen color.void
setDirection
(double theDegrees) Sets the current angle in degrees of path drawing.void
setWidth
(double aValue) Sets the current pen width.void
turn
(double anAngle) Sets the path drawing direction to the current direction plus given angle.
-
Field Details
-
_drawView
-
_animPen
protected snap.viewx.QuickDrawPenAnim _animPen
-
-
Constructor Details
-
QuickDrawPen
Constructor.
-
-
Method Details
-
getColor
Returns the current pen color. -
setColor
Sets the current pen color. -
getWidth
public double getWidth()Returns the current pen width. -
setWidth
public void setWidth(double aValue) Sets the current pen width. -
getDirection
public double getDirection()Returns the current angle in degrees of path drawing. Default is zero degrees - so calling forward() adds a horizontal line segment to the right. -
setDirection
public void setDirection(double theDegrees) Sets the current angle in degrees of path drawing. -
moveTo
public void moveTo(double aX, double aY) Moves the current path point to given point. -
lineTo
public void lineTo(double aX, double aY) Adds a line segment to current draw path from last path point to given point. -
closePath
public void closePath()Adds a close segment to current draw path. -
forward
public void forward(double aLength) Moves the default draw path forward by given length for current Direction. -
turn
public void turn(double anAngle) Sets the path drawing direction to the current direction plus given angle. -
getPenPath
Returns the current pen path. -
paintPaths
Override to paint the path. -
isAnimating
public boolean isAnimating()Returns whether pen is animating. -
setAnimating
protected void setAnimating(boolean aValue) Sets whether pen is animating. -
getAnimPen
Returns an AnimPen.
-