NAME
Image::Magick::Text::AutoBreak - Utility for auto line break
VERSION
This document describes Image::Magick::Text::AutoBreak version 0.01
DESCRIPTION
This is a utility class for Image::Magick. With this module, you can easily annotate long strings into multiple lines.
SYNOPSIS
use Image::Magick::Text::AutoBreak;
### Prepare source
my $image = Image::Magick->new;
$image->Read($filename);
### Constractor
my $autobreak =
Image::Magick::Text::AutoBreak->new(
magick => $image,
width => 231,
height => 260,
x => 10,
y => 80,
ngCharaForHead => qr/[\\Q,)]`.:;\\E]/,
ngCharaForTail => qr/[\\Q([_\\E]/,
ngCharaForSepa => qr/[\\Qa-zA-Z0-9'".,!?-\\E]/,
);
### Prepare for annotate before hand
my @result = $autobreak->prepare(
text => $input_string,
font => $font_path,
pointsize => 9,
fill => '#000000',
);
### Annotate
$autobreak->annotate();
### Repeatedly if you need
$autobreak->annotate(fill => '#0000ff');
INTERFACE
new
Constractor. This calls for folloing arguments.
magick
Image::Magick instance.
x
Horizontal position of text area.
y
Vertical position of text area.
width
Width of text area. If not given, allocates [source image width] - x
height
Height of text area. If not given, allocates [source image height] - y
ngCharaForHead
Denied charactors for line head in regular expression
ngCharaForTail
Denied charactors for end-of-line in regular expression
ngCharaForSepa
Denied charactors for separation in regular expression
prepare
This method prepare the annotaion plan. This calls for same arguments as the Image::Magick::QueryFontMetrics does, and the arguments will be thrown at it.
my @result = $autobreak->prepare(
text => $input_string,
font => $font,
fill => '#000000',
pointsize => 12,
);
The arguments will be adopted for default args of annotate thereafter. This method returns the box size of annotation area in array.
annotate
This method is a wrapper for Image::Magick::Annotate. This does Annotate iteratively so that the input strings will be put into multiple line.
This method automatically takes the arguments that prepare has gotten, and you can override each of them.
$autobreak->annotate(fill => '#ffffff');
The arguments will be thrown at Image::Magick::Annotate. Practically, you should give the arguments that doesn't have influence on the position or size of each line.
# This doesn't make sense
$autobreak->annotate(pointsize => 14);
You can do annotate repeatedly if you need to decorate or something.
# Draw stroke
$autobreak->annotate(
fill => '#ffffff',
stroke => '#ffffff',
strokewidth => 6,
);
# real part
$autobreak->annotate();
This method returns the box size of prepared annotation area in array.
getResult
This method returns the box size of prepared annotation area in array.
CONFIGURATION AND ENVIRONMENT
Image::Magick::Text::AutoBreak requires no configuration files or environment variables.
DEPENDENCIES
INCOMPATIBILITIES
None reported.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-syntax-highlight-engine-Simple@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
SEE ALSO
AUTHOR
Sugama Keita <sugama@jamadam.com>
LICENCE AND COPYRIGHT
Copyright (c) 2008, Sugama Keita <sugama@jamadam.com>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.