Returns the colour of the pixel displayed at a given coordinate.


GML Code Example

draw_getpixel(x, y);

Argument Description
x The x coordinate of the pixel to check
y The y coordinate of the pixel to check

Returns: Real


With this function you can get the colour 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 that this will not return any alpha values, for that you should use draw_getpixel_ext.

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


GML Code Example


The above code will set the drawing colour for all text, forms and primitives to the colour of the pixel at (500,200) on the game screen.

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