a comment to make and a question.
Comment: Something you could try is separate the if statement onto 2 separate lines like this:
if (surface.GetPixel(cx, cy) == c[n])
surface.DrawPixel(cx, cy);
Then put a breakpoint on the surface.DrawPixel function so you could tell if the if statement is EVER true. Might help you narrow down the problem.
Question: If the loop takes (lets say 2 seconds to run), during those 2 seconds does the game lock up or does it continue to redraw the screen. If so would that mess up the "surface" object? I am not that familiar with GetPixel and DrawPixel but wondering what happens when loops take too long for the program to refresh the screen at 40 frames per second.
Comment: Something you could try is separate the if statement onto 2 separate lines like this:
if (surface.GetPixel(cx, cy) == c[n])
surface.DrawPixel(cx, cy);
Then put a breakpoint on the surface.DrawPixel function so you could tell if the if statement is EVER true. Might help you narrow down the problem.
Question: If the loop takes (lets say 2 seconds to run), during those 2 seconds does the game lock up or does it continue to redraw the screen. If so would that mess up the "surface" object? I am not that familiar with GetPixel and DrawPixel but wondering what happens when loops take too long for the program to refresh the screen at 40 frames per second.