September 26, 2022, 06:52:50 AM

News:

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.

sapero

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;

image.FromFile("image.bmp");
sprite.FromFile("sprite.bmp");
if (image.FindSprite(sprite, &x, &y)) found sprite at x,y

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

pistol350

Regards,

Peter B.