Monday, March 22, 2010

SVG Graphics on the iPhone

A new project came across my desk. The client want to import vector graphics, manipulate them and export vector graphics. No problem i thought.

Well the problem is that there is no native support for SVG graphics. Not one iota! So as a developer you have two choices. Building a JS interface and loading it in a UIWebView or implementing your own SVG parser, and loading the loading the objects as native paths using Core Graphics/ Quartz 2D.

Most smart programmers would go for the former method of course, however if you have complex SVG's you might have a performance problem, as illustrated by this video


Yeah, that performance sucks.



My problem is two fold, my client wants to export the data as a vector. Common sense wil tell you, that importing multiple vectors and then trying to export them again as a vector, in raster/bitmap based container isn't going to work.


So it looks like me and the SVG spec are going to get really cosy. The only blessing here is that SVG's that my client wants to use are fairly simple, so i should need to implement the entire spec.

4 comments:

Rich Seymour said...

Hi there. I've been looking into SVG after having some fun exporting SVG from gnuplot for graphs. That and seeing how terrible the blown up raster graphics look from iphone apps running on the ipad. I'd like to keep an eye on what you are able to do. It does seem like everyone wants SVG outside of UIWebKit, but not that likely to see it happen.

You are definitely doing some complex stuff there (in terms of # of moving elements). Share what you can. You have at least one person out there in the interweb world interested in your results.

Anonymous said...

Yep;

hope they fix it soon.

Anonymous said...

Hello,

Just stumbled across this post whilst looking for a method of extracting a CGPath/UIBezierPath from the path attribute of an SVG file.

Did you manage to find a working solution?

Unknown said...

For those asking i never went deeper into working on a solution to the problem shown here, but i would love to if i ever get some spare time.