We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to get two copies of a PGraphics - one displayed normally, the other flipped. I then want to convert my PGraphics to a PImage. I've got the following, but the second image isn't flipped...
PGraphics g;
g = createGraphics(width, height, P3D);
g.beginDraw();
g.image(srcImg, 0, 0);
g.endDraw();
PImage output = g.get();
PGraphics g2;
g2 = createGraphics(width, height, P3D);
g2.beginDraw();
g2.image(srcImg, 0, 0);
g2.scale(-1,1);
g2.endDraw();
PImage output2 = g2.get();
Answers
AFaIK scale(), just like fill() and textSize(), isn't retroactive.
That is, it doesn't affect previous drawings: /:)
https://Processing.org/reference/scale_.html
Well, I am sure I did have .scale() working at some point to flip PGraphics. Just can't remember how I made it work.
You probably set the scale before you drew your image. You might also need to translate(width,0); in there. You would want to do that translate first. Then change the scale. Then draw the image.
Thanks TfGuy44. Works like a charm. I ended up with: