[cairo] Questions about Cairo and Windows

Maarten Bosmans mkbosmans at gmail.com
Fri Oct 1 05:17:09 PDT 2010

2010/10/1 Lucan1d Beetle <lucan1d at hotmail.com>:
> I am looking for a 2D graphics toolkit for a new large project and Cairo is
> looking promising but one of the requirements I have is that the software
> runs well on Windows 7 so I would appreciate answers to the following
> questions:
> Does Cairo run as well on Windows as it does on other platforms (i.e.
> Linux)?

Although its primary developers mainly run Cairo on Linux (more
specifically: on intel graphics) there are enough people interested in
running it on Windows to keep it in good shape.
But of course Cairo isn't part of the core infrastructure on Windows,
so you might run into a bug yourself if you use the latest version.

> Can I build Cairo on Windows or do I have to wait for GTK or someone else to
> build the latest version and release the binaries?

Yes, it can be build on Windows, either using MSVC or through
GCC+mingw32. Personally I find the easiest option to be
cross-compiling on Linux using mingw.

I myself have switched to downloading the packages from the OpenSuse
BuildService. The mingw project over there has a lot of nice packeges
being automatically build for Windows. See for example:
I only compile stuff like Cairo and Gtk myself in order to fix bugs.
For distribution with my Windows app, I only rely on the binaries from
the BuildService.

> Can Cairo be built using Visual Studio 2010 or be built in such a way that
> the resulting library works well with code built using Visual Studio 2010?

Yep. Although I think there isn't a MSVC project to build it, but you
have to use a special makefile. But as I have no experience building
this way, better let some else answer this in more detail.

> In which Windows contexts/containers/frames can Cairo run such as Win32, MFC
> or WPF?

As you can see in the docs:
Cairo needs a HDC in order to be able to draw to a window.

> Are there any known issues, limitations or "gotchas" related to running
> Cairo on Windows?

The main thing I would say is that there aren't that much developers
using Cairo on Windows. That said, it works great on Windows and I
would really recommend you to use Cairo. If you submit patches for any
problems you might experience, that's even better!

One other thing is the performance of the win32 backend. It is
certainly sufficient (at least for my app), but I find that using the
image surface for drawing and then blitting the contents to the win32
surface is much faster. It's a trivial change code-wise, so you can
try and profile both to see whether performance is acceptable for you.

> Thanks,
> -Lucan1d-


More information about the cairo mailing list