Hello Forum,
I am working with one of the examples from the [Generative Design book](// http://www.generative-gestaltung.de)
and I am trying to make a super hi-res image of the drawings I do. But, the PDF lines are never as delicate as they are in the design window. Does anyone know how to fix this? Thanks in advance for your suggestions.
import processing.pdf.*;
import java.util.Calendar;
boolean recordPDF = false;
ArrayList history = new ArrayList();
float dist = 80;
void setup() {
size(1000,700);
background(255);
stroke(0, 150);
strokeWeight(.01);
noFill();
}
void draw() {
}
void mouseDragged() {
PVector d = new PVector(mouseX, mouseY, 0);
history.add(0, d);
for (int p=0; p<history.size (); p++) {
PVector v = (PVector) history.get(p);
float join = p/history.size() + d.dist(v)/dist;
if (join < random(0.9) && mouseButton == LEFT) {
line(d.x, d.y, v.x, v.y);
}
}
}
void keyPressed() {
if (key == 'x') {
background(255);
history.clear();
}
// ------ pdf export ------
// press 'r' to start pdf recordPDF and 'e' to stop it
// ONLY by pressing 'e' the pdf is saved to disk!
if (key =='r' || key =='R') {
if (recordPDF == false) {
beginRecord(PDF, timestamp()+"_.pdf");
println("recording started");
recordPDF = true;
}
}
else if (key == 'e' || key =='E') {
if (recordPDF) {
println("recording stopped");
endRecord();
recordPDF = false;
background(255);
}
}
}
// timestamp
String timestamp() {
Calendar now = Calendar.getInstance();
return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now);
}