Can stamp pixel and stays there when cursor moves

I got it the cursor to stamp a pixel on its current coordinates, and
the pixel stays there even if the cursor moves. I still need to find a
way to save the color of the pixel at the time so that all of the
pixels don't change if I change the cursor's custom color.