-
Notifications
You must be signed in to change notification settings - Fork 0
/
Inspector.pde
92 lines (77 loc) · 2.41 KB
/
Inspector.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
class Inspector {
final boolean noise = false;
final boolean drawAllParameters = true;
final boolean drawID = true;
private ArrayList<String> metadata = new ArrayList<String>();
StageInfo inspect(Poster poster, int posterCount) {
log.print("insepcting the poster...");
poster.content.beginDraw();
poster.content.fill(poster.colorScheme.textColor);
poster.content.textSize(posterHeight*0.006688);
int y, textRectHeight;
int yAlign;
if (poster.grids.get(0).contentType=="letters") {
yAlign = BOTTOM;
y = posterHeight - poster.padding;
textRectHeight = -1000;
} else {
yAlign = TOP;
y = poster.padding;
textRectHeight = 1000;
}
if (drawAllParameters) {
for (int i = 0; i < metadata.size(); i++) {
poster.content.textAlign(LEFT, yAlign);
poster.content.text(metadata.get(i), poster.padding + i * (posterWidth/metadata.size()), y, posterWidth/metadata.size(), textRectHeight);
}
}
//if (drawID) {
// if (poster.grids.get(0).contentType=="letters") {
// yAlign = TOP;
// y = 0;
// } else {
// yAlign = BOTTOM;
// y = posterHeight;
// }
// poster.content.textSize(posterHeight * 0.015);
// poster.content.textAlign(RIGHT, yAlign);
// poster.content.text("ID: #" + posterCount + " " + hour() + ":" +minute() + ", " +month() + "/" + day(), posterWidth, y);
//}
poster.content.endDraw();
if (noise) {
addNoise(poster);
}
String details = "Inspected";
StageInfo stageInfo = new StageInfo(details);
log.print("inspection finished");
return stageInfo;
}
public void addToMeta(String s) {
metadata.add(s);
}
void reset() {
metadata.clear();
}
void addNoise(Poster poster) {
float noiseOpacity = 0.1;
PGraphics noise = createGraphics(posterWidth/10, posterHeight/10);
noise.beginDraw();
noise.beginShape(POINTS);
for (int x = 0; x < noise.width; x++) {
for (int y=0; y< noise.height; y++) {
if (random(0, 1)>0.5) {
noise.stroke(255, 255*noiseOpacity);
} else {
noise.stroke(0, 255*noiseOpacity);
}
noise.point(x, y);
}
}
noise.endShape();
noise.endDraw();
poster.content.beginDraw();
//poster.content.blendMode(MULTIPLY);
poster.content.image(noise, 0, 0, posterWidth, posterHeight);
poster.content.endDraw();
}
}