buffer_get_surface

Copy surface data to a buffer.

Syntax:

buffer_get_surface(buffer, surface, mode, offset, modulo);


Argument Description
buffer The index of the buffer to use.
surface The index of the surface to use.
mode The data to get from the surface (see the list of constants below).
offset The data offset value.
modulo The offset from the end of the line to the start of the next


Returns: N/A


Description

With this function you can write the information from a surface to a given buffer. The buffer must have been created previously and should be a 1byte aligned grow buffer of an approximate size (in bytes) of the surface you are going to write. You can choose the copy "mode" for the data being stored which is set by the constants listed below, as well as the offset and modulo values. Both offset and modulo are byte values, with the offset defining the start position within the buffer and modulo being the number of bytes left at the end of every line (for storing additional data). Note that the function writes each pixel of the surface to the buffer using a BGRA formatting on the Windows target, but on other targets it may be different depending on the OS or even the device.

Constant Description
0 Copies all data from the surface.


Example:

buffer_get_surface(buff, application_surface, 0, 0, 0);

The above code will copy the data stored in the application surface to the buffer indexed in the variable "buff" with no offset or modulo values.


Back: Buffers
Next: buffer_set_surface
© Copyright YoYo Games Ltd. 2018 All Rights Reserved