/** * Drill Block by Robert Twomey * renders an image as varying sized circles, to be cnc routed * */ PImage a; int x, y, xstart, ystart, w, h; boolean drawnext; int t, b, l, r; int cart_x, cart_y, cart_w, cart_h; void setup() { //a = loadImage("eames.jpg"); a = loadImage("six.jpg"); //a = loadImage("three_one_640x480.png"); //a = loadImage("six_160_10levels.jpg"); //size(a.width*5, a.height*5); size(1280, 720); noStroke(); background(255); smooth(); xstart=300; ystart=120; w=160; h=120; x=xstart; y=ystart; drawnext=false; cart_x=width-(a.width/4)-20; cart_y=height-(a.height/4)-20; cart_w=a.width/4; cart_h=a.height/4; drawCartoon(); } void keyPressed() { drawnext = true; } void mousePressed() { l=mouseX; t=mouseY; drawnext=false; } void mouseDragged() { r=mouseX; b=mouseY; } void mouseReleased() { if(b=xstart+w) { x=xstart; y+=1; if(y>=ystart+h) { y=ystart; drawnext=false; } } } //drawnext=false; } void drawCartoon() { image(a, cart_x, cart_y, cart_w, cart_h); stroke(0); noFill(); rect(cart_x, cart_y, cart_w, cart_h); stroke(255, 255, 0); rect(l, t, (r-l), (b-t)); PImage z = a.get(xstart, ystart, w, h); image(z, width-z.width*4-20, height-(a.height/4)-40-z.height*4, z.width*4, z.height*4); }