line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Image::TextMode::Format::XBin; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
5530
|
use Moo; |
|
3
|
|
|
|
|
60698
|
|
|
3
|
|
|
|
|
17
|
|
4
|
3
|
|
|
3
|
|
6665
|
use Types::Standard qw( HashRef ); |
|
3
|
|
|
|
|
201088
|
|
|
3
|
|
|
|
|
48
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Flag byte constants |
7
|
|
|
|
|
|
|
my $FLAG_PALETTE = 1; |
8
|
|
|
|
|
|
|
my $FLAG_FONT = 2; |
9
|
|
|
|
|
|
|
my $FLAG_COMPRESSED = 4; |
10
|
|
|
|
|
|
|
my $FLAG_NON_BLINK = 8; |
11
|
|
|
|
|
|
|
my $FLAG_FIVETWELVE_CHARS = 16; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
extends 'Image::TextMode::Format', 'Image::TextMode::Canvas'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has 'header' => ( |
16
|
|
|
|
|
|
|
is => 'rw', |
17
|
|
|
|
|
|
|
isa => HashRef, |
18
|
|
|
|
|
|
|
default => sub { |
19
|
|
|
|
|
|
|
{ id => 'XBIN', |
20
|
|
|
|
|
|
|
eofchar => chr( 26 ), |
21
|
|
|
|
|
|
|
map { $_ => 0 } qw( width height fontsize flags ) |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub has_palette { |
27
|
1
|
|
|
1
|
1
|
497
|
shift->header->{ flags } & $FLAG_PALETTE; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub has_font { |
31
|
1
|
|
|
1
|
1
|
392
|
shift->header->{ flags } & $FLAG_FONT; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub is_compressed { |
35
|
1
|
|
|
1
|
1
|
2444
|
shift->header->{ flags } & $FLAG_COMPRESSED; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub is_non_blink { |
39
|
1
|
|
|
1
|
1
|
491
|
shift->header->{ flags } & $FLAG_NON_BLINK; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub has_fivetwelve_chars { |
43
|
1
|
|
|
1
|
1
|
474
|
shift->header->{ flags } & $FLAG_FIVETWELVE_CHARS; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
1
|
556
|
sub extensions { return 'xb', 'xbin' } |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Image::TextMode::Format::XBin - read and write XBin files |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
XBin stands for "eXtended BIN" -- an extention to the normal raw-image BIN files. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
XBin features: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=over 4 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=item * allows for binary images up to 65536 columns wide, and 65536 lines high |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * can have an alternate set of palette colors either in blink or in non-blink mode |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * can have different textmode fonts from 1 to 32 scanlines high, consisting of either 256 or 512 different characters |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * can be compressed |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=back |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
XBin file stucture: |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
+------------+ |
73
|
|
|
|
|
|
|
| Header | |
74
|
|
|
|
|
|
|
+------------+ |
75
|
|
|
|
|
|
|
| Palette | |
76
|
|
|
|
|
|
|
+------------+ |
77
|
|
|
|
|
|
|
| Font | |
78
|
|
|
|
|
|
|
+------------+ |
79
|
|
|
|
|
|
|
| Image Data | |
80
|
|
|
|
|
|
|
+------------+ |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Note, the only required element is a header. See the XBin specs for for information. |
83
|
|
|
|
|
|
|
http://www.acid.org/info/xbin/xbin.htm |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 ACCESSORS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over 4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * header - A header hashref containing an id, width, height, font size and any extra flags |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=back |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 METHODS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 new( %args ) |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Creates a XBin instance. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 has_palette( ) |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Retrieves palette status from the flag byte in the header. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 has_font( ) |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Retrieves font status from the flag byte in the header. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 is_compressed( ) |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Retrieves compressed status from the flag byte in the header. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 is_non_blink( ) |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Retrieves non-blink status from the flag byte in the header. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 has_fivetwelve_chars( ) |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Retrieves 512 character font status from the flag byte in the header. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 extensions( ) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Returns 'xb', 'xbin'. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Brian Cassidy Ebricas@cpan.orgE |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright 2008-2015 by Brian Cassidy |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
132
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |