Difference between revisions of "Paintutils (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m
(CC 1.6 changes)
Line 17: Line 17:
  
 
{{API table/row
 
{{API table/row
|[[paintutils.drawPixel]]({{type|number}} x, {{type|number}} y [<nowiki/>, {{type|number}} color])
+
|[[paintutils.drawPixel]]({{type|number}} x, {{type|number}} y, {{type|number}} color*)
 
|{{type|nil}}
 
|{{type|nil}}
|Draws a pixel at (<var>x</var>, <var>y</var>). If <var>color</var> is specified draws it in that color.
+
|Draws a pixel at (<var>x</var>, <var>y</var>) in the specified color.
 
|odd}}
 
|odd}}
  
 
{{API table/row
 
{{API table/row
|[[paintutils.drawLine]]({{type|number}} startX, {{type|number}} startY, {{type|number}} endX, {{type|number}} endY [<nowiki/>, {{type|number}} color])
+
|[[paintutils.drawLine]]({{type|number}} startX, {{type|number}} startY, {{type|number}} endX, {{type|number}} endY, {{type|number}} color*)
 
|{{type|nil}}
 
|{{type|nil}}
|Draws a line from (<var>startX</var>, <var>startY</var>) to (<var>endX</var>, <var>endY</var>). If <var>color</var> is specified draws it in that color.
+
|Draws a line from (<var>startX</var>, <var>startY</var>) to (<var>endX</var>, <var>endY</var>) in the specified color.
 
|}}
 
|}}
 
 
}}
 
}}
 
+
''<nowiki>*</nowiki> Note: In builds prior to ComputerCraft 1.6, the "color" parameter required by [[paintutils.drawPixel|paintutils.drawPixel()]] and [[paintutils.drawLine|paintutils.drawLine()]] is optional. The current [[term.setBackgroundColor|background colour]] will be used if it's omitted.''
  
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 05:54, 28 April 2014

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.