class CircShape{ float cx,cy,x,y,cxNorm,cyNorm,r; float brightnessValue; CircShape(float _cx,float _cy,float _r){ cx=_cx; cy=_cy; r=_r; } void update(){ cxNorm= cx/width; cxNorm=constrain(cxNorm,0.0,1.0); cyNorm= cy/height; cyNorm=constrain(cyNorm,0.0,1.0); //Brightness setup based on cx,cy normalized position //control if cx,cy or cy&&cy are asking for brightness of pixels out of img.pixels bounds if(cx>=width&&cy>=height){ brightnessValue=brightness(img.get(img.width-1,img.height-1)); } else if(cx>=width){ brightnessValue=brightness(img.get(int(cxNorm*img.width)-1,int(cyNorm*img.height))); } else if(cy>=height){ brightnessValue=brightness(img.get(int(cxNorm*img.width),int(cyNorm*img.height)-1)); } else{ brightnessValue=brightness(img.get(int(cxNorm*img.width),int(cyNorm*img.height))); } // render(); } void render(){ // stroke(0); fill(brightnessValue); //stroke(1.0-brightnessValue); beginShape(); for(int i=0;i