/* Copy of Piet Mondrian's Composition with Red, Blue and Yellow (1930) Processing sketch by Michael Goldwasser This version of the implementation uses variables to define the key x and y coordinates for the sketch. */ size(400, 300); background(255); // white noStroke(); // will do black lines separately smooth(); // softer edges // key coordinates for image lines // (vertical lines, left to right; horizontal, top-to-bottom) int x0 = 0; // left int x1 = 26; int x2 = 79; int x3 = 190; int x4 = 238; int x5 = 316; int x6 = 359; int x7 = 400; // right int y0 = 0; // top int y1 = 86; int y2 = 187; int y3 = 245; int y4 = 300; // bottom // red sections fill(250, 0, 0); // slightly muted rect(x1, y0, x3-x1, y1-y0); rect(x4, y1, x5-x4, y2-y1); rect(x1, y3, x2-x1, y4-y3); // blue sections fill(0, 0, 240); rect(x3, y0, x5-x3, y1-y0); rect(x5, y1, x6-x5, y2-y1); rect(x2, y2, x4-x2, y3-y2); // yellow sections fill(240, 240, 0); // red+green = yellow rect(x1, y0, x2-x1, y1-y0); rect(x5, y0, x6-x5, y1-y0); rect(x5, y2, x6-x5, y3-y2); rect(x2, y3, x4-x2, y4-y3); // time to draw the thick black lines // (which will cover rectangle edges) stroke(0); // black strokeCap(SQUARE); // clean edge strokeWeight(9); // horizontal lines line(x0, y1, x7, y1); line(x0, y2, x6, y2); line(x1, y3, x7, y3); // vertical lines line(x1, y0, x1, y4); line(x2, y0, x2, y4); line(x3, y0, x3, y2); line(x4, y1, x4, y4); line(x5, y0, x5, y3); line(x6, y0, x6, y4); save("myMondrian.jpg");