| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Image::TextMode::Reader::ANSIMation; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 953 | use Moo; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 14 |  | 
| 4 | 2 |  |  | 2 |  | 1236 | use Image::TextMode::Canvas; | 
|  | 2 |  |  |  |  | 8 |  | 
|  | 2 |  |  |  |  | 344 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | extends 'Image::TextMode::Reader::ANSI'; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub _read { | 
| 9 | 4 |  |  | 4 |  | 10 | my ( $self, $animation, @args ) = @_; | 
| 10 | 4 |  |  |  |  | 59 | $animation->add_frame( Image::TextMode::Canvas->new ); | 
| 11 | 4 |  |  |  |  | 113 | $self->SUPER::_read( $animation, @args ); | 
| 12 |  |  |  |  |  |  | } | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | sub set_position { | 
| 15 | 9 |  |  | 9 | 1 | 18 | my ( $self, @args ) = @_; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 9 | 100 | 100 |  |  | 89 | if ( ( $args[ 0 ] || 1 ) == 1 && ( $args[ 1 ] || 1 ) == 1 ) { | 
|  |  |  | 100 |  |  |  |  | 
|  |  |  | 66 |  |  |  |  | 
| 18 | 7 |  |  |  |  | 21 | $self->next_frame; | 
| 19 |  |  |  |  |  |  | } | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 9 |  |  |  |  | 1622 | $self->SUPER::set_position( @args ); | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | sub next_frame { | 
| 25 | 7 |  |  | 7 | 1 | 9 | my $self      = shift; | 
| 26 | 7 |  |  |  |  | 138 | my $animation = $self->image; | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 7 | 100 |  |  |  | 150 | return unless $animation->frames->[ -1 ]->height; | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 4 |  |  |  |  | 163 | $animation->add_frame( Image::TextMode::Canvas->new ); | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =head1 NAME | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | Image::TextMode::Reader::ANSIMation - Reads ANSI Animation files | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | Provides reading capabilities for the ANSIMation format. This module | 
| 40 |  |  |  |  |  |  | extends the ANSI reader, and simply creates a new frame for every | 
| 41 |  |  |  |  |  |  | C command executed. | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =head1 METHODS | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =head2 set_position( [$x, $y] ) | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | We use this method as a clue that we're starting a new frame if $x and $y are | 
| 48 |  |  |  |  |  |  | both 1, which is the default. | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =head2 next_frame( ) | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | Adds a new frame to the stack. | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | =head1 AUTHOR | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | Brian Cassidy Ebricas@cpan.orgE | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | Copyright 2008-2014 by Brian Cassidy | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify | 
| 63 |  |  |  |  |  |  | it under the same terms as Perl itself. | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =cut | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | 1; |