NAME
Image::Base::Text -- draw in a plain text file or grid
SYNOPSIS
use Image::Base::Text;
my $image = Image::Base::Text->new (-width => 70,
-height => 20);
$image->rectangle (5,5, 65,15, '*');
$image->save ('/some/filename.txt');
CLASS HIERARCHY
Image::Base::Text is a subclass of Image::Base,
Image::Base
Image::Base::Text
DESCRIPTION
Image::Base::Text extends Image::Base to create or update text files treated as grids of characters, or just to create a grid of characters in memory.
Colours for drawing can be a single character to set in the image, or there's an experimental -colour_to_character attribute to map names to characters. Currently black, #000000, #000000000000 and clear all become spaces and anything else becomes a "*". Perhaps that will change.
Perl wide characters can be used, in new enough Perl, though currently there's nothing to set input or output encoding for file read/write (making it fairly useless, unless perhaps you've got global PerlIO layers setup).
FUNCTIONS
See "FUNCTIONS" in Image::Base for the behaviour common to all Image-Base classes.
$image = Image::Base::Text->new (key=>value,...)-
Create and return an image object. A image can be started with
-widthand-height,$image = Image::Base::Text->new (-width => 70, -height => 20);Or an existing file can be read,
$image = Image::Base::Text->new (-file => '/my/filename.txt'); $new_image = $image->new (key=>value,...)-
Create and return a cloned copy of
$image. The optional parameters are applied to the new image as perset. $image->load ()$image->load ($filename)-
Read a text file into
$image, either from the current-fileoption, or set that option to$filenameand read from there.Tab characters in the file are expanded to spaces per
Text::Tabs. Its$Text::Tabs::tabstopcontrols the width of each tab.-heightis set to the number of lines in the file, possibly zero.-widthis set to the widest line in the file and other lines are padded with spaces to that width as necessary. $image->save ()$image->save ($filename)-
Save the image to a text file, either the current
-fileoption, or set that option to$filenameand save to there.Trailing spaces are included in the output so that the width is represented in the file, and to keep it a rectangular grid. Tabs are not used in the output.
ATTRIBUTES
-width(integer)-height(integer)-
Setting these resizes an image, either truncating or extending. When extending the new area is initialized to space characters.
SEE ALSO
Image::Base, Text::Tabs, Image::Xpm
HOME PAGE
http://user42.tuxfamily.org/image-base-other/index.html
LICENSE
Image-Base-Other is Copyright 2010, 2011, 2012 Kevin Ryde
Image-Base-Other is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Image-Base-Other is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Image-Base-Other. If not, see <http://www.gnu.org/licenses/>.