Developer Tips: Method for Interpreting Illustrator Art Assets as Cocoa CGPathRef
Jeff Menter, the developer of Lens•Lab, a “virtual lens simulation tool for photographers,” sent us a tip that he thinks other developers might get some benefit from. Here’s what he had to say:
In the creation of Lens•Lab, we had to figure out a way to create an art asset that contained visual detail that would scale from 10cm to 100m. we know Adobe Illustrator very well so we were hoping we could create the art asset there. The problem was this: we had to take this path in Illustrator and scale it programmatically in realtime over 4 orders of magnitude.
The solution we came up with is an Objective-C method that parses a specially prepared chunk of an Illustrator EPS file and creates a Cocoa CGPathRef object which one can then manipulate to one’s heart’s content.
If you’re a developer running up against a similar problem, click through to see the three step solution, and maybe even help refine the process a bit better as requested.
Got your own developer tip? Shoot an email to editor [at] 148Apps [dot] com with a link, and we’ll post it right here.