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.
IndexProcessing DevelopmentLibraries,  Tool Development › "Candy", SVG Importer for Processing
Pages: 1 2 
"Candy", SVG Importer for Processing (Read 7533 times)
Re: "Candy", SVG Importer for Processing
Reply #15 - Oct 30th, 2006, 10:10pm
 
Hey man. My name is Emerson Taymor and I am a second year at UCLA in the Design | Media Arts program. I am taking Casey Reas' class, Interactivity, and he suggested I use some of your library creations to import svg files. I have a few bugs/ problems that I would like to see if you have any input on them.

I couldn't get your example files or mine to load in SVG importer, but I made progress in Candy, getting some shapes to load.

First, pure white filled paths do not load. I can get a color filled path that is exactly the same as the white one to load, but the white path will not load.

Second, strokes do not appear to close in processing. The stroke is fully connected in Illustrator, but when I display it to screen using Candy, it doesn't close and the path stroke is left open.

Finally, is it possible to color a path or tint it in processing using Candy? I want to make these svg files multiple colors based on mouse location. Is this possible using Candy? Can I tint or fill an svg file similarly to how you tried to do it in SVG Importer?

Hope you can answer some or all of these questions. Thanks for your help and great work so far. Hopefully these problems are not too difficult to solve. Thanks again,
Emerson Taymor
Re: "Candy", SVG Importer for Processing
Reply #16 - Oct 31st, 2006, 6:28pm
 
This is the Halloween release of Candy. Trick or...


http://www.ghost-hack.com/p5/svgcandy/
http://www.ghost-hack.com/p5/svgcandy/candy103106.zip

Thanks for the bug finds. The shape closing is due to Candy not supporting changes in Processing 116+, but now that is all repaired and ready to go.

Pure white shapes had a strange issue of returning -1 when unhexing (FFFFFFFF), and -1 was being used as a value for "noStroke" or "noFill" so that was clashing. This is now fixed.

I've also added two methods for switching between processing colors and svg-file colors. Check the website for details.

Finally, SVGs without <g> tag (unique? I guess to Adobe products... sigh) will now load.

There are still some issues with the number of tags that come before <svg> that will screw up your loading. I'll fix this on my next pass.
Re: "Candy", SVG Importer for Processing
Reply #17 - Nov 1st, 2006, 6:40pm
 
Hey man. Great job, it is working wonderfully with the old version of ProXML.

Unfortunately, when you use the new version of ProXML it gives an ArrayIndexOutofBounds error and a long list of errors in the console highlighting the code that loads the SVG image to the SVG variable.

As I said before, everything runs perfectly with the old version of ProXML.

Good job and hopefully you can fix this minor bug.
Re: "Candy", SVG Importer for Processing
Reply #18 - Nov 4th, 2006, 12:38pm
 
The most recent release of Candy doesn't draw lines. It only seems to work with connected shapes. Here is the sample code:
Code:
import proxml.*;
import candy.*;

SVG moo, moo2;

void setup(){
size(800, 800);
moo = new SVG("line.svg", this);
moo2 = new SVG("shape.svg", this);
}

void draw(){
moo.draw(); // Doesn't draw
moo2.draw(); // Draws
}


And here is the file data for shape.svg:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [

<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">

<!ENTITY ns_svg "http://www.w3.org/2000/svg">

<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"

width="165" height="179" viewBox="-0.279 -0.988 165 179" enable-background="new -0.279 -0.988 165 179" xml:space="preserve">
<defs>
</defs>
<path fill="none" stroke="#000000" d="M43.055,177.012c0,0,55.005-31.071-19.333-84c-83.333-59.333,80.667-151.333,130-40.667

c0,0,36,66-30.667,65.333L43.055,177.012z"/>
</svg>


Here's the file for line.svg:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [

<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">

<!ENTITY ns_svg "http://www.w3.org/2000/svg">

<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg version="1.1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"

width="165" height="178" viewBox="-0.612 -0.321 165 178" enable-background="new -0.612 -0.321 165 178" xml:space="preserve">
<defs>
</defs>
<path fill="none" stroke="#000000" d="M43.055,177.012c0,0,55.005-31.071-19.333-84c-83.333-59.333,80.667-151.333,130-40.667

c0,0,36,66-30.667,65.333"/>
</svg>
Re: "Candy", SVG Importer for Processing
Reply #19 - Oct 29th, 2007, 12:28pm
 
there is no way in Illustrator cs3 to get a valid .svg for candy. What can I do about it?
Re: "Candy", SVG Importer for Processing
Reply #20 - Oct 30th, 2007, 2:48pm
 
post your non-working svg along with a bug in the bugs db:
http://dev.processing.org/bugs/

i've not run into this problem with cs3, but i'm not sure how much i've worked on candy since cs3 arrived.

(closing this thread since it refers to the really old candy releases)
Pages: 1 2