pixmap selection with mouse

BlitzMax Forums/BlitzMax Programming/pixmap selection with mouse

You know your pixmaps x/y position and it's width/height.
Check whether mousex() and mousey() is within this rect.
Get the offset if mousex()/mousey() into the pixmap rect.
Check the colour of the pixel at this point.
If it's non-transparent... collision.
Strict
Graphics 800,600,0
Local pixmap1:TPixmap=LoadPixmap("max.png")
Local pixx:Int=200
Local pixy:Int=200
While Not KeyHit(key_escape)
  Cls
  Local mx:Int=MouseX()
  Local my:Int=MouseY()
  DrawPixmap pixmap1,200,200
  If  mx>pixx And mx<pixx+PixmapWidth(pixmap1) And my>pixy And my < pixy+PixmapHeight(pixmap1)
        Local mypixel:Int=ReadPixel(pixmap1,mx-pixx,my-pixy)
        If mypixel<>0 DrawText "COLLISION",0,0
  EndIf  
  Flip
Wend

The image I used here has transparent (0) background,
You'll need to get an argb value from your mask to check for values.