| 1 | package Image::TextMode::Reader::ANSIMation; | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Image::TextMode::Canvas; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||
| 6 | 2 | extends 'Image::TextMode::Reader::ANSI'; | |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||
| 8 | sub _read { | ||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | my ( $self, $animation, @args ) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
_read: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 10 | 4 | $animation->add_frame( Image::TextMode::Canvas->new ); | |||||||||||||||||||||||||||||||||||
| 11 | 4 | $self->SUPER::_read( $animation, @args ); | |||||||||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||
| 14 | sub set_position { | ||||||||||||||||||||||||||||||||||||
| 15 | 9 | ▶ | my ( $self, @args ) = @_; | ||||||||||||||||||||||||||||||||||
|
Subroutine
set_position: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||
| 17 | 9 | ▶ | if ( ( $args[ 0 ] || 1 ) == 1 && ( $args[ 1 ] || 1 ) == 1 ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition85%6/7
($args[0] || 1) == 1 and ($args[1] || 1) == 1
$args[0] || 1
$args[1] || 1
MC/DC0%0/2
($args[0] || 1) == 1 and ($args[1] || 1) == 1
$args[0]
$args[1]
Truth table33%1/3
A and B
A= $args[0]B= $args[1]
| |||||||||||||||||||||||||||||||||||||
| 18 | 7 | $self->next_frame; | |||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||
| 21 | 9 | $self->SUPER::set_position( @args ); | |||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||
| 24 | sub next_frame { | ||||||||||||||||||||||||||||||||||||
| 25 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||
|
Subroutine
next_frame: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 26 | 7 | my $animation = $self->image; | |||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||
| 28 | 7 | ▶ | return unless $animation->frames->[ -1 ]->height; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||
| 30 | 4 | $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<set_position(0,0)> 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 E<lt>bricas@cpan.orgE<gt> | ||||||||||||||||||||||||||||||||||||
| 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 | 2 | 1; | |||||||||||||||||||||||||||||||||||