From 083d76b6125a817a39af8d3f02f3243549ee0a04 Mon Sep 17 00:00:00 2001 From: Yong Bakos Date: Fri, 5 Apr 2013 12:35:37 -0600 Subject: [PATCH] Adding pdf library imports so the examples work. References processing/processing_web#45 --- .../Illustrations/page_290/page_290.pde | 11 ++++++----- .../Illustrations/page_300/page_300.pde | 13 +++++++------ .../Illustrations/page_420/page_420.pde | 9 +++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/java/examples/Books/Processing Handbook/Illustrations/page_290/page_290.pde b/java/examples/Books/Processing Handbook/Illustrations/page_290/page_290.pde index 6840533b2..1234f6316 100755 --- a/java/examples/Books/Processing Handbook/Illustrations/page_290/page_290.pde +++ b/java/examples/Books/Processing Handbook/Illustrations/page_290/page_290.pde @@ -1,6 +1,7 @@ // Based on code 32-07 (p. 297) +import processing.pdf.*; float inc = 0.0; @@ -12,11 +13,11 @@ void setup() { } void draw() { - + if(record) { beginRecord(PDF, "page_290.pdf"); } - + stroke(0, 143); randomSeed(0); background(255); @@ -33,12 +34,12 @@ void draw() { tail(i, 300, int(random(5, 12)), angle*random(1.0, 1.3)); tail(i, 400, int(random(5, 12)), -angle*random(1.0, 1.3)); } - + if(record) { endRecord(); - record = false; + record = false; } - + } void mousePressed() { diff --git a/java/examples/Books/Processing Handbook/Illustrations/page_300/page_300.pde b/java/examples/Books/Processing Handbook/Illustrations/page_300/page_300.pde index f24c0ecf0..f223d90e7 100755 --- a/java/examples/Books/Processing Handbook/Illustrations/page_300/page_300.pde +++ b/java/examples/Books/Processing Handbook/Illustrations/page_300/page_300.pde @@ -1,6 +1,7 @@ // Based on code 33-14 (p. 307) +import processing.pdf.*; float inc = 0.0; @@ -17,7 +18,7 @@ void setup() { size(180, 666); smooth(); noFill(); - strokeWeight(0.25); + strokeWeight(0.25); y = new float[height]; x = new float[height]; @@ -32,9 +33,9 @@ void draw() { background(255); // Shift the values to the right - for (int i = y.length-1; i > 0; i--) { + for (int i = y.length-1; i > 0; i--) { y[i] = y[i-1]; - } + } // Add new values to the beginning my += (mouseX-my) * 0.1; y[0] = my; @@ -46,9 +47,9 @@ void draw() { endShape(); // Shift the values to the right - for (int i = x.length-1; i > 0; i--) { + for (int i = x.length-1; i > 0; i--) { x[i] = x[i-1]; - } + } // Add new values to the beginning mx += (mouseY-mx) * 0.1; x[0] = mx; @@ -62,7 +63,7 @@ void draw() { if(record) { endRecord(); - record = false; + record = false; } } diff --git a/java/examples/Books/Processing Handbook/Illustrations/page_420/page_420.pde b/java/examples/Books/Processing Handbook/Illustrations/page_420/page_420.pde index 3010bc637..ecdc57fd3 100755 --- a/java/examples/Books/Processing Handbook/Illustrations/page_420/page_420.pde +++ b/java/examples/Books/Processing Handbook/Illustrations/page_420/page_420.pde @@ -1,9 +1,10 @@ // Based on code 45-04 (p. 424) +import processing.pdf.*; void setup() { - size(513, 666); + size(513, 666); } void draw() { @@ -11,17 +12,17 @@ void draw() { point(mouseX, mouseY); println("hi"); } -} +} void mousePressed() { - beginRecord(PDF, "page_420.pdf"); + beginRecord(PDF, "page_420.pdf"); background(255); stroke(0); strokeCap(ROUND); } void mouseReleased() { - endRecord(); + endRecord(); }