import processing.opengl.*; import javax.media.opengl.*; PImage img; void setup() { size(600,600, OPENGL); img = createImage(10, 10, RGB); float md = 0.5*sqrt(sq(img.width/2)+sq(img.height/2)); for (int x = 0; x < img.width; x++) { for (int y = 0; y < img.height; y++) { float d = sqrt(sq(x-img.width/2)+sq(y-img.height/2)); img.set(x ,y , color(0, 128-128*d/md, 0)); } } } void draw() { /* Three images plotted: all 100x100 px WxH at: (0, 0) (25, 25) (50, 50) (75, 75) */ background(0); // image "A" -- smaller blend(img, 0, 0, img.width, img.height, 0, 0, //x & y of new image 100, 100, //width & height of new image ADD); // image "B" - larger blend(img, 0, 0, img.width, img.height, 25, 25, //x & y of new image 100, 100, //width & height of new image ADD); blend(img, 0, 0, img.width, img.height, 50, 50, //x & y of new image 100, 100, //width & height of new image ADD); blend(img, 0, 0, img.width, img.height, 75, 75, //x & y of new image 100, 100, //width & height of new image ADD); }