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 › exporting to svg
Page Index Toggle Pages: 1
exporting to svg (Read 1317 times)
exporting to svg
Feb 3rd, 2007, 12:16am
 
I'm having problems exporting svg files out of processing 0123 on WinXP. As soon as I run a sample it´s gives me this erro:

Exception in thread "Thread-2" java.lang.NoClassDefFoundError: processing/core/PGraphics2

at java.lang.ClassLoader.defineClass1(Native Method)

I not a professional programar and I´m new to processing. Can you help me?

This is the sample code that i´m trying:

import prosvg.*;

flower one;

void setup(){
 size(1000,200,"prosvg.SVGOut");
 strokeCap(ROUND);
 stroke(255,100);
 smooth();
 background(255);
 one = new flower(random(width),random(height));
}

int counter = 0;
void draw(){
 background(255);
 for(int i = 0;i < 100;i++){
   float actualX = random(width);
   float actualY = random(height);
   one = new flower(actualX,actualY);    
   fill(random(155,255),0,random(155,255),random(50,150));
   one.paint();
   strokeWeight(1.0);
 }
 saveFrame("testFlowers-####.svg");
 saveFrame("testFlowers-####.tif");
 if(counter >= 10)noLoop();
 counter++;
}

class Point{
 float xPos;
 float yPos;

 Point(float xPos,float yPos){
   this.xPos = xPos;
   this.yPos = yPos;
 }
}

class flower{
 float[][] rands;
 int repeats;
 float basic_rnd01;
 float basic_rnd02;
 float basic_rnd03;
 float basic_rnd04;
 float basic_rnd05;
 float xPos,yPos;

 flower(float xPos,float yPos){
   repeats = int(random(10,30));
   rands = new float[repeats][22];
   basic_rnd01 = random(0,10);
   basic_rnd02 = basic_rnd01 + random(0,10);
   basic_rnd03 = basic_rnd02 + random(30);
   basic_rnd04 = basic_rnd03 + random(20);
   basic_rnd05 = basic_rnd04 + random(40);
   setRands();
   this.xPos = xPos;
   this.yPos = yPos;
 }

 void setRands(){
   for(int i = 0; i < repeats;i++){
     rands[i][0] = random(basic_rnd01,basic_rnd02);
     rands[i][1] = random(basic_rnd01,basic_rnd02);
     rands[i][2] = random(basic_rnd01,basic_rnd02);
     rands[i][3] = random(basic_rnd01,basic_rnd02);
     rands[i][4] = random(basic_rnd02,basic_rnd03);
     rands[i][5] = random(basic_rnd02,basic_rnd03);
     rands[i][6] = random(basic_rnd01,basic_rnd02);
     rands[i][7] = random(basic_rnd04,basic_rnd05);
     rands[i][8] = random(basic_rnd02,basic_rnd03);
     rands[i][9] = random(basic_rnd02,basic_rnd03);
     rands[i][10] = random(basic_rnd01,basic_rnd02);
     rands[i][11] = random(basic_rnd04,basic_rnd05);
     rands[i][12] = random(basic_rnd02,-basic_rnd03);
     rands[i][13] = random(basic_rnd02,-basic_rnd03);
     rands[i][14] = random(basic_rnd01,basic_rnd02);
     rands[i][15] = random(basic_rnd04,basic_rnd05);
     rands[i][16] = random(basic_rnd02,-basic_rnd03);
     rands[i][17] = random(basic_rnd02,-basic_rnd03);
     rands[i][18] = random(basic_rnd01,-basic_rnd02);
     rands[i][19] = random(basic_rnd01,-basic_rnd02);
     rands[i][20] = random(basic_rnd01,-basic_rnd02);
     rands[i][21] = random(basic_rnd01,-basic_rnd02);
   }
 }

 void paint(){
 pushMatrix();
   translate(xPos,yPos);
   
   for(int i = 0; i < repeats;i++){
     rotate(TWO_PI/repeats);
     beginShape(POLYGON);
     vertex(0, 0);
     vertex(rands[i][0], rands[i][1]);
     bezierVertex(


rands[i][2], rands[i][3], rands[i][4],


rands[i][5], rands[i][6], rands[i][7]

 );
     bezierVertex(


rands[i][8], rands[i][9], rands[i][10],


rands[i][11], rands[i][12], rands[i][13]

 );
     bezierVertex(


rands[i][14], rands[i][15], rands[i][16],


rands[i][17], rands[i][18], rands[i][19]

 );
     vertex(rands[i][20], rands[i][21]);
     endShape();
   }
   popMatrix();
 }
}
Re: exporting to svg
Reply #1 - Feb 3rd, 2007, 12:42am
 
that will happen with the svg library, because its author hasn't updated it for newer releases of processing.
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=LibraryProblems;action=display;num=1169146997
Re: exporting to svg
Reply #2 - Feb 5th, 2007, 12:45pm
 
OK. Thanks! I´ll use SimplePostScript library.
Re: exporting to svg
Reply #3 - Apr 28th, 2007, 1:04pm
 
this works

http://bezier.de/processing/prosvg_p0123.zip

(by fjen)
Re: exporting to svg
Reply #4 - Apr 30th, 2007, 12:41pm
 
Ok, Thanks for your help, I´ll try it!
Page Index Toggle Pages: 1