1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
PImage degree135; 
PImage userImage;
color c;

void setup() {
  size(800, 600);
  background(255);
  degree135 = loadImage("http://weiserweissman.com/wp-content/uploads/2012/12/St-Teresa-dog-800x600.jpg");
  userImage = loadImage("http://wallpaperscraft.com/image/cheese_mold_olives_food_43409_800x600.jpg");
}

void draw() {
    degree135.loadPixels();
    userImage.loadPixels(); 
    for (int i = 0; i < width *height; i ++) {
      c= degree135.pixels[i]; 
      if ((red(c) + green(c) + blue(c))/ 3 > 120) { // you could use "brightness" instead 
      color newpix =  userImage.pixels[i];
        degree135.pixels[i] = newpix;
      }
    }
  degree135.updatePixels();
  doit = true;
  image(degree135, 0, 0);
}