-
flood fills?
Can anyone tell me what the problems are with this Algorithm? (a lot of graphics primitives work lately)
Code:
PHP Code:
if(x < 0 || x > surface->w || y < 0 || y > surface->h)
return;
if(GetPixel(surface,x,y) == oldColor)
{
DrawPixel(surface,x,y,newColor);
DoFill(surface,x+1,y,newColor,oldColor);
DoFill(surface,x-1,y,newColor,oldColor);
DoFill(surface,x,y+1,newColor,oldColor);
DoFill(surface,x,y-1,newColor,oldColor);
}
or feel free to suggest new algorithims or resources on flood fills
-