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 & HelpOther Libraries › 'set' clash with pdf export
Page Index Toggle Pages: 1
'set' clash with pdf export (Read 487 times)
'set' clash with pdf export
Nov 4th, 2008, 6:58pm
 
have set an animation to export a pdf at various points
it crashes when it does this and gives the message:

No set() for PGraphicsPDF

which obviously means it doesn't like the 'set()' function.
i'm only using this once, but can't use 'pixels[]' instead; that causes an ArrayIndexOutOfBounds because of some rounding up that happened somewhere along the way.

are there any ways around this? ideally just being able to produce a high res pdf with 'set' functioning

s


Re: 'set' clash with pdf export
Reply #1 - Nov 4th, 2008, 9:59pm
 
PDF files are vector graphics, you can't do pixel operations on them. What is it that you're trying to do? (Or rather, why are you using PDF and not TIFF or PNG or one of the other formats that support pixel data.)
Re: 'set' clash with pdf export
Reply #2 - Nov 4th, 2008, 10:15pm
 
aah. Good point- I should really know that...

I'm just trying to record a high res image every 10 minutes or so- I'm already saving screen res tiffs every 6 seconds which works fine, but i'd like to have something more like print quality.

S

P.s.
I'll extract the relevant bit of code and put it up in due course.
Re: 'set' clash with pdf export
Reply #3 - Nov 4th, 2008, 11:17pm
 
ok,

i've cleaned this out so there is just the code for a little agent guy who runs around the screen:

http://www.surfacearchitects.com/gfx/AGENT_MK_II.zip

press the lighter button to make agents appear, the darker to record. (the pdf recording crashes it)

the problem is a 'set' in the 'depth_ray' class - i've commented it.
it is basically what draws the rays coming from the agent.

s

Re: 'set' clash with pdf export
Reply #4 - Nov 5th, 2008, 7:51am
 
It is a bit contradictory, to create an image point per point (as it seems you do) and save it in vector format for higher quality...

If you are doing ray-tracing or something similar, the only way to get higher quality is to increase image size, ie. draw more points! You can then alter the saved image to push the resolution to 300dpi, for example.

Or draw the image using ellipse() or rect() (for example) instead of set().
Re: 'set' clash with pdf export
Reply #5 - Nov 5th, 2008, 10:12am
 
amazing the difference a new morning makes...

this:

for (int x = 18; x < ray_view; x++)
 {
   float rayLineX = x*cos(ray_final_placing_x*degreeS);  //position of x detection with angled rays and bearing;
   float rayLineY = x*sin(ray_final_placing_y*degreeS);  //position of y detection with angled rays and bearing;

   X_rayE = rayE*cos(bearing*degreeS);   //length of e in x axis with current bearing
   Y_rayE = rayE*sin(bearing*degreeS);   //length of e in y axis with current bearing
   
   rayXfinal = round(X_rayE+rayLineX);
   rayYfinal = round(Y_rayE+rayLineY);

   look = get(rayA+rayXfinal,rayB+rayYfinal);
   detect = brightness(look);
   
   if (x==20)
   {
     draw_ray = true;}
   
   if ((detect == 79 || detect == 80 || detect == 180 || detect == 175 || detect==50) && draw_ray)
   {
     set (rayA+rayXfinal,rayB+rayYfinal,ray); /// this draws the rays - problem as it uses 'set'
     accumulator = x;}
   
   if ((look==primed || detect == 0) && draw_ray)
   {
     vector = accumulator;
     draw_ray = false;}
   
   if (x==ray_view-2 && (detect == 79 || detect == 80 || detect == 180 || detect == 175 || detect == 0 || detect==50) && draw_ray)
   {
     vector = x;}
 }



becomes this:

for (int x = 18; x < ray_view; x++)
 {
   float rayLineX = x*cos(ray_final_placing_x*degreeS);  //position of x detection with angled rays and bearing;
   float rayLineY = x*sin(ray_final_placing_y*degreeS);  //position of y detection with angled rays and bearing;
   
   X_rayE = rayE*cos(bearing*degreeS);   //length of e in x axis with current bearing
   Y_rayE = rayE*sin(bearing*degreeS);   //length of e in y axis with current bearing
   
   rayXfinal = round(X_rayE+rayLineX);
   rayYfinal = round(Y_rayE+rayLineY);

   look = get(rayA+rayXfinal,rayB+rayYfinal);
   detect = brightness(look);
   
   if (x==20)
   {
     draw_ray = true;
     xi = int(x);}
   
   if ((detect == 79 || detect == 80 || detect == 180 || detect == 175 || detect == 0) && draw_ray)
   {
     accumulator = x;}
   
   if ((look==primed || look==off || detect==20  || detect==30 || detect==50) && draw_ray)
   {
     vector = accumulator;
     xii = int(x);
     draw_ray = false;}
   
   if (x==ray_view-2 && (detect == 79 || detect == 80 || detect == 180 || detect == 175 || detect == 0) && draw_ray)
   {
     vector = x;}
 }
 stroke(ray);
 strokeWeight(ray_intensity);
 line(xi,0,xii,0);
 strokeWeight(1);


and all is well :)

thanks for the hints

s


Page Index Toggle Pages: 1