GD::Cairo - GD API wrapper around Cairo
use GD; # Needed for constants and GD::Polygon use GD::Cairo; # use GD; use GD::Cairo qw( :gd ); # Import GD constants and fonts # my $img = GD::Image->new( 400, 300, 1 ); my $img = GD::Cairo->new( 400, 300, 1 ); print $fh $img->svg;
This module provides a GD API emulation for the Cairo graphics library. Cairo is a vector-based drawing package that aims to provide consistent output to many graphics contexts/formats.
See <GD>.
Create a new image of WIDTH by HEIGHT. WIDTH and HEIGHT are in user-space units (e.g. pixels for PNG or points for PDF).
Ignore any missing functionality in GD::Cairo that may be in GD.
Return the image in PNG format.
Return the image in PDF format.
Return the image in SVG format.
(newFromPngData implemented.)
This is deprecated anyway.
Unlikely to ever work.
Ignored.
Patches/suggestions are welcome.
I don't think Cairo supports paletted images, see http://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t.
PngSurface doesn't appear to reliably translate coordinates onto the surface e.g. a point at 0,0 doesn't get rendered at all.
StringFT* will always render using 'Sans-Serif' and String* using 'Monospace' (which depend on fontconfig). I need an example for loading fonts with Cairo.
GD renders brushes by repeatedly rendering the brush (an image) along the path the given shape provides. This isn't practically achievable with Cairo (AFAIK), so instead I repeat the image along the path/fill.
Does not support gdStyledBrushed.
In order to support GD::Image::fill GD::Cairo builds a stack of operations, which makes it memory inefficient compared to writing direct to a GD::Image surface.
GD::Cairo also stores a hash entry for every pixel set with setPixel to support getPixel.
Cairo, GD, GD::SVG (includes extensive discussion of why translating GD to a vector library is difficult).
http://cairographics.org/manual/
Tim D Brody, <tdb01r@ecs.soton.ac.uk>
Copyright (C) 2007 by Tim D Brody
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install GD::Cairo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GD::Cairo
CPAN shell
perl -MCPAN -e shell install GD::Cairo
For more information on module installation, please visit the detailed CPAN module installation guide.