Difference between revisions of "Paintutils (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m (Removed the NeedsWork (it no longer explained what needed work), adjusted column widths, changed int to number, added <em> tags.)
(use API table template)
Line 1: Line 1:
 
Paintutils is a default API for advanced computers which can draw pixels and lines, and load and draw image files.
 
Paintutils is a default API for advanced computers which can draw pixels and lines, and load and draw image files.
  
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;">
+
{{API table|Paintutils|image=Grid disk.png|2=
<tr><td colspan="2" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;">
+
[[File:Grid_disk.png|24px]]&nbsp;&nbsp;
+
Paintutils (API)
+
</td></tr>
+
  
<tr><td style="width: 550px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr>
+
{{API table/row
 +
|[[paintutils.loadImage]]({{type|string}} path)|{{type|table}} image
 +
|Returns an image object from <var>path</var>.
 +
|odd}}
  
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[paintutils.loadImage]]({{type|string}} path)</td>
+
{{API table/row
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns an image object from <em>path</em>.</td></tr>
+
|[[paintutils.drawImage]]({{type|table}} image, {{type|number}} x, {{type|number}} y)|{{type|nil}}
 +
|Draws an image at (<var>x</var>, <var>y</var>) where <var>image</var> is an image object.
 +
|}}
  
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[paintutils.drawImage]]({{type|table}} image, {{type|number}} x, {{type|number}} y)</td>
+
{{API table/row
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Draws an image at (<em>x</em>, <em>y</em>) where <em>image</em> is an image object.</td></tr>
+
|[[paintutils.drawPixel]]({{type|number}} x, {{type|number}} y, {{type|number}} colour)|{{type|nil}}
 +
|Draws a pixel at (<var>x</var>, <var>y</var>) in the specified <var>colour</var>.
 +
|odd}}
  
<tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[paintutils.drawPixel]]({{type|number}} x, {{type|number}} y, {{type|number}} colour)</td>
+
{{API table/row
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Draws a pixel at (<em>x</em>, <em>y</em>) in the specified <em>colour</em>.</td></tr>
+
|[[paintutils.drawLine]]({{type|number}} startX, {{type|number}} startY, {{type|number}} endX, {{type|number}} endY, {{type|number}} color)|{{type|nil}}
 +
|Draws a line from (<var>startX</var>, <var>startY</var>) to (<var>endX</var>, <var>endY</var>) in the specified <var>colour</var>.
 +
|}}
  
<tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[paintutils.drawLine]]({{type|number}} startX, {{type|number}} startY, {{type|number}} endX, {{type|number}} endY, {{type|number}} color)</td>
+
}}
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Draws a line from (<em>startX</em>, <em>startY</em>) to (<em>endX</em>, <em>endY</em>) in the specified <em>colour</em>.</td></tr>
+
 
+
</table>
+
  
  
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 21:48, 14 September 2013

Paintutils is a default API for advanced computers which can draw pixels and lines, and load and draw image files.

Grid disk.png  Paintutils (API)
Function Return values Description
paintutils.loadImage(string path) table image 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 colour) nil Draws a pixel at (x, y) in the specified colour.
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 colour.