// The function 'droste()' recursively draws an image // over itself, as on the famous Droste chocolate box. // The arguments (tx,ty) tells where on the image a // smaller image must be duplicated, and argument s // tells how much smaller each subsequent image is. // Argument d tells how deep the recursion continues. // // Concept and code by Joris Slob and Maarten Lamers, // 2007. void setup() { PImage m = loadImage("droste2.jpg"); size(m.width, m.height); droste(m, 13, 235, 0.22, 4); } void draw() { } void droste (PImage i, int tx, int ty, float s, int d) { // Draw image i recursively d times, translating // along (tx,ty) and scaling with factor s at each // subsequent recursion. if (d > 0) { image(i, 0, 0); translate(tx, ty); scale(s); droste(i, tx, ty, s, d-1); } }