The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Image::ANSI::Parser - Reads in ANSI files

SYNOPSIS

        my $parser = Image::ANSI::Parser->new;
        my $ansi   = $parser->parse( file => 'file.ans' );

METHODS

new( [%options] )

Creates a new parser object and reads in a file, handle or string.

clear( )

Clears the internal ANSI object.

parse( %options )

Reads in a file, handle or string

        my $parser = Image::ANSI::Parser->new;

        # filename
        $ansi = $parser->parse( file => 'file.ans' );
        
        # file handle
        $ansi = $parser->parse( handle => $handle );

        # string
        $ansi = $parser->parse( string => $string );

ansi( [$ansi] )

Gets / sets the internal ANSI object.

x( [$x] )

stores the current 'x' location.

y( [$y] )

stores the current 'y' location.

set_position( [$x, $y] )

sets the x() and y() positions.

set_attributes( @attributes )

sets the attributes of the pixel (fg, bg, blinking)

move_up( [$number] )

moves y() up by $number (default 1).

move_down( [$number] )

moves y() down by $number (default 1).

move_right( [$number] )

moves x() right by $number (default 1).

move_left( [$number] )

moves x() left by $number (default 1).

save_position( )

saves the current x() and y() positions.

restore_position( )

restored the saved x() and y() positions.

clear_line( )

clears the pixels on the current line.

clear_screen( )

clears all pixels.

new_line( )

simulates a newline char.

tab( )

simulates a tab char (8 spaces).

store( $char, $x, $y [, $attr] )

stores $char at position $x, $y using attributes $attr (or the current attr setting if none are supplied).

putpixel( @args )

same as the pixel() method

getpixel( @args )

same as the pixel() method

pixel( $x, $y [, $char, $attr] )

get/sets the pixel at $x, $y.

AUTHOR

  • Brian Cassidy <bricas@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2005 by Brian Cassidy

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.