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 › SVGimport problem
Page Index Toggle Pages: 1
SVGimport problem (Read 1213 times)
SVGimport problem
Oct 13th, 2006, 2:03am
 
Hello,

I just tried to install the "SVGimport" library. And then ran one of the exemples that come with. But I can't do it work : I get the following message in the processing shell :

/tmp/build62372.tmp/Temporary_7883_9714.java:30:14:30:23: Semantic Error: No accessible field named "LINE_STRIP" was found in type "Temporary_7883_9714".

I suppose that the library is not right installed. I am running it under Linux OS and have installed the 117 version of Processing. Do you have an idea to solve my problem.

Thanks a lot.

Re: SVGimport problem
Reply #1 - Oct 13th, 2006, 8:16am
 
Candy is based on the old processing version and needs to be updated, I guess that will happen soon. So far you have to use a older version of processing so try 115.
Re: SVGimport problem
Reply #2 - Oct 13th, 2006, 3:19pm
 
Thanks very much for your quick answering. I have found what had to be updated in the Michael Chang library. May be I could give the corrected code. Where do you think I could upload this, to make it easily accessible by Processing users ?

Thanks again.

Anyway I give the modifications (in the svgpath.java file) here :

1) Replace 'toFloat' (deprecated) by 'parseFloat' everywhere
2) Modify the drawing routine as following :

parent.beginShape(style);
    //parent.vertex(s.paths[p].points[0].x,s.paths[p].points[0].y);                



     for(int i=1;i<s.paths[p].points.length;i+=3)

     {

       if(i+3>s.paths[p].points.length)

         break;
               //parent.bezierVertex(s.paths[p].points[i].x,s.paths[p].points[i].y,s.paths[p].points[i+1].x,s.paths[p].points[i+1].y,s.paths[p].points[i+2].x,s.paths[p].points[i+2].y);
       parent.bezier(s.paths[p].points[i-1].x,s.paths[p].points[i-1].y,s.paths[p].points[i].x,s.paths[p].points[i].y,s.paths[p].points[i+1].x,s.paths[p].points[i+1].y,s.paths[p].points[i+2].x,s.paths[p].points[i+2].y);

     }

     parent.endShape();


3) In the main file :
  Replace "LINE_STRIP" (seems to be not used anymore) by "LINES"
Re: SVGimport problem
Reply #3 - Oct 13th, 2006, 3:27pm
 
LINES is not the same as LINE_STRIP, so i doubt that's what you want. just use beginShape() / endShape() instead of beginShape(LINE_STRIP), and you should be fine. more on the changes is in the reference:
http://processing.org/reference/changes.html#beta
Re: SVGimport problem
Reply #4 - Oct 13th, 2006, 6:43pm
 
You are bloody right. I haven't tested my corrected lib with filled shapes. So the right corrections are :

1) Replace 'toFloat' (deprecated) by 'parseFloat' everywhere
2) Modify the drawing routine as following :

//parent.beginShape(style);
parent.beginShape();
    parent.vertex(s.paths[p].points[0].x,s.paths[p].points[0].y);        



for(int i=1;i<s.paths[p].points.length;i+=3)

{

  if(i+3>s.paths[p].points.length)

    break;
     parent.bezierVertex(s.paths[p].points[i].x,s.paths[p].points[i].y,s.paths[p].points[i+1].x,s.paths[p].points[i+1].y,s.paths[p].points[i+2].x,s.paths[p].points[i+2].y);
 }

parent.endShape();


3)
In svgpath.java
  Remove the "int style" parameter from functions "draw" and "images" definitions.

In the main file :
  Remove the parameter "LINE_STRIP" :

//mysvg.draw(LINE_STRIP,35,120);
mysvg.draw(35,120);

Thanks again to fry.

It seems to work now.
Hope this will help...
Page Index Toggle Pages: 1