system.graphics
The graphics module provides functions to draw primitive geometry on a locked terminal object. It supports both text and graphics mode terminals. The state of text terminals is preserved, so using these functions doesn’t change the cursor position or colors.
drawPixel(term: Terminal|GFXTerminal, x: number, y: number, color: number)
Draws a single pixel on screen.
Arguments
term: The terminal to draw onx: The X coordinate to draw aty: The Y coordinate to draw atcolor: The color to draw with
Return Values
This function does not return anything.
drawLine(term: Terminal|GFXTerminal, x1: number, y1: number, x2: number, y2: number, color: number)
Draws a line between two points.
Arguments
term: The terminal to draw onx1: The start X coordinate to draw aty1: The start Y coordinate to draw atx2: The end X coordinate to draw aty2: The end Y coordinate to draw atcolor: The color to draw with
Return Values
This function does not return anything.
drawBox(term: Terminal|GFXTerminal, x: number, y: number, width: number, height: number, color: number)
Draws an outlined rectangle on screen.
Arguments
term: The terminal to draw onx: The upper-left X coordinate to draw aty: The upper-left Y coordinate to draw atwidth: The width of the rectangleheight: The height of the rectanglecolor: The color to draw with
Return Values
This function does not return anything.
drawFilledBox(term: Terminal|GFXTerminal, x: number, y: number, width: number, height: number, color: number)
Draws a filled rectangle on screen.
Arguments
term: The terminal to draw onx: The upper-left X coordinate to draw aty: The upper-left Y coordinate to draw atwidth: The width of the rectangleheight: The height of the rectanglecolor: The color to draw with
Return Values
This function does not return anything.
drawCircle(term: Terminal|GFXTerminal, x: number, y: number, width: number, height: number, color: number[, startAngle: number = 0][, arcCircumference: number = 2*math.pi])
Draws an outlined circle (or arc) on screen.
Arguments
term: The terminal to draw onx: The upper-left X coordinate to draw aty: The upper-left Y coordinate to draw atwidth: The width of the circleheight: The height of the circlecolor: The color to draw withstartAngle: The angle to start from in radians (starting at the right side) (defaults to 0)arcCircumference: The amount of the arc to draw in radians (defaults to 2*math.pi)
Return Values
This function does not return anything.
drawFilledTriangle(term: Terminal|GFXTerminal, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color: number)
Draws a filled triangle on screen.
Arguments
term: The terminal to draw onx1: The first X coordinate to draw aty1: The first Y coordinate to draw atx2: The second X coordinate to draw aty2: The second Y coordinate to draw atx3: The third X coordinate to draw aty3: The third Y coordinate to draw atcolor: The color to draw with
Return Values
This function does not return anything.
drawImage(term: Terminal|GFXTerminal, x: number, y: number, image: table)
Draws an image on screen. The image may be either a valid graphics mode pixel region (using either string or table rows), or a blit table with {text, text color, background color} table rows (text mode only).
Arguments
term: The terminal to draw onx: The X coordinate to draw aty: The Y coordinate to draw atimage: The image to draw
Return Values
This function does not return anything.