export default class StdDraw { static scaleX: number; static scaleY: number; static readonly DEFAULT_WIDTH = 512; static readonly DEFAULT_HEIGHT = 512; static canvas: HTMLCanvasElement; static ctx: CanvasRenderingContext2D; /** @see https://www.colorhexa.com/ */ static DARK_GRAY: string; static RED: string; static line(x0: number, y0: number, x1: number, y1: number): void; /** * Draws a point centered at (x, y). * The point is a filled circle whose radius is equal to the pen radius. * To draw a single-pixel point, first set the pen radius to 0. * * @param x the x-coordinate of the point * @param y the y-coordinate of the point * @throws Error if either x or y is either NaN or infinite */ static point(x: number, y: number): void; /** * Writes the given text string in the current font, centered at (x, y). * * @param x the center x-coordinate of the text * @param y the center y-coordinate of the text * @param text the text to write * @throws Error if text is null * @throws Error if x or y is either NaN or infinite */ static text(x: number, y: number, text: string): void; /** * Draws a circle of the specified radius, centered at (x, y). * * @param x the x-coordinate of the center of the circle * @param y the y-coordinate of the center of the circle * @param radius the radius of the circle * @throws Error if radius is negative * @throws Error if any argument is either NaN or infinite */ static circle(x: number, y: number, radius: number): void; /** * Draws a filled circle of the specified radius, centered at (x, y). * * @param x the x-coordinate of the center of the circle * @param y the y-coordinate of the center of the circle * @param radius the radius of the circle * @throws Error if radius is negative * @throws Error if any argument is either NaN or infinite */ static filledCircle(x: number, y: number, radius: number): void; /** * Draws an ellipse with the specified semimajor and semiminor axes, * centered at (x, y). * * @param x the x-coordinate of the center of the ellipse * @param y the y-coordinate of the center of the ellipse * @param semiMajorAxis is the semimajor axis of the ellipse * @param semiMinorAxis is the semiminor axis of the ellipse * @throws Error if either semiMajorAxis * or semiMinorAxis is negative * @throws Error if any argument is either NaN or infinite */ static ellipse(x: number, y: number, semiMajorAxis: number, semiMinorAxis: number): void; /** * Draws a filled ellipse with the specified semimajor and semiminor axes, * centered at (x, y). * * @param x the x-coordinate of the center of the ellipse * @param y the y-coordinate of the center of the ellipse * @param semiMajorAxis is the semimajor axis of the ellipse * @param semiMinorAxis is the semiminor axis of the ellipse * @throws Error if either semiMajorAxis * or semiMinorAxis is negative * @throws Error if any argument is either NaN or infinite */ static filledEllipse(x: number, y: number, semiMajorAxis: number, semiMinorAxis: number): void; /** * Draws a square of the specified size, centered at (x, y). * * @param x the x-coordinate of the center of the square * @param y the y-coordinate of the center of the square * @param halfLength one half the length of any side of the square * @throws Error if halfLength is negative * @throws Error if any argument is either NaN or infinite */ static square(x: number, y: number, halfLength: number): void; /** * Draws a filled square of the specified size, centered at (x, y). * * @param x the x-coordinate of the center of the square * @param y the y-coordinate of the center of the square * @param halfLength one half the length of any side of the square * @throws Error if halfLength is negative * @throws Error if any argument is either NaN or infinite */ static filledSquare(x: number, y: number, halfLength: number): void; /** * Draws a rectangle of the specified size, centered at (x, y). * * @param x the x-coordinate of the center of the rectangle * @param y the y-coordinate of the center of the rectangle * @param halfWidth one half the width of the rectangle * @param halfHeight one half the height of the rectangle * @throws Error if either halfWidth or halfHeight is negative * @throws Error if any argument is either NaN or infinite */ static rectangle(x: number, y: number, halfWidth: number, halfHeight: number): void; /** * Draws a filled rectangle of the specified size, centered at (x, y). * * @param x the x-coordinate of the center of the rectangle * @param y the y-coordinate of the center of the rectangle * @param halfWidth one half the width of the rectangle * @param halfHeight one half the height of the rectangle * @throws Error if either halfWidth or halfHeight is negative * @throws Error if any argument is either NaN or infinite */ static filledRectangle(x: number, y: number, halfWidth: number, halfHeight: number): void; /** * Draws a polygon with the vertices * (x0, y0), * (x1, y1), ..., * (xn - 1, yn - 1). * * @param x an array of all the x-coordinates of the polygon * @param y an array of all the y-coordinates of the polygon * @throws Error unless x[] and y[] * are of the same length * @throws Error if any coordinate is either NaN or infinite * @throws Error if either x[] or y[] is null */ static polygon(x: number[], y: number[]): void; /** * Draws a filled polygon with the vertices * (x0, y0), * (x1, y1), ..., * (xn - 1, yn - 1). * * @param x an array of all the x-coordinates of the polygon * @param y an array of all the y-coordinates of the polygon * @throws Error unless x[] and y[] * are of the same length * @throws Error if any coordinate is either NaN or infinite * @throws Error if either x[] or y[] is null */ static filledPolygon(x: number[], y: number[]): void; static setScale(x: number, y: number): void; static setTranslate(x: number, y: number): void; /** * Sets the pen size to the default size (0.002). * The pen is circular, so that lines have rounded ends, and when you set the * pen radius and draw a point, you get a circle of the specified radius. * The pen radius is not affected by coordinate scaling. */ static setPenRadius(r: number): void; /** * Sets the pen color to the specified color. * * The predefined pen colors are * StdDraw.BLACK, StdDraw.BLUE, StdDraw.CYAN, * StdDraw.DARK_GRAY, StdDraw.GRAY, StdDraw.GREEN, * StdDraw.LIGHT_GRAY, StdDraw.MAGENTA, StdDraw.ORANGE, * StdDraw.PINK, StdDraw.RED, StdDraw.WHITE, and * StdDraw.YELLOW. * * @param color the color to make the pen */ static setPenColor(c: string): void; /** * Sets the font to the specified value. * * @param font the font */ static setFont(f: string): void; /** * Sets the canvas (drawing area) to be 512-by-512 pixels. * This also erases the current drawing and resets the coordinate system, * pen radius, pen color, and font back to their default values. * Ordinarly, this method is called once, at the very beginning * of a program. */ static setCanvasSize(width: number, height: number): void; /** * Clears the screen to the specified color. * * @param color the color to make the background */ static clear(color: string): void; static show(time: number): void; static _polygonPath(x: number[], y: number[]): void; static _circlePath(x: number, y: number, radius: number): void; static _ellipsePath(x: number, y: number, semiMajorAxis: number, semiMinorAxis: number): void; static getRad(degree: number): number; static drawAxis(): void; static drawAxisX(): void; static drawAxisY(): void; /** * Create new canvas, container element must exist * @param containerId Canvas container id * @param canvasId new canvas id */ static createNewCanvas(containerId: string, canvasId: string): void; static _createCanvas(containerId?: string, canvasId?: string): HTMLCanvasElement; static _createContext(): CanvasRenderingContext2D; static _assertXYSafeInt(x: number, y: number): void; }