-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass_Trynew.pde
63 lines (55 loc) · 1.62 KB
/
class_Trynew.pde
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class Trynew {
float x, y, r;
PFont myFont;
Trynew(float x, float y, float r) {
this.x = x;
this.y = y;
this.r = r;
image(targetImg, 0, 0);
}
void show() {
image(img, 0, 0);
img.resize(width, height);
if (mousePressed) {
if (mouseX>450 && mouseX <550 && mouseY > 30 && mouseY <60) {
int n1 = 181;
int n2 = 363;
int n3 = 545;
int n4 = 765;
for (int x = 0; x <img.width; x++) {
for (int y = 0; y <img.height; y++) {
int loc = x + y * img.width;
float r =red (img.pixels[loc]);
float g = green (img.pixels[loc]);
float b = blue (img.pixels[loc]);
float sum = r+g+b;
if (sum <=n1) {
color c = color(255, 230, 255);
img.pixels[loc] = c;
} else if (sum <= n2) {
color c = color(128, 0, 0);
img.pixels[loc] = c;
} else if (sum <=n3) {
color c = color(153, 204, 255);
img.pixels[loc]= c;
} else if (sum <= n4) {
color c = color(255, 204, 0);
img.pixels[loc] = c;
}
//float changeBrightness = map(v1,0,0,10,10);
/*r = constrain(r, 0, 255);
g = constrain(g, 0, 255);
b = constrain(b, 0, 255);*/
//make a nes color and set pixel in the window
}
}
}
}
/*if(mouseX>550 && mouseX < 650 && mouseY > 30 && mouseY < 60){
img.save(imgName+"_new.jpg");
//println("brightness");
}*/
// noLoop();
println("brightness");
}
}