Collision Detection with alpha < .5

BlitzMax Forums/BlitzMax Beginners Area/Collision Detection with alpha < .5

ima747(Posted 2008) [#1]
I have 2 images I'm trying to do collision detection on but some of parts of the images have alpha levels less than .5 and therefore don't register the collisions in that part. Is there a simple way to do collision detection without creating a mask image for that? if not, what's the best way to generate the mask image on the fly and do the test?


ImaginaryHuman(Posted 2008) [#2]
Have a duplicate image which doesn't have any alpha channel in the parts you want to collide, and use it for collision testing?


ima747(Posted 2008) [#3]
That would be a mask image esentially. If that is the only way to do the collision detection does anyone have a process to alpha strip an image without digging through the pixmap an generating a new image based on a pixel by pixel alpha test?


GfK(Posted 2008) [#4]
Can't you use SetBlend MASKBLEND or SetBlend SOLIDBLEND before creating the collision layer mask?


ima747(Posted 2008) [#5]
MASKBLEND shows you basicly what the ImagesCollide() uses for it's detection. Anything with alpha of >.5 is solid and anything <.5 is transparent.

SOLIDBLEND gives me a white background with a box the dimensions of the maximum dimensions of the contents of the picture. i.e. if there's a circle centered in the image it makes it a square. If there's a diagonal line across the image it makes a box with the upper left corner the start of the line and the bottom right corner the end of the line. Incidentally this is the same thing that happens if I do a ConvertPixmap and reduce it to 24bit with no alpha channel...

It seems like there should just be a way to do collision detection with transparency below .5 or to re-draw an image without it's alpha data but I can't seem to find it...