Paintutils API

Functionpaintutils.drawBox
Draws the outline of a box on the current term from the specified start position to the specified end position. Accepts an optional colour argument, which defaults to the term's current background colour.
This function does not restore the original cursor position after being called. You may have to manually set it back with the term.setCursorPos function.
This function does not restore the original background colour after being called. You may have to manually set it back with the term.setBackgroundColour function.
Syntax paintutils.drawBox(
  • startX : number
  • startY : number
  • endX : number
  • endX : number
  • colour? : number
)
Returns nil
Part of CC:Tweaked (source)
API paintutils
See also paintutils.drawFilledBox
ExampleWith custom colour
Draws the outline of a red box from the top left corner of the current term to the bottom right corner.
Code
<nowiki>
local width, height = term.getSize()
paintutils.drawBox(1, 1, width, height, colours.red)
    </nowiki>
Output
Functionpaintutils.drawFilledBox
Draws a filled box on the current term from the specified start position to the specified end position. Accepts an optional colour argument, which defaults to the term's current background colour.
This function does not restore the original cursor position after being called. You may have to manually set it back with the term.setCursorPos function.
This function does not restore the original background colour after being called. You may have to manually set it back with the term.setBackgroundColour function.
Syntax paintutils.drawFilledBox(
  • startX : number
  • startY : number
  • endX : number
  • endX : number
  • colour? : number
)
Returns nil
Part of CC:Tweaked (source)
API paintutils
See also paintutils.drawBox
ExampleWith custom colour
Draws a filled red box from the top left corner of the current term to the bottom right corner.
Code
<nowiki>
local width, height = term.getSize()
paintutils.drawFilledBox(1, 1, width, height, colours.red)
    </nowiki>
Output
Functionpaintutils.drawImage
Draws a Image which has been created by paintutils.loadImage or paintutils.parseImage.
This function does not restore the original cursor position after being called. You may have to manually set it back with the term.setCursorPos function.
This function does not restore the original background colour after being called. You may have to manually set it back with the term.setBackgroundColour function.
Syntax paintutils.drawImage(
  • picture : table
  • x : number
  • y : number
)
Returns nil
Part of CC:Tweaked (source)
API paintutils
ExampleDraw a Image
Loads and draws a Image.
Code
<nowiki>
local pic = paintutils.loadImage("/picture.nfp")
paintutils.drawImage(pic)
    </nowiki>
Functionpaintutils.drawLine
Draws a straight line on the current term from the specified start position to the specified end position. Accepts an optional colour argument, which defaults to the term's current background colour.
This function does not restore the original cursor position after being called. You may have to manually set it back with the term.setCursorPos function.
This function does not restore the original background colour after being called. You may have to manually set it back with the term.setBackgroundColour function.
Syntax paintutils.drawLine(
  • startX : number
  • startY : number
  • endX : number
  • endX : number
  • colour? : number
)
Returns nil
Part of CC:Tweaked (source)
API paintutils
ExampleWith custom colour
Draws a red line from the top left corner of the current term to the bottom right corner.
Code
<nowiki>
local width, height = term.getSize()
paintutils.drawLine(1, 1, width, height, colours.red)
    </nowiki>
Output
Functionpaintutils.drawPixel
Draws a single pixel to the current term at the specified position. Accepts an optional colour argument, which defaults to the term's current background colour.
This function does not restore the original cursor position after being called. You may have to manually set it back with the term.setCursorPos function.
This function does not restore the original background colour after being called. You may have to manually set it back with the term.setBackgroundColour function.
Syntax paintutils.drawPixel(
  • x : number
  • y : number
  • colour? : number
)
Returns nil
Part of CC:Tweaked (source)
API paintutils
ExampleWith custom colours
Draws red, green and blue pixels next to each other to the current term.
Code
<nowiki>
paintutils.drawPixel(2, 2, colours.red)
paintutils.drawPixel(3, 2, colours.green)
paintutils.drawPixel(4, 2, colours.blue)
    </nowiki>
Output
Functionpaintutils.loadImage
Loads a Image from a File which can be drawn by paintutils.drawImage. You can create a Image with Paint.
Syntax paintutils.loadImage(
  • path : string
)
Returns nil
Part of CC:Tweaked (source)
API paintutils
ExampleDraw a Image
Loads and draws a Image.
Code
<nowiki>
local pic = paintutils.loadImage("/picture.nfp")
paintutils.drawImage(pic)
    </nowiki>
Functionpaintutils.parseImage
Loads a Image from a string which can be drawn by paintutils.drawImage. You can create a Image with Paint.
Syntax paintutils.parseImage(
  • image : string
)
Returns nil
Part of CC:Tweaked (source)
API paintutils
ExampleDraw a Image
Loads and draws a Image.
Code
<nowiki>
local pic = paintutils.parseImage("0123456789abcdef")
paintutils.drawImage(pic,1,1)
    </nowiki>
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.