Get pixel
Jump to navigation
Jump to search
Definition
INT get_pixel ( <INT x> , <INT y> )
Returns the color of the specified pixel on the background. Is equivalent to map_get_pixel( 0, 0, x, y ).
Parameters
INT x | - The X-coordinate of the pixel the color is wanted. |
INT y | - The Y-coordinate of the pixel the color is wanted. |
Returns
INT : The color
Example
import "mod_video" import "mod_wm" import "mod_draw" import "mod_map"; import "mod_screen"; import "mod_mouse"; Process Main() Begin set_mode(640,480,16); // Creates a white box as mouse's cursor mouse.graph = new_map(20,20,16); map_clear(0,mouse.graph,rgb(255,255,255)); // This area will show the pixel's color behind the cursor graph=new_map(100,50,16); x=50; y=25; //Puts the background put_screen(0,load_png("image.png")); Repeat map_clear(0,graph,get_pixel(mouse.x,mouse.y)); frame; Until(exit_status) End
Used in example: set_mode(), new_map(), map_clear(), put_screen(), get_pixel()
Mod_draw | |
Functions | Deletedraw()Drawbox()Drawcircle()Drawcurve()Drawfcircle()Drawline()Drawrect()Drawingalpha()Drawingcolor()Drawingmap()Drawingstipple()Drawingz()Getpixel()Mapgetpixel()Mapputpixel()Movedraw()Putpixel() |