That is fine, the code I wrote first checks for collision with the rectangular region of the image, if no collision is detected it discards button and proceeds onto another, if it finds a collision with the rectangle it then checks whether there is a visible image pixel on the coordinates.arampl wrote:Any one of them will reside in the rectangular region of the other one.
I don't believe you understood what is happening, or what you want for that matter.
It works flawlessly even with the stars. What problem are you experiencing?arampl wrote:Now, try your code with this stars:
You only "get" a single pixel, the entire image data is already loaded and stored. The getData call simply gets the reference. And even then it's called only after the mouse coordinates overlap a button. It's extremely miniscule and you won't notice any performance impact even if you had a thousand buttons.arampl wrote:You mean I must get all image pixels each time? Several hundred times * 60 FPS?