@jfperusse@sim - I’ve been playing with a project where different I have coloured images on the screen to select a colour. The current way of identifying the colour chosen is by taking the position of the touch and checking each image positionally and size to confirm the touch selection.
I thought it would be much easier to just request the colour of the pixel under the touch - a bit like image:copy(). The problem with the latter is that you have to create an image to identify it.
My question is - is there a method for simply reading the colour of a pixel ? It would provide a single call with no need for positional input other than the touch itself.
Hi @jfperusse - I’ll try that out but I was under the impression that the word image is replaced with a defined image name - like you put in note. So the image has been defined and named and you are programming to select the properties of a pixel with and x.y coordinate pair.
What if you just wanted to pick a pixel from the screen without a defined image ? Does the screen have an ID that you can use in the fall for getting the pixel values.
i.e. screen:get(x,y)
You could expand that to
screen:get(x,y,w,h) if you wanted to get/define a sprite etc.
The idea would be to create an image the size of the screen, and then do your rendering to the image (using setContext). At the end of your draw(), you can render the image to the screen using sprite(). But this also allows you to read the pixels from that image which represents your screen using get() on that image.