In this episode we learn how to read the current mouse position which is stored in the variables mouseX and mouseY. We also learn how to find out if the mouse button is clicked using the mousePressed variable. With this information we make a very simple drawing program.
Then we create a keyPressed() function to detect when the user presses a key on the keyboard. When the user presses a key, we call the save() function to save our drawing to an image file in our hard drive. You later can send the image by e-mail if you want.