Graph::Renderer - draw the graph onto a real plane
my $graph = new Graph; ... use Graph::Layouter; Graph::Layouter::layout($graph); use Graph::Renderer; Graph::Renderer::render($graph, $img);
This module provides an abstract class for drawing a given layouted graph (created usually by
Graph::Layouter) through various image creation interfaces (
All the relevant layouting information used for nodes positioning is load from the graph, as saved by
Graph::Layouter (see its documentation for the relevant attributes description). In addition, relevant rendering information can be load from the graph attributes as well, if necessary and available.
This module contains only the abstract class, you will probably want to get an instance of some particular drawing tool interface instead;
Graph::Renderer::Imager is bundled with this distribution. The general interface for all the subclasses is described below, but be sure consult also the particular class' documentation for remarks, special notes and specific extensions.
This subroutine is the only entry point of this module, taking a given graph and rendering it accordingly to its attributes. The subroutine can be called in several ways:
The subroutine can be called as a function (it is not automatically exported, but you can import it on your own if you really want; see the synopsis above). It takes two parameters, the
Graph class (or any descendant) instance and instance of the appropriate image object (see subclasses documentation). It will load the rendering information from graph's both global and per-vertex attributes.
The subroutine returns the image object if it all went well, undef otherwise.
The common rendering attributes not generated by the layouter are:
This should contain information about the font used for vertex titles; the specific format depends on the subclass. If this information is not made available by the caller, the given backend can try to figure it out but it might well fail.
This is identical to the global renderer_vertex_font attribute, but used only for the single vertex.
Title of the vertex, which is displayed nearby. The vertex number is displayed if no title is attached. You can attach an empty string to the vertex if you want no title shown at all.
The object-oriented interface is missing as well as some more universal render calling interface (hash parameters). Also, some more rendering attributes (ie. color settings, own dimensions) are missing.
Copyright 2004 by Petr Baudis <email@example.com>.
This code is distributed under the same copyright terms as Perl itself.
$Id: Renderer.pm,v 1.4 2006/02/11 17:11:39 pasky Exp $