line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Image::TextMode::Reader::Bin; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
875
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Image::TextMode::Reader'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub _read { |
8
|
2
|
|
|
2
|
|
4
|
my ( $self, $image, $fh, $options ) = @_; |
9
|
|
|
|
|
|
|
|
10
|
2
|
50
|
|
|
|
61
|
if ( $image->has_sauce ) { |
11
|
0
|
|
|
|
|
0
|
$image->render_options->{ blink_mode } = ($image->sauce->flags_id & 1) ^ 1; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
50
|
|
|
116
|
my $width = $options->{ width } || 160; |
15
|
2
|
|
|
|
|
4
|
my ( $x, $y ) = ( 0, 0 ); |
16
|
2
|
|
|
|
|
3
|
my $eof = chr( 26 ); |
17
|
2
|
|
|
|
|
4
|
my $chardata; |
18
|
2
|
|
|
|
|
52
|
while ( read( $fh, $chardata, 2 ) ) { |
19
|
8
|
|
|
|
|
34
|
my @data = unpack( 'aC', $chardata ); |
20
|
8
|
50
|
33
|
|
|
42
|
last if tell( $fh ) > $options->{ filesize } || $data[ 0 ] eq $eof; |
21
|
8
|
|
|
|
|
40
|
$image->putpixel( { char => $data[ 0 ], attr => $data[ 1 ] }, $x, |
22
|
|
|
|
|
|
|
$y ); |
23
|
|
|
|
|
|
|
|
24
|
8
|
|
|
|
|
258
|
$x++; |
25
|
8
|
50
|
|
|
|
35
|
if ( $x == $width ) { |
26
|
0
|
|
|
|
|
0
|
$x = 0; |
27
|
0
|
|
|
|
|
0
|
$y++; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
23
|
return $image; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Image::TextMode::Reader::Bin - Reads Bin files |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Provides reading capabilities for the Bin format. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 AUTHOR |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Brian Cassidy Ebricas@cpan.orgE |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Copyright 2008-2015 by Brian Cassidy |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
51
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |