I'm creating a platformer and have implemented per-pixel collision detection. However, this has caused 2 obstacles that I've yet to figure out. The first obstacle, which this question is about, is that I don't know how to efficiently find the point of impact (my other problem will probably be a different question on this StackExchange).
I have my character fall or jump at a given rate in pixels. That is, every frame the character might fall 4 pixels or jump 4 pixels, for instance. If the character falls and intersects an object then the character should land on that object (and vice versa, if they're jumping and hit an object they should start falling again). However, if, for instance, a character falls 4 pixels and this puts them 3 pixels into an object, they'll stop falling but won't be in the proper location. The character should appear to stop at the first pixel of impact.
So, how can I efficiently find the point of impact? I only have a vague idea of only comparing the outline pixels, testing for collision, and incrementing them up or down by one until there's a collision, but it seems like it might be complicated to pull off.
If you want to know the platform, I'm developing using XNA for Windows Phone 7.