Dia - Cairo
Dia already supports a bunch of export formats. This page is
about a recently added new rendering facility - and it's comparsion
to already exisiting ones.
For some this may look like just the third PNG
and also the third Postscript exporter. For others -
especially those believing in
Cairo
finally reaching it's goals - this may become
Dia's
first second PDF exporter. But also the most
capable renderer there is.
Update
-
2009-02-16 : combined with some gtk-print Dia's cairo renderer is now ready for prime time.
It will be the default renderer for PDF and printing in
Dia version 0.97.
Also available are SVG, PNG and EMF export, the latter used to transport diagrams via windows clipboard.
-
2005-08-05 : Currently cairo settles down after a big
'API Shakeup'. There have been many changes to get a stable API ready for version 1.0.
GTK+ depends on cairo now and thus there is a least
one
cairo/win32 backend, thanks Owen. But the total number of glitches appears to be constant ;-)
- 2005-02-05 : About half a year after the initial version (
2004-05-30) most of the points raised here are still valid.
From the application developers view Cairo has not changed
much (good: stable API, bad: still no accepted and working win32 backend ;-)
But something has changed in regard to PDF creation, see
below ...
Test and Comparsion
My ususal test file for new Dia renderer implemenations is
render-test.dia. The PNG
output of the Cairo renderer follows - it now even has a transparent
background (if you can't see it, that's not a problem of Dia or Cairo
but with your browser).
It shows some problems compared to the ouput produced with
Dia's standard antialiased PNG export facility (namely libart). These
are known limitations in Cairo itself :
- Linestyle in bezier lines are apparently not supported yet
- Image rendering is not as good as expected (At least I would
expect it to reproduce similar quality as in the pixbuf case
when using CAIRO_FILTER_BEST, but it is just doing
bilinear interpolation).
- Text rendering is known to be limited in Cairo (the so called 'toy api')
The source code of the
DiaCairo renderer is in gnome cvs.
A patch to make Cairo compile with the msvc toolchain is
here. It also includes the native win32 backend useable from
the Dia Cairo plug-in.
Rendered with Libart
When exporting from Dia to Portable Network Graphics (*.png) you are
using libart_lgpl as the rendering backend. Depending on the platform and build
text is produced by Pango/Win32 or Pango/FT2.
The images are only sampled with nearest neighbor, but everything else
properly antialiased.
Rendered with GdkPixbuf
The following result is produced by the GdkPixbuf(GdkWin32/PangoWin32) rendering.
It is interpolating images with an algorithm better than nearest (GDK_INTERP_TILES)
and also supports line styles for everything (at least if not run on win9x, where the line
style rendering of gdk is
limited to vertical and horizontal lines
;). The output is not antialiased.
Cairo, Dia and PDF
Recently a PDF backend arrived in Cairo cvs. But outside of Cairo the world
does not stand still either. So if you are just interested in cross platform
PDF creation you may want to take a look at
gnome-print.
Beside some issue with page boundaries (probably completely on Dia's
gprint site) the output
created via gnome-print looks quite usable (although too huge, 1.2 MB) .
The same input file rendered through Dia's wmf plug-in and processed by
Adobe PDF (printer driver)
is just 42K.
While at PDF - though just related by format - here's the
output of my native Cairo/win32 backend. The windoze meta file used
here was more than 2MB (partly due to glyphs still rendered as bitmaps,
the resulting file is 213K thanks to Word printing through Adobe PDF.
Oh and the here is also the output of
Cairo's built-in PDF (just no text and alpha rendering yet).
Conclusion
Every renderer presented here has some glitches. With a SVG capable
browser you can see how the image is
supposed to look like or some more defects ;-)
But if you know how to improve any of the renderers: patches accepted,
it is all open source ...