This function gets the full abgr 32-bit value of any pixel of a (previously created) surface.
If the surface uses a floating point format, an array will be returned instead, similar to surface_getpixel(). However, as opposed to that function (which only gives you RGB), this function will give you 4 elements in the array (RGBA).
NOTE This function will have a huge performance hit and so should only be used when absolutely necessary.
surface_getpixel_ext(surface_id, x, y);
Argument | Type | Description |
---|---|---|
surface_id | Surface | The surface to use. |
x | Real | The x coordinate of the pixel to check |
y | Real | The y coordinate of the pixel to check |
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 32-bit colour value at the position of the mouse and then split it into its component values, storing them in variables.