void penSetOn(float x, float y, int c, float p, float r, PImage img) { float amount = r*r; for (int i=0;i>16&0xFF; int g1 = c1>>8&0xFF; int b1 = c1&0xFF; int r0 = c0>>16&0xFF; int g0 = c0>>8&0xFF; int b0 = c0&0xFF; int r = int(p0*r0 + p1*r1); int g = int(p0*g0 + p1*g1); int b = int(p0*b0 + p1*b1); return (r<<16|g<<8|b); } void blurAt(int x, int y, int blurRadius, float blurLevel, PImage img) { float v = 1/(float)sq(1+blurRadius*2); float rr=0, gg=0, bb=0; for (int yo=-blurRadius;yo<=blurRadius;yo++) for (int xo=-blurRadius;xo<=blurRadius;xo++) { int xp = x+xo; int yp = y+yo; if (xp<0) xp=0; if (xp>=img.width) xp=img.width-1; if (yp<0) yp=0; if (yp>=img.height) yp=img.height-1; int c = img.get(xp,yp); rr += v*(c>>16&0xFF); gg += v*(c>>8&0xFF); bb += v*(c&0xFF); } int blurCol = int(rr)<<16|int(gg)<<8|int(bb); img.set(x,y,mixColor(blurCol,img.get(x,y),blurLevel)); } void blur(PImage img) { PImage out = new PImage(img.width,img.height); for (int y=0;y