Image::Magick::PolyText::FreeType - Draw text along a polyline using FreeType and Image::Magick
Image::Magick::PolyText::FreeType
my $polytext = Image::Magick::PolyText::FreeType -> new ({ debug => 0, fill => 'Red', image => $image, pointsize => 16, rotate => 1, slide => 0.1, stroke => 'Red', strokewidth => 1, text => 'Draw.text.along.a.polyline', # Can't use spaces! x => [0, 1, 2, 3, 4], y => [0, 1, 2, 3, 4], }); $polytext -> annotate;
Warning: Experimental code - Do not use.
Image::Magick::PolyText::FreeType is a pure Perl module.
It is a convenient wrapper around the Image::Magick Annotate() method, for drawing text along a polyline.
Image::Magick Annotate()
This module is available both as a Unix-style distro (*.tgz) and an ActiveState-style distro (*.ppd). The latter is shipped in a *.zip file.
See http://savage.net.au/Perl-modules.html for details.
See http://savage.net.au/Perl-modules/html/installing-a-module.html for help on unpacking and installing each type of distro.
new(...) returns an Image::Magick::PolyText::FreeType object.
This is the class contructor.
Usage: Image::Magick::PolyText::FreeType -> new({...}).
This method takes a hashref of parameters.
For each parameter you wish to use, call new as new({param_1 => value_1, ...}).
Takes either 0 or 1 as its value.
The default value is 0.
When set to 1, the module writes to STDOUT, and plots various stuff on your image.
This parameter is optional.
Takes an Image::Magick color as its value.
Image::Magick
The default value is 'Red'.
The value is passed to the Image::Magick Annotate() method.
Takes an Image::Magick object as its value.
There is no default value.
This parameter is mandatory.
Takes an integer as its value.
The default value is 16.
The default value is 1.
When set to 0, the module does not rotate any characters in the text.
When set to 1, the module rotates each character in the text to match the tangent of the polyline at the 'current' (x, y) position.
Takes a real number in the range 0.0 to 1.0 as its value.
The default value is 0.0.
The value represents how far along the polyline (0.0 = 0%, 1.0 = 100%) to slide the first character of the text.
The parameter is optional.
Takes a string of characters as its value.
This text is split character by character, and each character is drawn with a separate call to the Image::Magick Annotate() method. This is a very slow process. You have been warned.
Takes an array ref of x (co-ordinate) values as its value.
These co-ordinates are the x-axis values of the polyline.
Takes an array ref of y (abcissa) values as its value.
These abcissa are the y-axis values of the polyline.
This method writes the text on to your image.
%options is an optional hash of (key => value) pairs.
This method draws a line through the data points.
The default line color is green.
The options are a hash ref which is passed to the Image::Magick Draw() method, so any option acceptable to Draw() is acceptable here.
Image::Magick Draw()
Draw()
A typical usage would be $polytext -> draw({stroke => 'blue'});
This method draws little (5x5 pixel) rectangles centered on the data points.
The default rectangle color is red.
A typical usage would be $polytext -> highlight_data_points({stroke => 'black'});
See the file examples/ptf.pl in the distro.
The file Changes was converted into Changelog.ini by Module::Metadata::Changes.
Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
https://github.com/ronsavage/Image-Magick-PolyText
Email the author, or log a bug on RT:
https://rt.cpan.org/Public/Dist/Display.html?Name=Image-Magick-PolyText.
Image::Magick::PolyText::FreeType was written by Ron Savage <ron@savage.net.au> in 2007.
Home page: http://savage.net.au/index.html
Australian copyright (c) 2007, Ron Savage. All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Perl License, a copy of which is available at: http://dev.perl.org/licenses/
To install Image::Magick::PolyText, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::Magick::PolyText
CPAN shell
perl -MCPAN -e shell install Image::Magick::PolyText
For more information on module installation, please visit the detailed CPAN module installation guide.