/* dueEastPoster.pde (c) 2008, 2010 Alexander Ness Revised 100823 For the type to display correctly, this requires the "HelveticaNeue-Bold" font. See "dueEastText.pde" for the string constants. */ import processing.pdf.*; // PDF library PFont font; float in = 144; // dpi // spacing and measurements float lineLength = 0.4*in; // h float staffSpace = 0.04*in; // v float chunkLength = lineLength + 0.1*in; // h float groupHeight = 4 * staffSpace + 0.2*in; // v float patternLength = 5 * chunkLength + 0.3*in; // h float massHeight = 5 * groupHeight + 0.2*in; // h // line variation range float[] offsets = {random(0.0, 0.2), random(0.0, 0.2)}; // line color range float[] reds = {random(0, 255), random(0, 255)}; float[] blues = {random(0, 255), random(0, 255)}; void setup() { size(17 * 144, 11 * 144, PDF, "dueEastFinal.pdf"); textMode(SHAPE); noLoop(); } void draw() { reds = sort(reds); blues = sort(blues); // Draw a black background. fill(0); rect(0, 0, 17*in, 11*in); // centering (approximate?) translate( (17 * in - (5 * patternLength - 0.1*in) ) / 2, (11 * in - (5 * massHeight - 0.2*in ) ) / 2 ); // Draw the background pattern. allStaffLines(); // font positioning adjustment translate(0, -0.15*in); // Print text over the background pattern. makeFont(); renderText(); exit(); } void drawStaffLine() { /* Draw a single line. */ strokeWeight(0.02*in); // line thickness // line color stroke( random(reds[0], reds[1]), 0, random(blues[0], blues[1]) ); line( random(-offsets[0], offsets[0])*in, random(-offsets[1], offsets[1])*in, lineLength + random(-offsets[0], offsets[0])*in, random(-offsets[1], offsets[1])*in ); } void allStaffLines() { /* Draw the entire background pattern. */ pushMatrix(); // a complex of masses expanded vert. for (int i=0; i<=4; i++) { pushMatrix(); // a mass of patterns expanded horiz. for (int j=0; j<=4; j++) { pushMatrix(); // patterns of five groups of chunks, vert. for (int k=0; k<=4; k++) { pushMatrix(); // groups of five chucks in a row, horiz. for (int l=0; l<=4; l++) { pushMatrix(); // chunk of five staff lines for (int m=0; m<=4; m++) { drawStaffLine(); translate(0, staffSpace); } popMatrix(); translate(chunkLength, 0); } popMatrix(); translate(0, groupHeight); } popMatrix(); translate(patternLength, 0); } popMatrix(); translate(0, massHeight); } popMatrix(); } void makeFont() { /* Set up the poster font. */ font = createFont("HelveticaNeue-Bold", 48); textFont(font); textAlign(LEFT, TOP); } void renderText() { /* Print the text. See "dueEastText.pde" for string constants. */ textLines(fp, fpColors, 0, 0); textLines(presents, presentsColors, 0, 1); textLines(newMusic, newMusicColors, 2, 2); textLines(dueEast, dueEastColors, 1, 1); textLines(erin, erinColors, 1, 2); textLines(greg, gregColors, 1, 3); textLines(url, urlColors, 1, 4); textLines(jessica, jessicaColors, 2, 0); textLines(yoni, yoniColors, 3, 0); textLines(alex, alexColors, 4, 0); textLines(yoonji, yoonjiColors, 4, 1); textLines(clara, claraColors, 4, 2); textLines(time, timeColors, 3, 3); textLines(free, freeColors, 3, 4); textLines(address, addressColors, 4, 4); } void textLines(String[] strs, boolean[] isWhite, int row, int column) { /* Print lines of text at a certain position. - `strs` is an array with one or more lines of text. - `isWhite` is an array of the same length as `strs`. If an entry is `true`, the corresponding line of text in `strs` will be white; otherwise, it will be yellow. - `row` and `column` are background pattern coordinates. (0, 0) draws text over the upper-left pattern; (4, 0) draws text over the upper-right pattern; (0, 4) draws text over the lower-left pattern; etc. */ pushMatrix(); translate(patternLength*row, massHeight*column); for (int i = 0; i < strs.length; i++) { if (isWhite[i]) { fill(255); } else { fill(255, 255, 0); } text(strs[i], 0, 0); translate(0, groupHeight); } popMatrix(); }