GrabSurface

From Spheriki

Jump to: navigation, search

Grab a section of the screen and put it in a new surface.


Contents

Usage

Surface GrabSurface(x, y, width, height);
  • x Number. Screen X coordinate of the grab rectangle.
  • y Number. Screen Y coordinate of the grab rectangle.
  • width Number, positive. Width of the grab in pixels.
  • height Number, positive. Height of the grab in pixels.
  • Surface is returned, holding the contents of the screen in the box (x, y, width, height).


Examples

Here's how to take a simple screenshot:

var screen_width = GetScreenWidth();
var screen_height = GetScreenHeight();
var screenshot = GrabSurface(0, 0, screen_width, screen_height);
screenshot.save("my_screenshot.png");


Notes

  • If you don't need to work with the grabbed screen section (i.e. just displaying it), consider using GrabImage() instead, since blitting images is slightly faster than blitting surfaces.


See also

Personal tools