Advertisement
xeromino

kaleido

May 16th, 2015
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. PImage img;
  2.  
  3. void setup() {
  4.   size(800, 800);
  5.   img = loadImage("pic.jpg");
  6.   PImage temp = createImage(400, 400, RGB);
  7.   temp.loadPixels();
  8.   for (int x=0; x<temp.width; x++) {
  9.     for (int y=0; y<temp.height; y++) {
  10.       color c = img.get(x, y);
  11.       temp.set(x, y, c);
  12.     }
  13.   }
  14.   image(temp, 0, 0);
  15.  
  16.   pushMatrix();
  17.   translate(width, 0);
  18.   scale(-1, 1);
  19.   image(temp, 0, 0);
  20.   popMatrix();
  21.  
  22.   pushMatrix();
  23.   translate(0, height);
  24.   scale(1, -1);
  25.   image(temp, 0, 0);
  26.   popMatrix();
  27.  
  28.   pushMatrix();
  29.   translate(width, height);
  30.   scale(-1, -1);
  31.   image(temp, 0, 0);
  32.   popMatrix();
  33.   loadPixels();
  34.   PImage stamp = createImage(width, height, RGB);
  35.   stamp.loadPixels();
  36.   for (int i=0; i<width*height; i++) {
  37.     stamp.pixels[i]=pixels[i];
  38.   }
  39.   stamp.updatePixels();
  40.   //tint(255,0,0);
  41.   //image(stamp,0,0);
  42.   int d = 400;
  43.   for (int x=0; x<width; x+=d) {
  44.     for (int y=0; y<height; y+=d) {
  45.       copy(stamp, 0, 0, width, height, x, y, d, d);
  46.     }
  47.   }
  48. }
  49.  
  50. void draw() {
  51. }
  52.  
  53. void keyPressed() {
  54.   save(random(12345)+".jpg");
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement