No problem... just thought I'd share an example of offscreen drawing using PGraphics with fonts and copying between PGraphics instances since there were a few little tricks I had to figure out (all documented though). If this isn't an appropriate place to post working examples just let me know.
http://www.mangtronix.com/p5/OffscreenFontTest/
Quote:
/**
* <p>
* Demonstration of drawing text offscreen then copying it for onscreen display. <br>
* Click to toggle drawing of offscreen buffer.
* </p>
*
* <p>
* Michael Ang - http://www.michaelang.com <br>
* Created 2007-01-31
* </p>
*/
PGraphics pg;
PFont pf;
boolean blitmeharder = true;
void setup() {
size(350, 200);
pf = loadFont("SWIsop1-48.vlw");
textFont(pf, 48);
pg = new PGraphicsJava2D(width, height/2, this);
pg.beginDraw(); // $$$ the begin/end is required for the textFont to work
pg.textFont(pf, 48);
pg.endDraw();
}
void draw() {
background(0);
text("Onscreen text", 10, 50);
pg.beginDraw();
pg.background(127);
pg.text("Offscreen text", 10, 50);
pg.endDraw();
if (blitmeharder) {
pg.loadPixels();
copy(pg, 0, 0, width, height/2, 0, height/2, width, height/2);
}
}
void mouseClicked() {
blitmeharder = !blitmeharder;
}
void keyPressed() {
if (key == 's') {
// Save screenshot to smaller buffer
PGraphics buffer = new PGraphicsJava2D(width/2, height/2, this);
this.g.loadPixels(); // needed to ensure fresh before copy
buffer.copy(this.g, 0, 0, width, height, 0, 0, width/2, height/2);
try {
buffer.save("offscreentest.png");
println("Saved screenshot");
} catch (Exception e) {
println("Couldn't save screenshot");
e.printStackTrace();
}
}
}