Cairo Alpha Released

The first alpha of the PECL Cairo extension I've been working on is finally out. Cairo is a 2D graphics library written in C with support for multiple output devices. The extension provides an Object Oriented API, but also includes procedural methods. This is similar to PHP's date and mysqli extensions. The reason for the dual API is to support users of the cairo-wrapper extension. If you have code using cairo-wrapper currently, you can 'drop in' the new extension as a replacement with one caveat - cairo-wrapper used resources, the new cairo extension uses objects, so any is_resource() checks would fail.

The extension provides support for PHP 5.2.x and 5.3.x only. It requires the CairoGraphics Library version 1.4 and higher - all the way to 1.8. If you know anything about the cairo graphics library, you know that it uses even version numbers for 'stable' releases and odd ones for unstable. You can use unstable library versions with the cairo extension, but it will only have the features of the earliest version before - for example a 1.9.2 snapshot would only have 1.8 features enabled.

PECL cairo is currently labeled alpha because the API is not yet complete. I'm still working on finishing 3 surface backends that aren't wrapped (Xlib, Win32 and Quartz) and backend fonts. Only the toy font face API methods are currently ready, so there are a few glyph related functions that aren't implemented or just don't do anything. In addition there are some random items (supporting cloning matrices and paths, for example) that are on the TODO list.

Windows builds are available at the homepage for the extension - as well as the documentation. We're having some "fun" getting permission to use stuff from the Cairo library docs because they're all embedded in the source code, which makes licensing a pain. So for now the docs are on the homepage and NOT in the php manual - licensing sucks.

Feedback is always welcome, as is any help in writing documentation or even feature requests.

So download it, give it a try, run the test suite (windows users, there's a package set up to help with that), run the examples, have fun.

Comments

Instalando o php-gtk2 (svn trunk) no Linux « Enygmata

[...] de abril de 2010 at 19:51 (Outros) Com a mudança do repositório do php para svn e com o lançamento da extensão Cairo pra php, meu tutorial anterior sobre como instalar o php-gtk se tornou obsoleto, mas vou deixa-lo no blog [...]

2010-04-25 1:51 pm

Robert Johnson

Thanks for your Cairo builds at http://perisama.net/, they are really useful, especially as you support all the build varieties of PHP. A great contribution.

2010-09-10 4:31 am

Post a Reply