Legacy:Image/zoomBlit
From Spherical
< Legacy:Image(Redirected from Image.zoomBlit)
Draw the image onto the screen with zooming.
Contents
Usage
image.zoomBlit(x, y, factor);
- image Sphere Image object. The image to draw on screen.
- x number. 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.
- factor number, floating-point. The amount of zooming applied. factor == 1 causes no zoom, 0 < factor < 1 causes the image to shrink, factor > 1 causes the image to enlarge.
Examples
This simple game will take an image and zoom it so that it is stretched to fit the screen.
function game()
{
var w = GetScreenWidth();
var h = GetScreenHeight();
var img = LoadImage("my_test_image.png");
// Calculate by how much to zoom.
var factor = Math.min(w / img.width, h / img.height);
img.zoomBlit(0, 0, factor);
FlipScreen();
GetKey();
}
Notes
- Image.transformBlit() can also be used to achieve zooming, by picking the corner points manually.
See also
- Sphere Image object
- Image.blit()
- Image.transformBlit()
- Image.transformBlitMask()
- FlipScreen()
- GetKey()
- GetScreenHeight()
- GetScreenWidth()
- LoadImage()