-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDithering.pde
144 lines (104 loc) · 2.85 KB
/
Dithering.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import java.lang.String; //<>// //<>// //<>// //<>// //<>// //<>// //<>// //<>// //<>//
import controlP5.*;
import processing.pdf.*;
import processing.dxf.*;
import processing.svg.*;
DrawingData data;
DataGUI dataGui;
DrawingGenerator drawer;
//SourceFiles sourceFilesGui;
PGraphics current_graphics;
ControlP5 cp5;
void setup()
{
size(1200,800);
data = new DrawingData();
drawer = new DrawingGenerator();
dataGui = new DataGUI();
//drawer.center = new PVector(800,400);
setupControls();
surface.setResizable(true);
//noLoop(); // Run once and stop
}
void setupControls()
{
cp5 = new ControlP5(this);
cp5.getTab("default").setLabel("Hide GUI");
// init loading
data.setImage(data.source_file);
dataGui.setupControls( );
addFileTab();
//sourceFilesGui.setupControls(data, cp5);
//addExportTab();
addFileTab();
cp5.getTab("Image").bringToFront();
}
void updateUI()
{
ui.updateUI();
}
void draw()
{
if (data.Black)
background(255);
else
background(0);
if (data.image != null)
{
drawer.buildBlurredImage();
// draw centered
PImage image = drawer.blurred_image;
float image_w = image.width;
float image_h = image.height;
tint(255, data.ImageAlpha);
image(drawer.blurred_image, width/2 - image_w/2, height/2- image_h/2, image_w, image_h);
}
drawer.buildCells(new PVector(width/2, height/2));
drawer.buildPoints();
if (data.drawCells)
drawer.drawCells();
if (record)
{
// Note that #### will be replaced with the frame number. Fancy!
fileName = "Export/" + data.sketch_name() +"_"+ year() + "-" + month() + "-" + day() + "_" + hour() + "-" + minute() + "-" + second();
if (mode == 0)
beginRecord(PDF, fileName + ".pdf");
else if (mode == 1)
beginRecord(DXF, fileName + ".dxf");
else if (mode ==2)
beginRecord(SVG, fileName + ".svg");
stroke(0);
}
else
stroke(255);
drawer.drawPoints();
if (record)
{
endRecord();
record = false;
}
/*
background(0);
if (record)
{
// Note that #### will be replaced with the frame number. Fancy!
fileName = "Export/Spiral_" + year() + "-" + month() + "-" + day() + "_" + hour() + "-" + minute() + "-" + second();
if (mode == 0)
beginRecord(PDF, fileName + ".pdf");
else if (mode == 1)
beginRecord(DXF, fileName + ".dxf");
else if (mode ==2)
beginRecord(SVG, fileName + ".svg");
stroke(0);
}
else
stroke(255);
spiral.center = new PVector(width/2,height/2);
spiral.data = data;
spiral.draw();
if (record)
{
endRecord();
record = false;
}*/
}