public final class SimpleDrawing3 extends Object
(0.0, 0.0)
. The
x-coordinates of the left and right edges of the canvas are approximately
x = -10.0
and x = 10.0
, respectively. The
y-coordinates of the bottom and top edges of the canvas are approximately
y = -8.0
and y = 8.0
, respectively.Modifier and Type | Field and Description |
---|---|
static Color |
BLACK
The color black.
|
static Color |
BLUE
The color blue.
|
static Color |
CYAN
The color cyan.
|
static Color |
DARK_GRAY
The color dark gray.
|
static Color |
GRAY
The color gray.
|
static Color |
GREEN
The color green.
|
static Color |
LIGHT_GRAY
The color light gray.
|
static Color |
MAGENTA
The color magenta.
|
static Color |
ORANGE
The color orange.
|
static Color |
PINK
The color pink.
|
static Color |
RED
The color red.
|
static Color |
WHITE
The color white.
|
static Color |
YELLOW
The color yellow.
|
Modifier and Type | Method and Description |
---|---|
static void |
clear()
Clear the screen to the default color (white).
|
static void |
drawLine(cse1030.drawing.IPoint2D from,
cse1030.drawing.IPoint2D to)
Draws a line on the canvas connecting two points.
|
static void |
drawPoint(cse1030.drawing.IPoint2D point)
Draws a point on the canvas.
|
static void |
filledPolygon(double[] x,
double[] y)
Draw a filled polygon with the given
(x[i], y[i]) coordinates. |
static void |
setPenColor(Color color)
Sets the current pen color for all subsequent points.
|
static void |
setPenRadius(double radius)
Sets the radius of the pen for all subsequent points.
|
static void |
show(int t)
Display on screen, pause for
t milliseconds, and turn on
animation mode: subsequent calls to drawing methods will not be displayed
on screen until the next call to show(). |
public static final Color BLACK
public static final Color BLUE
public static final Color CYAN
public static final Color DARK_GRAY
public static final Color GRAY
public static final Color GREEN
public static final Color LIGHT_GRAY
public static final Color MAGENTA
public static final Color ORANGE
public static final Color PINK
public static final Color RED
public static final Color WHITE
public static final Color YELLOW
public static void drawPoint(cse1030.drawing.IPoint2D point)
point
- the point to drawpublic static void drawLine(cse1030.drawing.IPoint2D from, cse1030.drawing.IPoint2D to)
from
- the starting point of the lineto
- the ending point of the linepublic static void setPenColor(Color color)
color
- the color to draw all subsequent pointspublic static void setPenRadius(double radius)
radius <= 0.0
radius
- public static void filledPolygon(double[] x, double[] y)
(x[i], y[i])
coordinates.x
- an array of all the x-coordindates of the polygony
- an array of all the y-coordindates of the polygonpublic static void clear()
public static void show(int t)
t
milliseconds, and turn on
animation mode: subsequent calls to drawing methods will not be displayed
on screen until the next call to show(). This is useful for producing
animations (clear the screen, draw a bunch of shapes, display on screen for
a fixed amount of time, and repeat). It also speeds up drawing a huge
number of shapes (call show(0) to defer drawing on screen, draw the shapes,
and call show(0) to display them all on screen at once).t
-