Fast checking of overlaps before blitting

I’m trying to write a bit of code that takes a (large) list
of surfaces and blits them onto a large empty surface in
semi-random positions.

Is there an efficient way to test if blitting an image in
the currently selected position will overlap a previously
blitted image?

One method would be to check each image’s position
against every other image on the list, but this would
be terribly inefficient (there will be up to and possibly
over 1000 images on the list).

Any thoughts would be appreciated.
MC

A coverage buffer can be used.

Or a bit mask where each pixel is only 1 bit.On 5/22/06, mal content <artifact.one at googlemail.com> wrote:

I’m trying to write a bit of code that takes a (large) list
of surfaces and blits them onto a large empty surface in
semi-random positions.

Is there an efficient way to test if blitting an image in
the currently selected position will overlap a previously
blitted image?

One method would be to check each image’s position
against every other image on the list, but this would
be terribly inefficient (there will be up to and possibly
over 1000 images on the list).

Any thoughts would be appreciated.
MC


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl