Or you could do this...
function pixelcol(sp1,sp2)
`load sprite images into memory
make memblock from image 1,sprite image(sp1)
make memblock from image 2,sprite image(sp2)
`store image sizes
sw1=memblock dword(1,0)
sh1=memblock dword(1,4)
sw2=memblock dword(2,0)
sh2=memblock dword(2,4)
`store image positions
x1=sprite x(sp1)-sprite offset x(sp1)
y1=sprite y(sp1)-sprite offset y(sp1)
x2=sprite x(sp2)-sprite offset x(sp2)
y2=sprite y(sp2)-sprite offset y(sp2)
`calculate collision rectangle
rx1=getmax(x1,x2)
ry1=getmax(y1,y2)
rx2=getmin(x1+sw1-1,x2+sw2-1)
ry2=getmin(y1+sh1-1,y2+sh2-1)
`calculate area of first sprite that has overlapped second
sx1=rx1-x1
sy1=ry1-y1
ex1=rx2-x1
ey1=ry2-y1
`calculate area of second sprite that has overlapped first
sx2=rx1-x2
sy2=ry1-y2
ex2=rx2-x2
ey2=ry2-y2
`check through both sprites to see if any pixels collide
for row=0 to ey1-sy1
for col=0 to ex1-sx1
` bit1=memblock dword(1,12+((row+sy1)*(sw1*4))+((col+sx1)*4))
` bit2=memblock dword(2,12+((row+sy2)*(sw2*4))+((col+sx2)*4))
bit1=memblock byte(1,12+((row+sy1)*(sw1*4))+((col+sx1)*4)+3)
bit2=memblock byte(2,12+((row+sy2)*(sw2*4))+((col+sx2)*4)+3)
` AND bits together to see if a collision has occured
if bit1&&bit2
`Collision has occured
collision=1
`Clean up memblocks and return
delete memblock 1
delete memblock 2
exitfunction 1
endif
next col
next row
`no collision clean up memblocks and return
delete memblock 1
delete memblock 2
endfunction 0
function getmax(v1,v2)
`Calculate the larger of 2 numbers
if v1>v2
exitfunction v1
else
exitfunction v2
endif
endfunction v1
function getmin(v1,v2)
`calculate the smaller of 2 numbers
if v1<v2
exitfunction v1
else
exitfunction v2
endif
endfunction v1
This works nicely, and is pretty fast.
I do see what you're talking about though. The answer is vector collision, like PlayBasic does. Basically, you define the shape of the collidable as a vector image, or a collection of points relative to the shape of the sprite that define the vector.
Collision is as perfect as the vector image (which is 99% perfect if you do it right), scalable, can rotate, and is extremely fast. Someone should write a vector collision plugin for DBP rather than pixel perfect collision, because this is too easy, as in the example above.
That code works with transparent PNGs. If the opacity of a pixel is 0, it is not counted.

Come see the WIP!