There's a Pixel collision function in Jedi-SDL I believe, (I don't think I wrote the one I use from scratch.. although it was a long time ago)..

I think you'd be better off looking into that than reinventing the wheel

imho

Welcome to the site BTW