Saves a part of a surface to disc.


GML Code Example

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


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).


GML Code 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

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here