Package snap.viewx

Class QuickDraw

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class QuickDraw extends View
This class supports convenient drawing methods for quick and convenient vector graphics drawing.
  • Constructor Details

    • QuickDraw

      public QuickDraw(int aWidth, int aHeight)
      Constructor.
  • Method Details

    • isShowGrid

      public boolean isShowGrid()
      Returns whether to draw coordinate grid.
    • setShowGrid

      public void setShowGrid(boolean aValue)
      Sets whether to draw coordinate grid.
    • getGridSpacing

      public double getGridSpacing()
      Returns the space between gridlines in points.
    • setGridSpacing

      public void setGridSpacing(double aValue)
      Sets the space between gridlines in points.
    • isAnimate

      public boolean isAnimate()
      Returns whether to animate drawing (by returning pens that animate).
    • setAnimate

      public void setAnimate(boolean aValue)
      Sets whether to animate drawing (by returning pens that animate).
    • getPen

      public QuickDrawPen getPen()
      Returns the main pen.
    • getPen

      public QuickDrawPen getPen(int anIndex)
      Returns the pen at given index.
    • setPenColor

      public void setPenColor(Color aColor)
      Sets the current pen color.
    • setPenWidth

      public void setPenWidth(double aWidth)
      Sets the current pen width.
    • 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 line segment to current draw path from last path point to last moveTo point.
    • forward

      public void forward(double aLength)
      Moves the default pen 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.
    • paintFront

      protected void paintFront(Painter aPntr)
      Override to paint pen paths.
      Overrides:
      paintFront in class View
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Process event.
      Overrides:
      processEvent in class View
    • addAnimPen

      protected void addAnimPen(snap.viewx.QuickDrawPenAnim aPen)
      Adds an anim pen.
    • removeAnimPen

      protected void removeAnimPen(snap.viewx.QuickDrawPenAnim aPen)
      Removes an animating pen.
    • createDrawView

      public static QuickDraw createDrawView()
      Creates and returns a default view with size 400 x 400.
    • createDrawView

      public static QuickDraw createDrawView(int aWidth, int aHeight)
      Creates and returns a view for given width and height.