July 13, 2024, 07:32:50 PM


IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!

Searching for sprites in images

Started by sapero, August 26, 2007, 08:13:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


This class is capable to find all matching sprites in a bitmap. Input parameters are two images (sprite should be smaller) and starting scan position X and Y.
On return, the x and y are set to coordinates of the first found sprite, next search should be initialized from x+1.

I've also used IStream interface as string placeholder (see class CStringStream for details)

CFastImage image;
CFastImage sprite;
int x=0, y=0;

if (image.FindSprite(sprite, &x, &y)) found sprite at x,y

while (image.FindSprite(sprite, &x, &y)) { found next sprite at x,y; x++;}



Peter B.