Kevin Ryde > math-image > App::MathImage::Image::Base::LifeRLE

Download:
math-image-110.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 110   Source  

NAME ^

App::MathImage::Image::Base::LifeRLE -- game of life cellular grids in RLE format

SYNOPSIS ^

 use App::MathImage::Image::Base::LifeRLE;
 my $image = App::MathImage::Image::Base::LifeRLE->new (-width => 100,
                                                        -height => 100);
 $image->rectangle (0,0, 99,99, 'b');
 $image->xy (20,20, 'o');
 $image->line (50,50, 70,70, 'o');
 $image->line (50,50, 70,70, 'o');
 $image->save ('/some/filename.rle');

CLASS HIERARCHY ^

App::MathImage::Image::Base::LifeRLE is a subclass of Image::Base::Text, but don't rely on more than Image::Base for now.

    Image::Base
      Image::Base::Text
        App::MathImage::Image::Base::LifeRLE

DESCRIPTION ^

App::MathImage::Image::Base::LifeRLE extends Image::Base to create or update game of life RLE format files.

The colour names are " " (space), "b" or "." for background, and "o" for a set cell. For multi-state cells colours are numbers 0 to 255, with 0 being the background and 1 corresponding to "o".

FUNCTIONS ^

$image = App::MathImage::Image::Base::LifeRLE->new (key=>value,...)

Create and return a new image object. A new image can be started with -width and -height,

    $image = App::MathImage::Image::Base::LifeRLE->new (-width => 200, -height => 100);

Or an existing file can be read,

    $image = App::MathImage::Image::Base::LifeRLE->new (-file => '/some/filename.rle');
$image->save ()
$image->save ($filename)

Save the image to a text file, either the current -file option, or set that option to $filename and save to there.

The current code automatically chooses between "o/b" for a binary-only grid or "./A/B/etc" for multi-state. Perhaps there should be an option to force the multi-state format, or distinguish that from numbers used as colours.

SEE ALSO ^

Image::Base, Image::Base::Text

golly(6)

syntax highlighting: