| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Image::TextMode::Animation; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1334
|
use Moo; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
20
|
|
|
4
|
3
|
|
|
3
|
|
696
|
use Types::Standard qw( ArrayRef ); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
20
|
|
|
5
|
3
|
|
|
3
|
|
2505
|
use Symbol (); |
|
|
3
|
|
|
|
|
2004
|
|
|
|
3
|
|
|
|
|
240
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
|
8
|
3
|
|
|
3
|
|
9
|
for my $sub ( |
|
9
|
|
|
|
|
|
|
qw( getpixel getpixel_obj putpixel clear_screen clear_line ) ) |
|
10
|
|
|
|
|
|
|
{ |
|
11
|
15
|
|
|
|
|
39
|
*{ Symbol::qualify_to_ref( __PACKAGE__ . "\::$sub" ) } = sub { |
|
12
|
33
|
|
|
33
|
|
1654
|
shift->frames->[ -1 ]->$sub( @_ ); |
|
13
|
|
|
|
|
|
|
} |
|
14
|
15
|
|
|
|
|
151
|
} |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Image::TextMode::Animation - A base class for text mode animation file formats |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This class should be used for any format that requires a sequence of frames |
|
24
|
|
|
|
|
|
|
for display. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=over 4 |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=item * frames - an arrayref of frame objects |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=back |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'frames' => ( is => 'rw', lazy => 1, isa => ArrayRef, default => sub { [] } ); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 new( %args ) |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Creates a new instance. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 add_frame( $frame ) |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Adds a frame to the end of the array. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub add_frame { |
|
51
|
8
|
|
|
8
|
1
|
3402
|
my ( $self, $frame ) = @_; |
|
52
|
8
|
|
|
|
|
9
|
push @{ $self->frames }, $frame; |
|
|
8
|
|
|
|
|
106
|
|
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 width( ) |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Returns the largest frame width. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub width { |
|
62
|
4
|
|
|
4
|
1
|
1320
|
my $self = shift; |
|
63
|
4
|
|
|
|
|
6
|
my @widths = sort { $b <=> $a } map { $_->width } @{ $self->frames }; |
|
|
4
|
|
|
|
|
35
|
|
|
|
8
|
|
|
|
|
167
|
|
|
|
4
|
|
|
|
|
94
|
|
|
64
|
4
|
|
|
|
|
22
|
return $widths[ 0 ]; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 height( ) |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Returns the largest frame height. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub height { |
|
74
|
4
|
|
|
4
|
1
|
4
|
my $self = shift; |
|
75
|
4
|
|
|
|
|
5
|
my @heights = sort { $b <=> $a } map { $_->height } @{ $self->frames }; |
|
|
4
|
|
|
|
|
25
|
|
|
|
8
|
|
|
|
|
147
|
|
|
|
4
|
|
|
|
|
59
|
|
|
76
|
4
|
|
|
|
|
21
|
return $heights[ 0 ]; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 dimensions( ) |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Returns the a list containing the values of C and C. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub dimensions { |
|
86
|
2
|
|
|
2
|
1
|
1700
|
my $self = shift; |
|
87
|
2
|
|
|
|
|
9
|
return $self->width, $self->height; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 as_ascii( ) |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Returns all of the text from all of the frames. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub as_ascii { |
|
97
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
98
|
0
|
|
|
|
|
|
return join( "\n", map { $_->as_ascii } @{ $self->frames } ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 PROXIED METHODS |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The following methods are proxies to the last element in C. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over 4 |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * getpixel |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * getpixel_obj |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * putpixel |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * clear_screen |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * clear_line |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=back |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHOR |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Brian Cassidy Ebricas@cpan.orgE |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Copyright 2008-2015 by Brian Cassidy |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
128
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |