draw_getpixel_ext

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

Syntax:

GML Code Example

draw_getpixel_ext(x, y);


Argument Description
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 that is being drawn to the current render target. This means that the results will depend on the event in which the function is called, and also on the target surface being used.

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


Example:

GML Code Example

col = draw_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.





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