surface_save_part

Saves a part of a surface to disc.

Syntax:

surface_save_part(surface_id, fname, x, y, width, height);


Argument Description
surface_id The ID of the surface to set as the drawing target.
fname The name of the saved image file.
x The starting x position within the surface.
y The starting y position within the surface.
width The width of the part to save.
height The height of the part to save.


Returns: N/A


Description

This function will save a part of a surface to disc using the given filename. The surface must be saved as a *.png format file, and the (x,y) position must be given as local coordinates to the surface, bearing in mind that the top left corner of the surface is always (0,0).


Example:

if keyboard_check_pressed(ord("S")
   {
   surface_save_part(surf, "test.png", 0, 0, 100, 100);
   }

The above code will check to see if the user presses the "S" key on the keyboard and if they do it will save a part of the surface indexed in the variable "surf" to disc.


Back: Surfaces
Next: surface_exists
© Copyright YoYo Games Ltd. 2018 All Rights Reserved