| Image-TextMode documentation | Contained in the Image-TextMode distribution. |
Image::TextMode::Reader::ANSIMation - Reads ANSI Animation files
Provides reading capabilities for the ANSIMation format. This module
extends the ANSI reader, and simply creates a new frame for every
set_position(0,0) command executed.
We use this method as a clue that we're starting a new frame if $x and $y are both 1, which is the default.
Adds a new frame to the stack.
Brian Cassidy <bricas@cpan.org>
Copyright 2008-2011 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Image-TextMode documentation | Contained in the Image-TextMode distribution. |
package Image::TextMode::Reader::ANSIMation; use Moose; use Image::TextMode::Canvas; extends 'Image::TextMode::Reader::ANSI'; sub _read { my ( $self, $animation, @args ) = @_; $animation->add_frame( Image::TextMode::Canvas->new ); $self->SUPER::_read( $animation, @args ); } sub set_position { my ( $self, @args ) = @_; if ( ( $args[ 0 ] || 1 ) == 1 && ( $args[ 1 ] || 1 ) == 1 ) { $self->next_frame; } $self->SUPER::set_position( @args ); } sub next_frame { my $self = shift; my $animation = $self->image; return unless $animation->frames->[ -1 ]->height; $animation->add_frame( Image::TextMode::Canvas->new ); } no Moose; __PACKAGE__->meta->make_immutable;
1;