Module 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.
Index¶
Function
Draws an outlined rectangle on screen. |
|
Draws an outlined circle (or arc) on screen. |
|
Draws a filled rectangle on screen. |
|
Draws a filled triangle on screen. |
|
Draws an image on screen. |
|
Draws a line between two points. |
|
Draws a single pixel on screen. |
API Reference¶
-
system.graphics.drawPixel(
term:system.terminal.GFXTerminal|system.terminal.Terminal,
x:number,
y:number,
color:number
)¶ Draws a single pixel on screen.
- Parameters:
term (
system.terminal.GFXTerminal|system.terminal.Terminal) – The terminal to draw onx (
number) – The X coordinate to draw aty (
number) – The Y coordinate to draw atcolor (
number) – The color to draw with
-
system.graphics.drawLine(
term:system.terminal.GFXTerminal|system.terminal.Terminal,
x1:number,
y1:number,
x2:number,
y2:number,
color:number
)¶ Draws a line between two points.
- Parameters:
term (
system.terminal.GFXTerminal|system.terminal.Terminal) – The terminal to draw onx1 (
number) – The start X coordinate to draw aty1 (
number) – The start Y coordinate to draw atx2 (
number) – The end X coordinate to draw aty2 (
number) – The end Y coordinate to draw atcolor (
number) – The color to draw with
-
system.graphics.drawBox(
term:system.terminal.GFXTerminal|system.terminal.Terminal,
x:number,
y:number,
width:number,
height:number,
color:number
)¶ Draws an outlined rectangle on screen.
- Parameters:
term (
system.terminal.GFXTerminal|system.terminal.Terminal) – The terminal to draw onx (
number) – The upper-left X coordinate to draw aty (
number) – The upper-left Y coordinate to draw atwidth (
number) – The width of the rectangleheight (
number) – The height of the rectanglecolor (
number) – The color to draw with
-
system.graphics.drawFilledBox(
term:system.terminal.GFXTerminal|system.terminal.Terminal,
x:number,
y:number,
width:number,
height:number,
color:number
)¶ Draws a filled rectangle on screen.
- Parameters:
term (
system.terminal.GFXTerminal|system.terminal.Terminal) – The terminal to draw onx (
number) – The upper-left X coordinate to draw aty (
number) – The upper-left Y coordinate to draw atwidth (
number) – The width of the rectangleheight (
number) – The height of the rectanglecolor (
number) – The color to draw with
-
system.graphics.drawCircle(
term:system.terminal.GFXTerminal|system.terminal.Terminal,
x:number,
y:number,
width:number,
height:number,
color:number,
startAngle?:number,
arcCircumference?:number
)¶ Draws an outlined circle (or arc) on screen.
- Parameters:
term (
system.terminal.GFXTerminal|system.terminal.Terminal) – The terminal to draw onx (
number) – The upper-left X coordinate to draw aty (
number) – The upper-left Y coordinate to draw atwidth (
number) – The width of the circleheight (
number) – The height of the circlecolor (
number) – The color to draw withstartAngle? (
number) – The angle to start from in radians (starting at the right side) (defaults to 0)arcCircumference? (
number) – The amount of the arc to draw in radians (defaults to 2*math.pi)
-
system.graphics.drawFilledTriangle(
term:system.terminal.GFXTerminal|system.terminal.Terminal,
x1:number,
y1:number,
x2:number,
y2:number,
x3:number,
y3:number,
color:number
)¶ Draws a filled triangle on screen.
- Parameters:
term (
system.terminal.GFXTerminal|system.terminal.Terminal) – The terminal to draw onx1 (
number) – The first X coordinate to draw aty1 (
number) – The first Y coordinate to draw atx2 (
number) – The second X coordinate to draw aty2 (
number) – The second Y coordinate to draw atx3 (
number) – The third X coordinate to draw aty3 (
number) – The third Y coordinate to draw atcolor (
number) – The color to draw with
-
system.graphics.drawImage(
term:system.terminal.GFXTerminal|system.terminal.Terminal,
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).
- Parameters:
term (
system.terminal.GFXTerminal|system.terminal.Terminal) – The terminal to draw onx (
number) – The X coordinate to draw aty (
number) – The Y coordinate to draw atimage (
table) – The image to draw