topical media & game development

talk show tell print

graphic-processing-algorithm-Ch05-p114-p114.pde / pde



  PImage MyImage = loadImage("memorial.jpg");
  size(MyImage.width, MyImage.height);
  image(MyImage,0,0);
  for(int x=2; x<width-2; x++) //for all rows
    for(int y=2; y<height-2; y++){ //for all columns
      color c = get(x,y);
      //make sure the values fall between 0-255
      int xx = x+int(random(-3,3));
      int yy = y+int(random(-3,3));
      set(xx,yy,c); //color the pixel
      fill(c);
      noStroke();
      rect(xx-5,yy-5,4,4);
    }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.