surface_getpixel_ext

Returns the full 32bit value for the pixel at a given coordinate on a surface.

Syntax:

surface_getpixel_ext(surface_id, x, y);


Argument Description
surface_id The ID of the surface to use.
x The x coordinate of the pixel to check
y The y coordinate of the pixel to check


Returns: Real


Description

With this function you can get the full abgr 32bit value of any pixel of a (previously created) surface.

NOTE: This function is slow and so should only be used when absolutely necessary.


Example:

col = surface_getpixel_ext(mouse_x, mouse_y);
alpha = (col >> 24) & 255;
blue = (col >> 16) & 255;
green = (col >> 8) & 255;
red = col & 255;

The above code will get the 32bit colour value at the position of the mouse and then split it into its component values, storing them in variables.


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