Text::AAlib - Perl Binding for AAlib
use Text::AAlib; use Imager; my $img = Imager->new( file => 'sample.jpg' ); my ($width, $height) = ($img->getwidth, $img->getheight); my $aa = Text::AAlib->new( width => $width, height => $height, mask => AA_REVERSE_MASK, ); $aa->put_image(image => $img); print $aa->render();
Text::AAlib is perl binding for AAlib. AAlib is a library for creating ascii art(AA).
Text::AAlib->new(%args)
Creates and returns a new Text::AAlib instance.
%args is:
%args
Width of output file.
Height of output file.
Masks for attribute. Supported masks are AA_NORMAL_MASK, AA_DIM_MASK, AA_BOLD_MASK, AA_BOLDFONT_MASK, AA_REVERSE_MASK.
AA_NORMAL_MASK
AA_DIM_MASK
AA_BOLD_MASK
AA_BOLDFONT_MASK
AA_REVERSE_MASK
$aalib->putpixel(%args)
x-coordinate of pixel. x parameter should be 0 <= x <= width. width is parameter of constructor.
x
width
y-coordinate of pixel. y parameter should be 0 <= y <= height. height is parameter of constructor.
y
height
Brightness of pixel. color parameter should be 0 <= color <= 255.
color
$aalib->puts(%args)
x-coordinate.
y-coordinate
String set
Buffer attribute. This parameter should be AA_NORMAL, AA_BOLD, AA_DIM, AA_BOLDFONT, AA_REVERSE.
$aalib->put_image(%args)
Image as Imager object
$aalib->render(%args) :Str
Render buffer and return it as plain text. You can specify render parameter following
$aalib->as_string($with_attr) :Str
Return AA as string. If $with_attr is true, text attribute(BOLD, DIM, REVERSE) is enable.
$with_attr
$aalib->resize()
Resize buffers at runtime.
$aalib->flush()
Flush buffers.
$aalib->close()
Close AAlib context.
Syohei YOSHIDA <syohex@gmail.com>
Copyright 2011- Syohei YOSHIDA
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Some idea are taken from python-aalib. http://aa-project.sourceforge.net/aalib/
http://jwilk.net/software/python-aalib
To install Text::AAlib, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::AAlib
CPAN shell
perl -MCPAN -e shell install Text::AAlib
For more information on module installation, please visit the detailed CPAN module installation guide.