NAME
FML::String::Banner - manipulate a banner string.
SYNOPSIS
use FML::String::Banner;
my $banner = new FML::String::Banner;
$banner->set_string($string);
# ASCII version.
my $ascii = $banner->as_ascii();
printf("\n
[%s]\n\n%s\n
\n", $name_magic, $ascii);
# PNG version.
use File::Spec;
my $png_filename = sprintf("%s.png", $session_id);
my $image_file = File::Spec->catfile($html_tmp_dir, $png_filename);
use FileHandle;
my $wh = new FileHandle "> $image_file";
if (defined $wh) {
$wh->binmode();
my $png = $banner->as_png();
$wh->print($png);
$wh->close();
}
my $url_base = $config->{ html_tmp_base_url };
my $url = sprintf("%s/%s", $url_base, $png_filename);
printf("\n%s\n\n\n", $name_magic, $url);
DESCRIPTION
generate a banner for the specified string.
The output is either of ascii strings or png format image.
Also, the output is bended. In the case of ascii format, the vertical
position varies randomely within the specified "drift" paremeter (see
set_drift() method). In the case of image (PNG) format, the output image
is vertically varied, bended and be colorful.
METHODS
new()
constructor.
set_string($string)
set the current string to manipulate.
get_string()
get the current string to manipulate.
set_drift($drift)
set the drift parameter.
This parameter is a tunable parameter used to shift the letter position
or bend the letter.
get_drift()
get the drift parameter.
as_ascii([$string])
generate an ascii based banner string.
return the generated string image.
as_png([$string])
generate GD based image as PNG format.
return the generated PNG image format. You need to save it into a file
at the caller side.
CODING STYLE
See "http://www.fml.org/software/FNF/" on fml coding style guide.
AUTHOR
Ken'ichi Fukamachi
COPYRIGHT
Copyright (C) 2008 Ken'ichi Fukamachi
All rights reserved. This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
HISTORY
FML::String::Banner appeared in fml8 mailing list driver package. See
"http://www.fml.org/" for more details.