IonicWind Software

Aurora Compiler => Tips and Tricks => Topic started by: sapero on August 26, 2007, 08:13:23 AM

Title: Searching for sprites in images
Post by: sapero on August 26, 2007, 08:13:23 AM
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++;}
Title: Re: Searching for sprites in images
Post by: pistol350 on August 30, 2007, 06:38:06 PM
Really impressive!