Ticket #737 (new enhancement)

Opened 2 years ago

Last modified 2 months ago

Use cairo instead of librsvg to render antialiased png's (from svg)

Reported by: tizianomueller Assigned to: pkropf
Priority: low Component: GraphvizPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.9

Description

At the moment librsvg is needed to render antialiased png. The problem is that the dependencies for this lib in fact require a complete X-Window environment.
With cairo and libsvg-cairo (and the python-bindings of course) it would be possible to render the svg's generated by the graphviz tools to png with very decent performance.

Example-Code:

import cairo, cairo.svg
svgctx = cairo.svg.Context()
svgctx.parse("test.svg")
width, height = svgctx.get_size()
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
ctx = cairo.Context(surface)
svgctx.render(ctx)
surface.write_to_png("test.png")

I'll try to write a patch within the next week.

Attachments

Change History

02/14/07 08:43:54 changed by Blackhex

Futhermore there is an unpleasant bug in dot's SVG export where long labels overlaps node, which makes this file type unusuable to draw UML class diagram charts.

03/14/07 18:18:07 changed by whiteblizzard

Workaround for this is to specify:

#!graphviz.dot/gif

as the header for your dot code. This way you loose the anti-aliasing, since it isn't implemented for gif files. Caveat: If you set a size parameter the fonts will look very ugly.

03/24/08 08:01:35 changed by anonymous

stair parts Frequent Buyer Discounts available to Builders & Contractors on stair parts and wrought iron balusters We Ship Fast - Call us for an estimated shipping time. iron railing and fences with decor design We offer both Amish Quality and Contractor Grade Stair Parts. step railing Our customers are loyal, find out why!

10/13/08 11:21:57 changed by cboos

Suggesting a wontfix here, as graphviz itself can be built with cairo support, see http://www.graphviz.org/Download_source.php.

Looking at version 2.20.3 (current stable as of today), it's even the default:

  --with-pangocairo=yes   pangocairo library

Installing all the dependencies is of course a bit tedious if you have an old system, but probably no more work than getting the dependencies for the suggested pipeline (or the one suggested in #1610). Once you have it in place, it's certainly a more robust solution.


Add/Change #737 (Use cairo instead of librsvg to render antialiased png's (from svg))




Change Properties
Action