One pixel colliding with image

BlitzMax Forums/BlitzMax Programming/One pixel colliding with image

Pineapple(Posted 2010) [#1]
How can I check if a single pixel is overlapping an image considering alpha transparency without too large a hit on performance?


matibee(Posted 2010) [#2]
Will the image be rotated and scaled?? If not, keep a copy in system memory with a TPixmap and look directly into that, taking into account it's relative position on screen and the pixel you're looking at; ie If the image is drawn at 100,100 and your pixel is at screen position 140,125, look into the pixmap at (40,25).


Zeke(Posted 2010) [#3]
use 1x1 size image and use imagescollide() if no rotation, or if rotation use imagescollide2()

small example:



GfK(Posted 2010) [#4]
Are you using collision layers?

If so, the easiest way it to use:
CollideRect(MouseX(),MouseY(),1,1,layerID%,0)



ImaginaryHuman(Posted 2010) [#5]
The fastest way by far is you use a pixmap in main memory and use pointers to access the pixels to find out if they collide.