Difference between revisions of "Legacy:Image/blit"

From Spherical
Jump to: navigation, search
m (Apollolux moved page Image.blit to API:Image/blit: API convention)
(API convention)
Line 2: Line 2:
  
 
=Usage=
 
=Usage=
::''image''.blit(''x'', ''y'');
+
{{Usage|object=image|func=blit|params=x, y}}
  
* '''image''' Sphere [[Image]] object. The image to draw on screen.
+
* '''image''' Sphere [[API:Image|Image]] object. The image to draw on screen.
* '''x''' number. The x coordinate of the top-left corner of the drawn image.
+
* '''x''' integer. The x coordinate of the top-left corner of the drawn image.
* '''y''' number. The y coordinate of the top-left corner of the drawn image.
+
* '''y''' integer. The y coordinate of the top-left corner of the drawn image.
  
 
=Examples=
 
=Examples=
Line 31: Line 31:
 
=Notes=
 
=Notes=
  
* [[Image.blitMask]]() can also be used to blit an image to the screen, but with a tinting color.  
+
* [[API:Image/blitMask|Image.blitMask]]() can also be used to blit an image to the screen, but with a tinting color.  
  
  
 
=See also=
 
=See also=
  
* Sphere [[Image]] object  
+
* Sphere [[API:Image|image]] object  
  
* [[Image.blitMask]]()
+
* [[API:Image/blitMask|Image.blitMask]]()
  
* [[FlipScreen]]()
+
* [[API:FlipScreen|FlipScreen]]()
* [[GetKey]]()
+
* [[API:GetKey|GetKey]]()
* [[GetScreenHeight]]()
+
* [[API:GetScreenHeight|GetScreenHeight]]()
* [[GetScreenWidth]]()
+
* [[API:GetScreenWidth|GetScreenWidth]]()
* [[LoadImage]]()
+
* [[API:LoadImage|LoadImage]]()
 +
 
 +
[[Category:Functions]]

Revision as of 18:28, 21 May 2013

Draw the image onto the screen.

Usage

image.blit(x, y);


  • image Sphere Image object. The image to draw on screen.
  • x integer. The x coordinate of the top-left corner of the drawn image.
  • y integer. The y coordinate of the top-left corner of the drawn image.

Examples

This simple game will take an image and blit it onto the screen..

function game()
{
  var w = GetScreenWidth();
  var h = GetScreenHeight();
  var img = LoadImage("my_test_image.png");
  
  //Blit the image.
  img.blit(16, 16);
  
  FlipScreen();
  GetKey();
}


Notes

  • Image.blitMask() can also be used to blit an image to the screen, but with a tinting color.


See also