Hello there,
I’m trying to parse a SVG file exported from Adobe Illustrator by using the PShape
method ps.getChild(index);
.
At the end I want to extract the coordinates and the size of all the rectangles.
The problem is that I don’t understand the parameters in the documentation :
and there’s an error :
Ignoring <style> tag.
Thanks in advance
The SVG code :
<svg id="Calque_1" data-name="Calque 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 631 999">
<defs>
<style>.cls-1{fill:red;stroke:#000;stroke-miterlimit:10;}</style>
</defs>
<title>test</title>
<rect class="cls-1" x="44.5" y="157.5" width="302" height="130"/>
<rect class="cls-1" x="195.5" y="510.5" width="362" height="173"/>
<rect class="cls-1" x="0.5" y="730.5" width="212" height="268"/>
<rect class="cls-1" x="475.5" y="0.5" width="155" height="140"/>
</svg>
The processing code :
PShape s;
void setup(){
size(400,400);
s = loadShape("test.svg");
println(s.getChildCount());
}
void draw(){
background(0);
shape(s.getChild(1),0,0);
}