Difference between revisions of "Paintutils (API)"
From ComputerCraft Wiki
(use API table template) |
MKlegoman357 (Talk | contribs) m (Expanded) |
||
Line 1: | Line 1: | ||
− | Paintutils is a default API for advanced | + | Paintutils is a default API for advanced systems which can draw [[paintutils.drawPixel|pixels]] and [[paintutils.drawLine|lines]], [[paintutils.loadImage|load]] and [[paintutils.drawImage|draw]] image files. Use [[Colors (API)|colors API]] for easier color manipulation. |
{{API table|Paintutils|image=Grid disk.png|2= | {{API table|Paintutils|image=Grid disk.png|2= | ||
{{API table/row | {{API table/row | ||
− | |[[paintutils.loadImage]]({{type|string}} path)|{{type|table}} image | + | |[[paintutils.loadImage]]({{type|string}} path) |
− | | | + | |{{type|table}} image |
+ | |Loads and returns an image object from <var>path</var>. | ||
|odd}} | |odd}} | ||
{{API table/row | {{API table/row | ||
− | |[[paintutils.drawImage]]({{type|table}} image, {{type|number}} x, {{type|number}} y)|{{type|nil}} | + | |[[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. | |Draws an image at (<var>x</var>, <var>y</var>) where <var>image</var> is an image object. | ||
|}} | |}} | ||
{{API table/row | {{API table/row | ||
− | |[[paintutils.drawPixel]]({{type|number}} x, {{type|number}} y, {{type|number}} | + | |[[paintutils.drawPixel]]({{type|number}} x, {{type|number}} y [<nowiki/>, {{type|number}} color]) |
− | |Draws a pixel at (<var>x</var>, <var>y</var>) | + | |{{type|nil}} |
+ | |Draws a pixel at (<var>x</var>, <var>y</var>). If <var>color</var> specified draws it in that color. | ||
|odd}} | |odd}} | ||
{{API table/row | {{API table/row | ||
− | |[[paintutils.drawLine]]({{type|number}} startX, {{type|number}} startY, {{type|number}} endX, {{type|number}} endY, {{type|number}} color)|{{type|nil}} | + | |[[paintutils.drawLine]]({{type|number}} startX, {{type|number}} startY, {{type|number}} endX, {{type|number}} endY [<nowiki/>, {{type|number}} color]) |
− | |Draws a line from (<var>startX</var>, <var>startY</var>) to (<var>endX</var>, <var>endY</var>) | + | |{{type|nil}} |
+ | |Draws a line from (<var>startX</var>, <var>startY</var>) to (<var>endX</var>, <var>endY</var>). If <var>color</var> specified draws it in that color. | ||
|}} | |}} | ||
Revision as of 16:17, 10 April 2014
Paintutils is a default API for advanced systems which can draw pixels and lines, load and draw image files. Use colors API for easier color manipulation.
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). If color specified draws it in that color. |
paintutils.drawLine(number startX, number startY, number endX, number endY [, number color]) | nil | Draws a line from (startX, startY) to (endX, endY). If color specified draws it in that color. |