Class Canvas

java.lang.Object
com.gigamonkeys.bhs.Canvas

public class Canvas extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Canvas(double width, double height)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    drawCircle(double x, double y, double r, String color, double lineWidth)
    Draws a circle centered at x,y with radius r using the given color and the given lineWidth.
    void
    drawFilledCircle(double x, double y, double r, String color)
    Draws a filled circle centered at x,y with radius r using the given color.
    void
    drawFilledRect(double x, double y, double width, double height, String color)
    Draws a filled rectangle starting at x,y with the given width, height, and color.
    void
    drawLine(double x1, double y1, double x2, double y2, String color, double lineWidth)
    Draws a line from x1,y1 to x2,y2 using the give color and the given line width.
    void
    drawRect(double x, double y, double width, double height, String color, double lineWidth)
    Draws a rectangle starting at x,y with the given width, height, color, and lineWidth.
    double
     
    double
     

    Methods inherited from class java.lang.Object

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

    • Canvas

      public Canvas(double width, double height)
  • Method Details

    • width

      public double width()
    • height

      public double height()
    • code

      public String code()
    • drawLine

      public void drawLine(double x1, double y1, double x2, double y2, String color, double lineWidth)
      Draws a line from x1,y1 to x2,y2 using the give color and the given line width.
    • drawCircle

      public void drawCircle(double x, double y, double r, String color, double lineWidth)
      Draws a circle centered at x,y with radius r using the given color and the given lineWidth.
    • drawRect

      public void drawRect(double x, double y, double width, double height, String color, double lineWidth)
      Draws a rectangle starting at x,y with the given width, height, color, and lineWidth. Positive widths go to the right and negative to the left; positive heights go down and negative heights go up.
    • drawFilledRect

      public void drawFilledRect(double x, double y, double width, double height, String color)
      Draws a filled rectangle starting at x,y with the given width, height, and color. Positive widths go to the right and negative to the left; positive heights go down and negative heights go up.
    • drawFilledCircle

      public void drawFilledCircle(double x, double y, double r, String color)
      Draws a filled circle centered at x,y with radius r using the given color.