/* * Demonstration of use of image in mandala. */ int bands = 50; float outerSize = 1.2; // size of outer ellipse, as percentage of full float innerSize = 0.6; // size of inner ellipse, as percentage of full void setup() { background(0); // PImage slu = loadImage("campus4.jpg"); PImage slu = loadImage("http://business.slu.edu/uploads/2012/11/08/slu-homepage-campus4.jpg"); int w = slu.width; int h = slu.height; size(2*w, 2*h); image(slu,0,0); PGraphics mask = createGraphics(w, h); mask.beginDraw(); mask.background(0); mask.noSmooth(); mask.noStroke(); for (int j=0; j < bands; j++) { float pct = float(j)/(bands-1); mask.fill(pct*255); // gradiant shading float scale = innerSize * pct + outerSize * (1-pct); mask.ellipse(0.5*w, 0.5*h, scale*w, scale*h); } mask.endDraw(); slu.mask(mask); image(mask,w,0); image(slu,0,h); // and once more fading to white fill(255); rect(w,h,w,h); image(slu,w,h); }