paintutils (API)

From ComputerCraft Wiki
Revision as of 19:18, 29 January 2015 by MKlegoman357 (Talk | contribs) (Added missing functions drawBox and drawFilledBox, expanded the note about optional color params)

Jump to: navigation, search

Paintutils is a default API for advanced systems which can draw pixels and lines, load and draw image files. You can use colors API for easier color manipulation.

Grid disk.png  paintutils (API)
Function Return values Description
paintutils.loadImage(string path) table image Loads and returns an image object from path.
paintutils.drawImage(table image, number x, number y) nil Draws an image at (x, y) where image is an image object.
paintutils.drawPixel(number x, number y [, number color*]) nil Draws a pixel at (x, y) in the specified color.
paintutils.drawLine(number startX, number startY, number endX, number endY [, number color*]) nil Draws a line from (startX, startY) to (endX, endY) in the specified color.
paintutils.drawBox(number startX, number startY, number endX, number endY [, number color]) nil Draws a box from (startX, startY) to (endX, endY) in the specified color. Requires version 1.64 or newer.
paintutils.drawFilledBox(number startX, number startY, number endX, number endY [, number color]) nil Draws a filled box from (startX, startY) to (endX, endY) in the specified color. Requires version 1.64 or newer.

* Note: In builds prior to ComputerCraft 1.6, the "color" parameter required by paintutils.drawPixel() and paintutils.drawLine() is optional. The current background colour will be used if it's omitted. This was changed back to optional in version 1.64.