Difference between revisions of "Paintutils.drawImage"

From ComputerCraft Wiki
Jump to: navigation, search
m (Made a link to itself)
(Fixes and clarifications)
Line 2: Line 2:
 
{{Function
 
{{Function
 
  |name=paintutils.drawImage
 
  |name=paintutils.drawImage
  |args=[[Variable]] image handle, [[Int_(type)|int]] x-position, int y-position
+
  |args=[[Table_(type)|table]] image handle, [[Int_(type)|int]] x-position, [[Int_(type)|int]] y-position
 
  |api=paintutils
 
  |api=paintutils
  |returns=[[Boolean_(type)|boolean]] true on success, otherwise false
+
  |returns=[[Boolean_(type)|boolean]] true on success, otherwise false.
 
  |addon=ComputerCraft
 
  |addon=ComputerCraft
  |desc=Draws an image at x and y (images created with the [[Paint|paint]] program).
+
  |desc=Draws an image whose top left corner is at x and y (images created with the [[Paint|paint]] program, then loaded using [[paintutils.loadImage]]).
 
  |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' (using [[paintutils.loadImage]]) onto the variable 'image', and then draws it on the screen, starting at position {3, 5}.
 
|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:13, 10 June 2013


Grid Redstone.png  Function paintutils.drawImage
Draws an image whose top left corner is at x and y (images created with the paint program, then loaded using paintutils.loadImage).
Syntax paintutils.drawImage(table image handle, int x-position, int y-position)
Returns boolean true on success, otherwise false.
Part of ComputerCraft
API paintutils

Examples

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