Double numbers (x, y) just like in the Cartesian coordinates system.StdDraw.java, or class file StdDraw.class, or jar file stdlib.jar in your possession.You have to tell kotlinc and kotlin about it too. One way is to provide the -classpath or -cp flag when you invoke the commands, like this
$ kotlinc -cp .:stdlib.jar sourceFile.kt
$ kotlin -cp .:stdlib.jar SourceFileKtIn the above example, you are telling kotlinc and kotlin that the path to search for class files include . (the current directory) and inside the jar file stdlib.jar.
line(x0: Double, y0: Double, x1: Double, y1: Double)—draw line segment joining point (x0,y0) to point (x1,y1)point(x: Double, y: Double)—draw the point (x,y)text(x: Double, y: Double, s: String)—draw the String s centered at point (x,y)circle(x: Double, y: Double, r: Double)—draw circle centered at point (x,y), with radius rfilledCircle(x: Double, y: Double, r: Double)—draw filled circle centered at point (x,y), with radius rellipse(x: Double, y: Double, semiMajorAxis: Double, semiMinorAxis: Double)—draws an ellipse with the specified semimajor and semiminor axes, centered at point (x, y)filledEllipse(x: Double, y: Double, semiMajorAxis: Double, semiMinorAxis: Double)—draws a filled ellipse with the specified semimajor and semiminor axes, centered at point (x, y)arc(x: Double, y: Double, radius: Double, angle1: Double, angle2: Double)—draws a circular arc of the specified radius, centered at point (x, y), from angle1 to angle2 (in degrees)rectangle(x: Double, y: Double, halfWidth: Double, halfHeight: Double)—draws a rectangle of the specified size, centered at point (x, y)filledRectangle(x: Double, y: Double, halfWidth: Double, halfHeight: Double)—draws a filled rectangle of the specified size, centered at point (x, y).square(x: Double, y: Double, r: Double)—draw r x r square centered at point (x,y)fillededSquare(x: Double, y: Double, r: Double)—draw r x r filled square centered at point (x,y)polygon(x: DoubleArray, y: DoubleArray)—draw polygonfillededPolygon(x: DoubleArray, y: DoubleArray)—draw filled polygonpicture(x: Double, y: Double, filename: String)—draw specified image centered at point (x,y)save(filename: String)—save image to specified filename| Signature | Purpose |
|---|---|
setScale() |
sets x-scale and y-scale to default (between 0.0 and 1.0) |
setScale(min: Double, max: Double) |
reset both x-range and y-range to (min, max) |
setXscale(xmin: Double, xmax: Double) |
reset x-range to (xmin, xmax) |
setYscale(ymin: Double, ymax: Double) |
reset y-range to (ymin, ymax) |
clear() |
clears the screen to default color (white) |
clear(color: java.awt.Color) |
clears the screen to specified color |
enableDoubleBuffering() |
enable double buffering |
disableDoubleBuffering() |
disable double buffering |
| Signature | Purpose |
|---|---|
setPenColor() |
sets pen color to default color (black) |
setPenColor(color: java.awt.Color) |
sets pen color to specified color |
setPenRadius() |
sets pen radius to default size (0.002) |
setPenRadius(radius: Double) |
sets pen radius to spedified radius |
pause(t: Int) |
pause for t milliseconds |
show() |
copies offscreen buffer to onscreen buffer |