Surface.blitSurface

From Spheriki

Jump to: navigation, search

Draw the surface onto another surface starting at the specified coordinates.


Contents

Usage

surface.blitSurface(surface_object, x, y);
  • surface Sphere Surface object. The surface to draw on.
  • surface_object Sphere Surface object. The surface to draw on the surface_object.
  • x number. X coordinate to draw the surface, in pixels.
  • y number. Y coordinate to draw the surface, in pixels.

Examples

Surface.blitSurface() can be used similarly to Image.blit(), but onto a surface instead of the screen:


var surface1 = CreateSurface(100, 100, CreateColor(0, 0, 0, 255))   //creates a black surface 100 by 100 pixels
var surface2 = CreateSurface(10, 10, CreateColor(255, 0, 0, 255))   //creates a red surface 10 by 10 pixels
// Draw surface2 on surface1:
surface1.blitSurface(surface2, 45, 45)
// Draw the modified surface1 to the screen
surface1.blit(0, 0);

Notes

  • Although surfaces can be drawn just like images, it is faster to convert a surface into an image if you intend to blit it multiple times.
  • Drawing a surface with alpha levels below 255 on another surface will blend the surfaces.


See also


Personal tools