Bitmap/Flood fill: Difference between revisions

m
Line 306:
static BYTE newColor;
 
 
static void skipLine(FILE* file)
void floodFill(int i, int j)
{
if ( 0 <= i && i < height
&& 0 <= j && j < width
&& bitmap[i][j] == oldColor )
{
bitmap[i][j] = newColor;
floodFill(i-1,j);
floodFill(i+1,j);
floodFill(i,j-1);
floodFill(i,j+1);
}
 
 
/* *****************************************************************************
* Input/output routines.
*/
 
static void skipLine(FILE* file)
{
int c;
Line 323 ⟶ 343:
}
 
void readPortableBitMap(FILE* file)
{
int i,j;
Line 349 ⟶ 369:
fprintf(file,"%1d", bitmap[i][j]);
fprintf(file,"\n");
}
 
void floodFill(int i, int j)
{
if ( 0 <= i && i < height
&& 0 <= j && j < width
&& bitmap[i][j] == oldColor )
{
bitmap[i][j] = newColor;
floodFill(i-1,j);
floodFill(i+1,j);
floodFill(i,j-1);
floodFill(i,j+1);
}
}