Difference between revisions of "Paintutils.loadImage"

From ComputerCraft Wiki
Jump to: navigation, search
m (Reverted edits by 199.19.105.156 (talk) to last revision by AfterLifeLochie)
 
(8 intermediate revisions by 5 users not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
  |name=paintutils.loadImage
 
  |name=paintutils.loadImage
  |args=( path )
+
  |args={{type|string}} path
 
  |api=paintutils
 
  |api=paintutils
  |returns=True or false
+
  |returns={{type|table}} containing image data on success, otherwise {{type|nil}}.
 
  |addon=ComputerCraft
 
  |addon=ComputerCraft
  |desc=Loads an image created with the built in Advanced Computer program paint.
+
  |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 'foo' and then shows it on screen:
+
|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=foo = paintutils.loadImage("bar")
+
|code= local image = '''paintutils.loadImage("bar")'''
  [[paintutils.drawImage]](foo)
+
  [[paintutils.drawImage]](image, 3, 5)
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:API_Functions]]
 
[[Category:API_Functions]]

Latest revision as of 15:51, 10 April 2014


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
local image = paintutils.loadImage("bar")
paintutils.drawImage(image, 3, 5)