Package snap.viewx

Class QuickDrawPen

java.lang.Object
snap.viewx.QuickDrawPen

public class QuickDrawPen extends Object
This class supports convenient drawing methods for quick and convenient vector graphics drawing.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static class 
    A path subclass to hold color and width.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected snap.viewx.QuickDrawPenAnim
     
    protected QuickDraw
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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.
    Returns the current pen color.
    double
    Returns the current angle in degrees of path drawing.
    Returns the current pen path.
    double
    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
    Override to paint the path.
    protected void
    setAnimating(boolean aValue)
    Sets whether pen is animating.
    void
    setColor(Color aColor)
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _drawView

      protected QuickDraw _drawView
    • _animPen

      protected snap.viewx.QuickDrawPenAnim _animPen
  • Constructor Details

    • QuickDrawPen

      protected QuickDrawPen(QuickDraw aDrawView)
      Constructor.
  • Method Details

    • getColor

      public Color getColor()
      Returns the current pen color.
    • setColor

      public void setColor(Color aColor)
      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

      protected QuickDrawPen.PenPath getPenPath()
      Returns the current pen path.
    • paintPaths

      protected void paintPaths(Painter aPntr)
      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

      public QuickDrawPen getAnimPen()
      Returns an AnimPen.