Februar 23, 2012
Der Filter generiert aus dem Bild durch drücken der Leertaste ein Pixelraster. Dieses Pixelraster lässt sich durch Mausbewegung dazu noch bewegen.PImage img; Pixel[] pixel; int blockWidth, blockHeight; int blockCount = 40; boolean showDogs = true; void setup() { img = loadImage("hunde.jpg"); size(img.width, img.height); blockWidth = img.width / blockCount; blockHeight = img.height / blockCount; loadPicture(); frameRate(30); noStroke(); } void loadPicture() { // new pixels pixel = new Pixel[blockCount*blockCount]; // load picture img.loadPixels(); // get pixels for (int x = 0; x < img.width; x++ ) { for (int y = 0; y <img>> 8) & 0xFF; b += (_c) & 0xFF; } void calcColor() { r /= w*h; g /= w*h; b /= w*h; normalColor = 0xff000000 | (r << 16) | (g << 8) | b; invertColor = 0xff000000 | (255-r << 16) | (255-g < 0 ) { c=normalColor; } else { c =invertColor; } } speed *= friction; } } void display() { fill(c); rect(x, y, actW*2, h); } }