Difference between revisions of "Legacy:Image/blit"
From Spherical
								
												
				|  (Created page with "Draw the image onto the screen.  =Usage= ::''image''.blit(''x'', ''y'');  * '''image''' Sphere Image object. The image to draw on screen. * '''x''' number. The x coordinat...") |  (added navbox) | ||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| Draw the image onto the screen. | Draw the image onto the screen. | ||
| − | =Usage= | + | ==Usage== | 
| − | + | {{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'''  | + | * '''x''' integer. The x coordinate of the top-left corner of the drawn image. | 
| − | * '''y'''  | + | * '''y''' integer. The y coordinate of the top-left corner of the drawn image. | 
| − | =Examples= | + | ==Examples== | 
| This simple game will take an image and blit it onto the screen.. | This simple game will take an image and blit it onto the screen.. | ||
| Line 29: | Line 29: | ||
| − | =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   | 
| + | * [[API:Image/blitMask|Image.blitMask]]() | ||
| − | * [[ | + | * [[API:FlipScreen|FlipScreen]]() | 
| + | * [[API:GetKey|GetKey]]() | ||
| + | * [[API:GetScreenHeight|GetScreenHeight]]() | ||
| + | * [[API:GetScreenWidth|GetScreenWidth]]() | ||
| + | * [[API:LoadImage|LoadImage]]() | ||
| − | + | ||
| − | + | {{API:Image/navbox}} | |
| − | |||
| − | |||
| − | |||
Latest revision as of 18:21, 22 May 2013
Draw the image onto the screen.
Contents
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
- Sphere image object
- Image.blitMask()
- FlipScreen()
- GetKey()
- GetScreenHeight()
- GetScreenWidth()
- LoadImage()

