Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Image::ANSI
Load, create, manipulate and save ANSI files

Image::ANSI - Load, create, manipulate and save ANSI files


NAME

Image::ANSI - Load, create, manipulate and save ANSI files


SYNOPSIS


        use Image::ANSI;

        # Read in a file...

        my $img = Image::ANSI->new( file => 'file.ans' );

        # Image width and height

        my $w = $img->width;

        my $h = $img->height;

        # get and put "pixels"

        my $pixel = $img->getpixel( $x, $y );

        $img->putpixel( $x, $y, $pixel );

        # create a thumbnail

        my $png = $img->as_png( mode => 'thumbnail' );

        # export it as a png

        my $png = $img->as_png( mode => 'full' );

        # use a custom font

        my $png = $img->as_png( mode => 'full', font => 'Image::ANSI::Font::8x8' );


DESCRIPTION

This module allows you to load, create and manipulate files made up of ANSI escape codes, aka ANSI art.


INSTALLATION

To install this module via Module::Build:


        perl Build.PL

        ./Build         # or `perl Build`

        ./Build test    # or `perl Build test`

        ./Build install # or `perl Build install`

To install this module via ExtUtils::MakeMaker:


        perl Makefile.PL

        make

        make test

        make install


METHODS

new( %options )

Creates a new ANSI image. Currently only reads in data.


        # filename

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

        

        # file handle

        $ansi = Image::ANSI->new( handle => $handle );

        # string

        $ansi = Image::ANSI->new( string => $string );

clear( )

Clears any in-memory data.

read( %options )

Reads in an ANSI.

write( %options )

Writes the ANSI data to a file, filehandle or string.

as_string( %options )

Returns the ANSI output as a scalar.

putpixel( $x, $y, $pixel )

Sets the pixel at $x, $y with $pixel (which should be an Image::ANSI::Pixel).

getpixel( $x, $y )

Returns the Image::ANSI::Pixel object at $x, $y (or undef).

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

Generic get / set method used by both getpixel and putpixel.

width( )

Returns the image width.

height( )

Returns the image height.

sauce( [File::SAUCE] )

Gets / sets the SAUCE object associated with the ANSI.

max_x( [$y] )

find the largest x on line $y (default 0 ).

clear_line( $y )

clears lines $y.

as_ascii( )

strip the attributes and return only the characters.

as_png( [%options] )

Returns a binary PNG version of the image.


        # Thumbnail -- Default

        $ansi->as_png( mode => 'thumbnail' );

        # Full size

        $ansi->as_png( mode => 'full' );

This function is just a wrapper around as_png_thumbnail() and as_png_full().

as_png_thumbnail( [%options] )

Creates a thumbnail version of the ANSI.

as_png_full( [%options] )

Creates a full-size replica of the ANSI. You can pass a ``crop'' option to crop the image at certain height.


        # Crop it after 25 (text-mode) rows

        $ansi->as_png_full( crop => 25 );


AUTHOR


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.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy