views:

1798

answers:

5

I'm looking for a good vector library for displaying animated graphics on the iPhone. Something that could possibly display SVG. Anyone have any ideas or insights?

A: 
  • WebKit
  • libsvg
  • Cairo
Adam Peck
+4  A: 

Quartz, i.e. the vector graphics library that's already built into the phone. Depending on the requirements, you could write a parser for the parts of the SVG spec you actually plan on using. For example perhaps your application only requires the Tiny SVG spec.

Sorry that this answer doesn't point to a framework that already exists, but depending on how badly you really need it, it might make sense to roll your own or a start an open source project (especially since this is the kind of project people would probably be quite happy to contribute to).

dnolen
+1  A: 

GCDrawKit is an outstanding vector illustration framework, but it does not have native support for SVG yet and is built around AppKit, so it's not iPhone compatible. It also is not geared towards animation.

WebKit provides native support for SVG on the Mac, and even lets you manipulate the DOM to modify or save SVG, but I don't believe you're given enough access to it on the iPhone to do the same there.

Your best bet is to write a parser for SVG XML (it isn't too difficult a format), use Quartz for drawing, and back it up with Core Animation for the animated elements.

Brad Larson
A: 

UIWebView works great for SVG. Just drop it in you app in IB, load a file into it and you are set.

You can then call JavaScript from ObjC, very useful for manipulation.

Žiga