GMU:Processing im Park/Sina Stolp/raster code

From Medien Wiki
PImage img;
int columns = 10;
int rows = 15;
int tiles = columns * rows;


PImage[] parts = new PImage[tiles];

int dx;
int dy;

void setup() {
   
  size(480, 720);
  dx = 480 / columns;
  dy = 720 / rows;
  
  img = loadImage("r09.jpg");
  image(img, 0, 0, width, height);
 
  // get the parts
  for(int i=0; i < tiles; i++) {
    int x = (i % columns) * dx;
    int y = (i / columns) * dy;
    parts[i] = get(x, y, dx, dy);
  }
  
  noLoop();
}

void draw() {
  
  background(0);
  
 for(int i=0; i < tiles; i++) {
   
 int x = (i % columns) * dx;
 int y = (i / columns) * dy;
 
 int index = int(random(tiles));
 //int index = int(random(tiles));
 
 index = index % tiles;
 
 image(parts[index], x, y);
 }
}