rikrd / geomerative

Geomerative is a library for Processing. It extends 2D geometry operations to facilitate generative geometry. Includes a TrueType font and an SVG interpreters. This library exposes the shapes (such as vector drawings or typographies) in a more approchable way. Geomerative makes it easy to access the contours, the control points and the curve points, making it easy to develop generative typography and geometry pieces in Processing.

Home Page:http://www.ricardmarxer.com/geomerative

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is it this (large) SVG throws an ArrayIndexOutOfBounds

cristianvogel opened this issue · comments

Hi.

I have a photo that was traced in Illustrator, and I would like to import it with all the colours. It has 19000 points.

But Geomerative doesn't like, at RG.loadShape() throwing the above exception - which is a shame!

If I export the same as a simple SVG in Illustrator, it comes in but I don't know how to access the embedded SVG fill colours, when drawing by hand from the pointPaths array....

the svg data is like this, nothing fancy.

<svg xmlns="http://www.w3.org/2000/svg" width="1497.52" height="850.06" viewBox="0 0 1497.52 850.06"> <g> <path d="M1497.52,126.93V198c-3.07.17-6.57-1.08-8.26,3.2-.23.58-3.06.21-4.68.14-1.32,0-2.74-.73-3.92-.42-5.3,1.41-10.52,3.13-15.81,4.6-.73.2-2.36-.27-2.41-.6-.75-5.09-5.29-3.46-8.16-4.73a11.89,11.89,0,0,1-2.85-1.15c-2.6-2.18-5-4.62-7.66-6.72a2.87,2.87,0,0,0-2.73.67,16.17,16.17,0,0,0-2.09,5.34,3.32,3.32,0,0,0,1.38,2.84c4.12,1.79,6.5,6.71,11.69,6.54.19,0,.42.22.59.39,2.82,2.85,5.63,5.71,9.29,9.44-3.47-.43-6.17-.49-8.72-1.14-4.26-1.08-8.39-2.72-12.66-3.77-4.46-1.1-4.91-.15-5.52,4.37-.71,5.23.22,10.69-2.47,15.71-1.37,2.55,2.29,7.77,5.17,8.1,5.74.67,6.84,2,6.85,8.35s.93,7,6.53,4.68h0c-2.93,2.9-5.65,6.18-10.41,6.08a28,28,0,0,0,.17-4.85c-.13-1.06-1-2.94-1.41-2.9-3.19.27-2.73-1.87-2.92-3.77a12.55,12.55,0,0,0-1.11-2.82c-1,1.06-1.47,2-2.11,2.15-1.76.34-3.77.85-5.32.29s-2.27-8.25-1.38-10a20.83,20.83,0,0,0,1.16-3.61l-1.06-.23c-.13.44-.13,1-.41,1.32a28.21,28.21,0,0,1-2.22,2c-.39-1-1.32-2.21-1.06-3,.7-2.26,0-5.77,4.14-5.69.47,0,1-1.33,1.41-2.13s.23-2,.72-2.27c3-1.43,3.4-3.68,3.22-6.8-.21-3.54-1.28-4.53-4.74-3.12-1.39.57-3.38,1.57-4.3,1-3.42-2-6-.91-9,.89-1.27.75-3.83.38-5.21-.46-1-.59-1.25-2.84-1.22-4.34a6.52,6.52,0,0,1,5-6.35c3.67-1.15,3.37-5,5.16-7.37a1.37,1.37,0,0,0-.36-1.28c-2-1-4.52-3.09-6-2.54-6.28,2.26-7.46-4.09-11.08-6.09-1.78-1-2.39-4.08-3.87-6.86a13.69,13.69,0,0,1,3.82-1.17c1.88-.12,3.89.86,5.69.51,2-.38,3.87-1.71,5.79-2.63-.93-1.81-1.41-4.18-2.86-5.31-3.74-2.92-7.9-5.3-11.9-7.9l8.27-.45.15-1.62-6.2-2.32-6.93-4.75a9.13,9.13,0,0,1,.92-1.2c8.09-7.32,15.8-15.14,24.43-21.76,5.55-4.27,11.23-8.9,18.35-10.84,2.2-.6,3.9-6.56,2.58-8.48-.26-.37-.75-.95-1-.9-2.79.46-5.62-.55-8.18,2.39-3.73,4.29-8.47,7.71-12.77,11.49,2.11-2.19,4.27-4.35,6.33-6.59a19.19,19.19,0,0,0,3-3.79c2.09-4,4-8,6-12.09l5.8.73c3.94,1.76,5,4.62,3.69,8.73a20,20,0,0,0-.72,6c0,2,1,2.88,3.37,3.21a18.83,18.83,0,0,1,8.36,3.18c3.91,2.9,7.22,6.61,12.76,4,.39-.18.94,0,1.42,0,5,.13,7.32-1.53,8.82-6.2,1.14-3.53,3.12-4.79,6.74-4.36a10.53,10.53,0,0,0,2-.17l5.23.62c-.9,2.9-1.63,5.53-2.58,8.08-.24.64-1.29.94-1.8,1.54a29.88,29.88,0,0,0-1.83,2.71c1.33.13,2.88.75,4,.28C1490.89,130.64,1494.17,128.71,1497.52,126.93Z" transform="translate(0 0)" style="fill: #6f665c"/> ... continues

Please ignore - it was down to Illustrator grouping the Traced image and saving this. Seems like then, there is only one child and many many points. So now I have 4000 child elements and I think I can now extract styles....