8-CONNECTED PIXELS In an 8-connected pixel neighborhood, each pixel is considered connected to all of its immediate neighbors, including the diagonals. This means that for a pixel, it is connected to its neighbors in all 8 directions (up, down, left, right, and diagonals). ALGORITHM: Floodfill (x, y,fill_ color, old_color: integer) If (getpixel (x, y)=old_color) { setpixel (x, y, fill_color); FloodFill (x + 1, y, targetColor , fillColor ) FloodFill (x - 1, y, targetColor , fillColor ) FloodFill (x, y + 1, targetColor , fillColor ) FloodFill (x, y - 1, targetColor , fillColor ) FloodFill (x + 1, y + 1, targetColor , fillColor ) FloodFill (x - 1, y + 1, targetColor , fillColor ) FloodFill (x + 1, y - 1, targetColor , fillColor ) FloodFill (x - 1, y - 1, targetColor , fillColor ) }