paintutils (API)

From ComputerCraft Wiki
Revision as of 05:54, 28 April 2014 by Bomb Bloke (Talk | contribs) (CC 1.6 changes)

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.

* 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.