We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › PDF to other PGraphics object
Page Index Toggle Pages: 1
PDF to other PGraphics object (Read 397 times)
PDF to other PGraphics object
May 14th, 2006, 8:43pm
 
Currently I'm having to duplicate my line draw method, once for buffer.line(x1,y1,x2,y2) and then again line(x1,y1,x2,y2) in order for PDF to record it.

Is there a way of telling the PDF renderer to use a preferred PGraphics object, rather than the default. It's not a huge issue, but affects performance.
Re: PDF to other PGraphics object
Reply #1 - May 14th, 2006, 10:13pm
 
I came up with this, which seems to handle it:

Code:


PGraphics3 tmp = (PGraphics3) g;
this.g = canvas;

line( x1, y1, x2, y2);

this.g = tmp;

Re: PDF to other PGraphics object
Reply #2 - May 15th, 2006, 2:21am
 
why not use PDF as the renderer in size()? or create a PGraphicsPDF and draw to that directly? "performance" isn't really a feature of PDF anyway.
Re: PDF to other PGraphics object
Reply #3 - May 15th, 2006, 8:48am
 
I'm drawing to a buffer which is 4* larger than the main window  and then blitting sections of this to the main window.

To do this, I draw directly to a buffer PGraphics object and then blit this direct to the main window.
Would it be possible to copy(); straight from the PDF to the main window, it's giving me a null pointer for lack of a this.recorder.loadPixels(); given that it extends PGraphics2 (I'm guessing).

The casting seems ok for now. The main problem is the performance difference between P3D and JAVA2D. I can draw fancy strokeWeights to the PDF, but can't see what I've done until its all over.

A good rummage through the processing source will probably clarify things a bit.
Page Index Toggle Pages: 1