/* Image painter jlee2675@ecuad.ca November, 2009 uses the colors from an image to paint on the screen. */ PFont myFont; PImage myImage; float brushSize = 11;//mouse controll the brush size void setup() { size(500,500); background(0); smooth(); //Load the font myFont = createFont("Helvetica", 24); //Type some text on the screen textFont(myFont); textSize(24); fill(244, 40, 0); text("Guess What?", 0, 100); textSize(48); fill(244, 4, 55, 50); text("What is the image under?", 0,200); textSize(72); fill(255, 20, 47, 10); text("OH~", 0,300); //load the image myImage = loadImage ("apple.jpg"); //image( myImage, 0, 0); } void draw() { //set the brush size //if(mousePressed) { //brushSize = brushSize + 1; //} //else if (brushSize > 10) { //brushSize = brushSize -1; //} //find the color under the mouse color myColor = myImage. get(mouseX, mouseY); //use that color to draw a circle fill(myColor, 30); noStroke(); ellipse( mouseX, mouseY, brushSize, brushSize); //paint the image to screen //image( myImage, mouseX, mouseY, 100, 100);//drawing in myimage and put in 0, 0 (square), 100 is pix //image( myImage, random(width), random(height), random(10, 200), random (10,200)); }