Advertisement
xeromino

renaissance

Mar 7th, 2015
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. PImage img1, img2, src;
  2.  
  3. void setup() {
  4.   img1 = loadImage("raf.jpg");
  5.   img2 = loadImage("rem.jpg");
  6.   size(img1.width, img1.height);
  7.   colorMode(HSB, 255);
  8. }
  9.  
  10. void draw() {
  11. }
  12.  
  13. void mouseReleased() {
  14.   doStuff();
  15. }
  16.  
  17. void keyPressed() {
  18.   save(random(3434)+".jpg");
  19. }
  20.  
  21. void doStuff() {
  22.   int slice=width/5;
  23.  
  24.   for (int x=0; x<=width; x+=slice) {
  25.     for (int y=0; y<=height; y+=slice) {
  26.       if (random(1)>.5) {
  27.         src=img1;
  28.         copy(src, x, y, slice, slice, x, y, slice, slice);
  29.       } else {
  30.         for (int px=x; px<=x+slice; px++) {
  31.           for (int py=y; py<=y+slice; py++) {
  32.             color col1= img1.get(px, py);
  33.             color col2 =img2.get(px, py);
  34.             float h = hue(col1);
  35.             float s = saturation(col2);
  36.             float b = brightness(col2);
  37.             color col3 = color(h, s, b);
  38.             set(px, py, col3);
  39.           }
  40.         }
  41.       }
  42.     }
  43.   }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement