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 › Importing SVGs with fills
Page Index Toggle Pages: 1
Importing SVGs with fills (Read 453 times)
Importing SVGs with fills
Aug 19th, 2006, 5:36am
 
Hi, is there anyway of importing svg paths with fills, I tried to use the "candy" importer, but it just draws the outlines without the fills. Am I'm doing something wrong or the svg importer does not import fills?
Re: Importing SVGs with fills
Reply #1 - Aug 20th, 2006, 8:26am
 
Can you please post the SVG file you are trying to import, with perhaps some example code on how you are using it?

Thanks.
Re: Importing SVGs with fills
Reply #2 - Aug 20th, 2006, 7:17pm
 
mflux,

The code is:

import svgimport.*;
svgpath mysvg;
void setup()
{
 size(400,400);  
 mysvg=new svgpath("estrella.svg",this);  
 smooth();
}
void draw()
{
 background(255);
 fill(255,255,0);
 mysvg.draw(LINE_STRIP,35,120);
}

And the SVG is:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 10.0, SVG Export Plug-In . SVG Version: 3.0.0 Build 76)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.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  xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
width="190.258" height="199.19" viewBox="0 0 190.258 199.19" overflow="visible" enable-background="new 0 0 190.258 199.19"
xml:space="preserve">
<g id="Layer_1">
<path fill="#FF0000" stroke="#000000" d="M187.721,162.024l-67.647-12.527l-48.67,48.624l-8.99-68.208L1.13,98.651l62.091
-29.627
L74.016,1.079l47.364,49.897l67.955-10.73l-32.818,60.465L187.721,162.024z"/>
</g>
</svg>
Re: Importing SVGs with fills
Reply #3 - Aug 20th, 2006, 7:19pm
 
Were you able to import any svg with a fill? Just to be sure that it is possible.
Re: Importing SVGs with fills
Reply #4 - Aug 21st, 2006, 4:14pm
 
It's not filling probably because you are using:

Code:
mysvg.draw(LINE_STRIP,35,120);  



LINE_STRIP will not draw you fills. Try POLYGON.

Please let me know how that works for you. Fills are supported in the lib.
Re: Importing SVGs with fills
Reply #5 - Aug 21st, 2006, 5:51pm
 
Thanks Mflux, the fill is now working fine!

By the way, your svg import library is awesome, have you ever thought of including gradients?
Re: Importing SVGs with fills
Reply #6 - Aug 23rd, 2006, 5:36am
 
Thank you.

I haven't really given gradients much thought. So far I've been only supporting things that are already natively supported by Processing. So, if Processing one day supports gradients, I'll just piggyback on it and allow SVG Candy to use it as well!
Page Index Toggle Pages: 1