Question

I'm doing some work on a potentially cross-platform C++ application and for Windows and OS X it seems that Cairo will meet most of my needs for 2D graphics and allow me to share a lot of code between platforms. In an ideal world I'd really like to be able to use the same (or very similar) drawing code in iPhone/iPad apps.

I realise that this means that I'll need to compile Cairo for iPhone before I try to use it, but I've got no real idea on how to go about this.

If anyone can point me in the right direction I'd be very grateful.

Was it helpful?

Solution

To update this for anyone who happens to try going down the same route as I did, I never did get it to compile (I didn't get much response from the Cairo mailing list when I asked for suggestions). It seems that Cairo isn't really a very good idea for iOS or OSX. I've recently come across this post which pretty clearly says that it's not stable on iOS or OSX.

I'm now quite glad that I made the decision to ditch Cairo as my cross-platform graphics method and go to a home-brew/native method. Although it involves a bit more effort, it's been a pretty good compromise for what I was trying to achieve.

OTHER TIPS

On Windows I've compiled Cairo using Visual Studio like this:

  • libpng-1.2.40
  • zlib-1.2.3
  • pixman-0.16.2
  • cairo-1.8.8

Since Cairo will be using Quartz for font and text handling you will not have to compile Pango (which has Glib as dependency) and FreeType. I assume the setup for iPhone should be similar.

This entry from Vladimir Vukićević's blog shows that Cairo runs on iPhone since 2008 :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top