Img:get() function

I am trying to use this function but I would like to have a deeper understanding of how I can use this function, for example can this be used on the entire screen or must I use an image? I know that I can do this but that is about it;

function setup()
    img = readImage("SpaceCute:Icon")
    col = 0"col")

function draw()
    background(0, 0, 0, 255)

function touched(touch)
    col = img:get(touch.x,touch.y)

@Coder Technically, you can get the entire screen. Though, you have to set the screen as a image with setContext().

@Coder- no, you can’t use it on the screen. The screen is not an object that you can read, but just a mess of pixels. If you want to read pixels off the screen, you have to do your drawing on an image (the size of the screen) in memory, using setContext. Then you can read pixels off that image.

Problem is that drawing onto an image and spriting the image onto the screen is pretty slows if you are trying to identify the pixel under a touch, one way to do it, is to draw normally on the screen until there is a touch, then do the next draw onto an image, and look at the pixel in the poisition that was touched.

@Prynok and @Ignatz thank you for clearing that up for me