Difference between revisions of "Paintutils.loadImage"

From ComputerCraft Wiki
Jump to: navigation, search
(Added a link in the exapmles to paintutils.drawImage())
(Fixed incorrect information)
Line 4: Line 4:
 
  |args=[[String_(type)|string]] path
 
  |args=[[String_(type)|string]] path
 
  |api=paintutils
 
  |api=paintutils
  |returns=[[Boolean_(type)|boolean]] true on success, otherwise false
+
  |returns=[[Table_(type)|table]] containing image data on success, otherwise nil.
 
  |addon=ComputerCraft
 
  |addon=ComputerCraft
 
  |desc=Loads an image (images created with the [[Paint|paint]] program)
 
  |desc=Loads an image (images created with the [[Paint|paint]] program)
 
  |examples=
 
  |examples=
 
{{Example
 
{{Example
|desc=The program loads the image 'bar' onto the variable 'image' and then draws it on the screen starting at position {3, 5}
+
|desc=The program loads the image 'bar' onto the variable 'image', and then draws it on the screen starting at position {3, 5} by using [[paintutils.drawImage]].
 
|code=image = [[paintutils.loadImage|paintutils.loadImage("bar")]]
 
|code=image = [[paintutils.loadImage|paintutils.loadImage("bar")]]
 
  [[paintutils.drawImage|paintutils.drawImage(image, 3, 5)]]
 
  [[paintutils.drawImage|paintutils.drawImage(image, 3, 5)]]

Revision as of 20:10, 10 June 2013


Grid Redstone.png  Function paintutils.loadImage
Loads an image (images created with the paint program)
Syntax paintutils.loadImage(string path)
Returns table containing image data on success, otherwise nil.
Part of ComputerCraft
API paintutils

Examples

Grid paper.png  Example
The program loads the image 'bar' onto the variable 'image', and then draws it on the screen starting at position {3, 5} by using paintutils.drawImage.
Code
image = paintutils.loadImage("bar")
paintutils.drawImage(image, 3, 5)