@almoce logged this issue here: processing/processing-docs#431
If you run this example, an error is triggered:
ClassCastException sun.java2d.SunGraphics2D cannot be cast to java.awt.Image
Is this a bug? Shouldn't you be able to use image() to display/output a PGraphics object, even within the PDF renderer? (Or perhaps this isn't supported for PDFs.)
import processing.pdf.*;
PGraphics pg;
void setup() {
size(100, 100, PDF, "output.pdf");
pg = createGraphics(100, 100);
noLoop();
}
void draw() {
pg.beginDraw();
pg.background(100);
pg.stroke(255);
pg.line(0, 0, 100, 100);
pg.endDraw();
image(pg, 0, 0);
}
@almoce logged this issue here: processing/processing-docs#431
If you run this example, an error is triggered:
Is this a bug? Shouldn't you be able to use image() to display/output a PGraphics object, even within the PDF renderer? (Or perhaps this isn't supported for PDFs.)