Find the color of the pixel that is clicked with the paint bucket, then for every pixel surrounding it that is the same color, change the color to the new color, and do that for all pixels surrounding those, and so on. By "surrounding", I mean directly to the left, right, top, or bottom of the pixel. No diagonals.