/* Matt Martell IAT 800 - Dr. Christopher Shaw Due Oct. 27, 2008 A3-01 - Create a subclass of PImage that implements a mosaic(int blockSize) method. The blockSize parameter specifies how big the mosaic block is (e.g. blockSize = 4 would mean the mosaic block size is 4 pixels by 4 pixels). The mosaic method should replace each block of pixels in the image (e.g. if blockSize = 4, each block of 4 by 4 pixels) with the average color value of the pixels in that block. Look at the Pixelate->Mosaic filter in photoshop for an example of what this image operation does. Demonstrate your new class by drawing an image with several different block sizes. Image taken by Matt Martell Help with code provided by Hon Lam */ void setup() { size(600,450); Paris = loadImage("data/Paris.jpg"); } int blockSize = 1; PImage Paris; void draw() { Pixelate newParis = new Pixelate(Paris); newParis.pixelate(blockSize); } //Use the UP/DOWN arrow keys to increase/decrease pixelation void keyPressed (){ if (keyPressed) { if (key == CODED) { if (keyCode == UP && blockSize >=1) { blockSize = blockSize + 2; } else if (keyCode == DOWN && blockSize > 1) { blockSize = blockSize - 2; } } } } //enact the pixelation class Pixelate extends PImage { Pixelate (PImage Paris) { width=Paris.width; height=Paris.height; } void pixelate(int blockSize) { for (int x=0; x