Hey every1!
@ lines # 28 & 33, I've checked here and there's no need to use
get() on a
PGraphics
for it to be used as parameter for
image()!
Also, it seems that
beginDraw() &
endDraw() just need to be called once!
And some times, not even once!!!
See my tweaked below:
/**
* Arced Smile (v3.5)
* by tfguy44 (2013/Feb)
* for Ricardo.Deamorim
* tweaked by GoToLoop
*
* http://forum.processing.org/topic/not-drawing-parts-of-pimage
*/
final static byte fps = 10, tempo = 5 * fps;
final static byte numArcs = 12;
int count = numArcs;
int imgW, imgH;
boolean canRefresh = true;
PGraphics pg, m;
PImage img;
//final PImage img = loadImage(
//"http://rlv.zcache.com/rainbow_be_happy_smiley_face_stickers-p217218018699326192b2o35_400.jpg");
//https://www.zazzle.com/rlv/rainbow_be_happy_smiley_face_stickers-p217218018699326192b2o35_400.jpg);
void setup() {
size(400, 400);
frameRate(fps);
pg = createGraphics(width, height, P2D);
m = createGraphics(width, height, P2D);
m.beginDraw();
m.noStroke();
m.fill(255);
m.endDraw();
img = loadImage("rainbow_be_happy_smiley_face_stickers-p217218018699326192b2o35_400.jpg");
imgW = img.width-50;
imgH = img.height-50;
}
void draw() {
if (canRefresh) {
canRefresh = false;
// Draw the sections of the mask that we want to keep.
m.background(0);
if (count == numArcs) m.ellipse(width>>1, height>>1, imgW, imgH);
else m.arc(width>>1, height>>1, imgW, imgH, 0, TWO_PI/numArcs*count);
// Apply the mask to an image of the picture.
pg.background(img);
pg.mask(m);
}
// Render the resulting masked image.
background( map(frameCount%tempo, 0, tempo, 0, 255), 0, 0 );
image(pg, 0, 0);
}
void mousePressed() {
canRefresh = true;
if (--count < 0) count = numArcs;
}