Image.transformBlit

From Spheriki

Jump to: navigation, search

Draw the image on the screen, stretched to given coordinates.


Contents

Usage

image.transformBlit(x1, y1, x2, y2, x3, y3, x4, y4);
  • image Sphere Image object. The image to draw transformed.
  • x1, y1 numbers. Coordinates of where the upper left of the image should be drawn on screen.
  • x2, y2 numbers. The upper right corner on screen.
  • x3, y3 numbers. The lower right corner on screen.
  • x4, y4 numbers. The lower left corner on screen.


Examples

This will load an image, and stretch and flip it upside down on the screen.

function game()
{
  var w = GetScreenWidth();
  var h = GetScreenHeight();
  var img = LoadImage();
  
  // Note the y coordinates are opposite to what they'd normally be.
  img.transformBlit(
      0, h - 1,
      w - 1, h - 1,
      w - 1, 0,
      0, 0 );
  
  FlipScreen();
  GetKey();
}


Notes

  • There is no need for the coordinates to be aligned. Feel free to stretch, rotate and flip the image however you need.


See also

Personal tools