PImage foto; void setup() { size(336, 160); noStroke(); noLoop(); // draw() wird nur einmal ausgeführt! foto = loadImage("btk.jpg"); background(0); } void draw() { image(foto, 0, 0); int boxSize = 5; // Geschachtelte Schleife, die über die gesamte Zeichenfläche // in beiden Dimensionen geht (Vgl. Übung G4) for (int x = 0; x < width; x += boxSize) { for (int y = 0; y < height; y += boxSize) { // Farbe von aktueller Position wird verwendet // (ähnlich Photoshop's ColorPicker) color c = get(x, y); fill(c); rect(x, y, boxSize, boxSize); } } }