Sorry, but it works now.
( I don’t what I have done wrong befoire :(.
The stop color is 0,0,0.
void floodfill(SDL_Surface *s,int x,int y,Uint8 r,Uint8 g,Uint8 b) {
Uint8 rg,gg,bg;
if (x<0 || y<0 || x>=s->w || y>=s->h ) return;
getRbgPixels(s,x,y,&rg,&gg,&bg);
if (rg==0 && gg== 0 && bg== 0 ) return;
if (rg==r && gg== g && bg== b ) return;
setRbgPixels(s,x,y,r,g,b);
floodfill(s,x+1,y,r,g,b);
floodfill(s,x-1,y,r,g,b);
floodfill(s,x,y+1,r,g,b);
floodfill(s,x,y-1,r,g,b);
}
charles.