TextMode/Reader/ANSI.pm

filter: Statementstmt 88.9% 177 / 199 Branchbran 79.3% 92 / 116 Conditioncond 62.5% 20 / 32 MC/DCmcdc 42.1% 8 / 19 Subroutinesub 95.2% 20 / 21 Podpod 100% 16 / 16 totaltotal 82.6% 333 / 403 CC 76 SCAR 29.3
CC
76
Cov
83%
_read
38.0
set_attributes
22.5
store
7.2
CRAP 18.7
« TextMode/Renderer/GD.pm ↑ Summary TextMode/Loader.pm »
1 package Image::TextMode::Reader::ANSI;
2  
3 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use Types::Standard qw( Int HashRef Bool Object );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 ▶use charnames ':full';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 8 extends 'Image::TextMode::Reader';
8  
9 # State definitions
10 8 my $S_TXT = 0;
11 8 my $S_CHK_B = 1;
12 8 my $S_WAIT_LTR = 2;
13 8 my $S_END = 3;
14  
15 8 has 'tabstop' => ( is => 'rw', isa => Int, default => 8 );
16  
17 8 has 'save_x' => ( is => 'rw', isa => Int, default => 0 );
18  
19 8 has 'save_y' => ( is => 'rw', isa => Int, default => 0 );
20  
21 8 has 'x' => ( is => 'rw', isa => Int, default => 0 );
22  
23 8 has 'y' => ( is => 'rw', isa => Int, default => 0 );
24  
25 8 has 'attr' => ( is => 'rw', isa => Int, default => 7 );
26  
27 23 ▶has 'rgbattr' => ( is => 'rw', isa => HashRef, default => sub { { fg => [ 0xaa, 0xaa, 0xaa ], bg => [ 0, 0, 0 ] } } );
Subroutine __ANON__: called CC=1 SCAR=0.0
28  
29 8 has 'is_truecolor' => ( is => 'rw', isa => Bool, default => 0 );
30  
31 8 has 'state' => ( is => 'rw', isa => Int, default => $S_TXT );
32  
33 8 has 'image' => ( is => 'rw', isa => Object );
34  
35 8 has 'linewrap' => ( is => 'rw', isa => Int, default => 80 );
36  
37 sub _read {
38 23 ▶ my ( $self, $image, $fh, $options ) = @_;
Subroutine _read: called CC=34 SCAR=36.4
39  
40 23 $self->image( $image );
41 23 ▶ if ( $options->{ width } ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($options->{"width"}) 1 22 23
42 1 $self->linewrap( $options->{ width } );
43 }
44  
45 23 ▶ if ( $image->has_sauce ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($image->has_sauce) 1 22 23
46 1 $image->render_options->{ blink_mode } = $image->sauce->flags_id ^ 1;
47 }
48  
49 23 seek( $fh, 0, 0 );
50  
51 # make sure we reset the state of the parser
52 23 $self->state( $S_TXT );
53  
54 23 my ( $argbuf, $ch );
55 23 ▶ while ( read( $fh, $ch, 1 ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (read $fh, $ch, 1) 27637 11 27648
56 27637 my $state = $self->state;
57 27637 ▶ last if tell( $fh ) > $options->{ filesize };
Branch: 1 branch
BranchTrueFalseTotal
if tell $fh > $options->{"filesize"} 0 27637 27637
58 27637 ▶ if ( $state == $S_TXT ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($state == $S_TXT) { } 26455 1182 27637
elsif ($state == $S_CHK_B) { } 182 1000 1182
elsif ($state == $S_WAIT_LTR) { } 988 12 1000
elsif ($state == $S_END) { } 12 0 12
59 26455 ▶ if ( $ch eq "\N{SUBSTITUTE}" ) {
Branch: 5 branches
BranchTrueFalseTotal
if ($ch eq "\cZ") { } 13 26442 26455
elsif ($ch eq "\e") { } 182 26260 26442
elsif ($ch eq "\n") { } 13018 13242 26260
elsif ($ch eq "\r") { } 13015 227 13242
elsif ($ch eq "\t") { } 2 225 227
60 13 $self->state( $S_END );
61 }
62 elsif ( $ch eq "\N{ESCAPE}" ) {
63 182 $self->state( $S_CHK_B );
64 }
65 elsif ( $ch eq "\n" ) {
66 13018 $self->new_line;
67 }
68 elsif ( $ch eq "\r" ) {
69  
70 # do nothing
71 }
72 elsif ( $ch eq "\t" ) {
73 2 $self->tab;
74 }
75 else {
76 225 $self->store( $ch );
77 }
78 }
79 elsif ( $state == $S_CHK_B ) {
80 182 ▶ if ( $ch ne '[' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ch ne '[') { } 0 182 182
81 0 $self->store( chr( 27 ) );
82 0 $self->store( $ch );
83 0 $self->state( $S_TXT );
84 }
85 else {
86 182 $self->state( $S_WAIT_LTR );
87 }
88 }
89 elsif ( $state == $S_WAIT_LTR ) {
90 988 ▶ if ( $ch =~ /[a-zA-Z]/s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ch =~ /[a-zA-Z]/s) { } 182 806 988
91 182 $argbuf =~ s{\s}{}sg; # eliminate whitespace from args
92 182 my @args = split( /;/s, $argbuf );
93  
94 182 ▶ if ( $ch eq 'm' ) {
Branch: 16 branches
BranchTrueFalseTotal
if ($ch eq 'm') { } 148 34 182
elsif ($ch eq 'H' or $ch eq 'f') { } 10 24 34
elsif ($ch eq 'A') { } 2 22 24
elsif ($ch eq 'B') { } 2 20 22
elsif ($ch eq 'C') { } 2 18 20
elsif ($ch eq 'D') { } 2 16 18
elsif ($ch eq 'E') { } 0 16 16
elsif ($ch eq 'F') { } 1 15 16
elsif ($ch eq 'G') { } 0 15 15
elsif ($ch eq 'h') { } 1 14 15
elsif ($ch eq 'l') { } 0 14 14
elsif ($ch eq 's') { } 1 13 14
elsif ($ch eq 't') { } 2 11 13
elsif ($ch eq 'u') { } 1 10 11
elsif ($ch eq 'J') { } 7 3 10
elsif ($ch eq 'K') { } 3 0 3
95 148 $self->set_attributes( @args );
96 }
97 ▶ elsif ( $ch eq 'H' or $ch eq 'f' ) {
Condition66%2/3
$ch eq "H" or $ch eq "f"
l!l&&r!l&&!r
10024
MC/DC50%1/2
$ch eq "H" or $ch eq "f"
$ch eq "H" $ch eq "f"
Truth table66%2/3
A or B
A= $ch eq "H"B= $ch eq "f"
ABresult
1X1
011
000
98 10 $self->set_position( @args );
99 }
100 elsif ( $ch eq 'A' ) {
101 2 $self->move_up( @args );
102 }
103 elsif ( $ch eq 'B' ) {
104 2 $self->move_down( @args );
105 }
106 elsif ( $ch eq 'C' ) {
107 2 $self->move_right( @args );
108 }
109 elsif ( $ch eq 'D' ) {
110 2 $self->move_left( @args );
111 }
112 elsif ( $ch eq 'E' ) {
113 0 $self->move_down( @args );
114 0 $self->x( 0 );
115 }
116 elsif ( $ch eq 'F' ) {
117 1 $self->move_up( @args );
118 1 $self->x( 0 );
119 }
120 elsif ( $ch eq 'G' ) {
121 0 ▶ $self->x( ( $args[ 0 ] || 1 ) - 1 );
Condition0%0/2
$args[0] || 1
l!l
00
MC/DC0%0/1
$args[0] || 1
$args[0]
Truth table0%0/2
A
A= $args[0]
Aresult
11
00
122 }
123 elsif ( $ch eq 'h' ) {
124 1 $self->feature_on( $args[ 0 ] );
125 }
126 elsif ( $ch eq 'l' ) {
127 0 $self->feature_off( $args[ 0 ] );
128 }
129 elsif ( $ch eq 's' ) {
130 1 $self->save_position( @args );
131 }
132 elsif ( $ch eq 't' ) {
133 2 $self->rgb( @args );
134 }
135 elsif ( $ch eq 'u' ) {
136 1 $self->restore_position( @args );
137 }
138 elsif ( $ch eq 'J' ) {
139 7 $self->clear_screen( @args );
140 }
141 elsif ( $ch eq 'K' ) {
142 3 $self->clear_line( @args );
143 }
144  
145 182 $argbuf = '';
146 182 $self->state( $S_TXT );
147 }
148 else {
149 806 $argbuf .= $ch;
150 }
151 }
152 elsif ( $state == $S_END ) {
153 12 last;
154 }
155 else {
156 0 $self->state( $S_TXT );
157 }
158 }
159  
160 23 return $image;
161 }
162  
163 sub set_position {
164 10 ▶ my ( $self, $y, $x ) = @_;
Subroutine set_position: called CC=5 SCAR=16.2
Pod documented
165 10 ▶ $y = ( $y || 1 ) - 1;
Condition100%2/2
$y || 1
l!l
91
MC/DC100%1/1
$y || 1
$y
Truth table100%2/2
A
A= $y
Aresult
11
00
166 10 ▶ $x = ( $x || 1 ) - 1;
Condition100%2/2
$x || 1
l!l
91
MC/DC100%1/1
$x || 1
$x
Truth table100%2/2
A
A= $x
Aresult
11
00
167  
168 10 ▶ $y = 0 if $y < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $y < 0 0 10 10
169 10 ▶ $x = 0 if $x < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $x < 0 0 10 10
170  
171 10 $self->x( $x );
172 10 $self->y( $y );
173 }
174  
175 sub set_attributes {
176 148 ▶ my ( $self, @args ) = @_;
Subroutine set_attributes: called CC=14 SCAR=31.1
Pod documented
177  
178 148 my $attr = $self->attr;
179 148 my $rgba = $self->rgbattr;
180 148 my $pal = $self->image->palette->colors;
181  
182 148 foreach ( @args ) {
183 339 ▶ if ( $_ == 0 ) {
Branch: 8 branches
BranchTrueFalseTotal
if ($_ == 0) { } 80 259 339
elsif ($_ == 1) { } 27 232 259
elsif ($_ == 2 or $_ == 22) { } 0 232 232
elsif ($_ == 5) { } 23 209 232
elsif ($_ == 7 or $_ == 27) { } 0 209 209
elsif ($_ == 25) { } 0 209 209
elsif ($_ >= 30 and $_ <= 37) { } 115 94 209
elsif ($_ >= 40 and $_ <= 47) { } 94 0 94
184 80 $attr = 7;
185 80 $rgba->{ fg } = $pal->[ 7 ];
186 80 $rgba->{ bg } = $pal->[ 0 ];
187 }
188 elsif ( $_ == 1 ) {
189 27 $attr |= 8;
190 27 $rgba->{ fg } = $pal->[ ( $attr & 15 ) ];
191 }
192 ▶ elsif ( $_ == 2 || $_ == 22 ) {
Condition33%1/3
$_ == 2 or $_ == 22
l!l&&r!l&&!r
00232
MC/DC0%0/2
$_ == 2 or $_ == 22
$_ == 2 $_ == 22
Truth table33%1/3
A or B
A= $_ == 2B= $_ == 22
ABresult
1X1
011
000
193 0 $attr &= 247;
194 0 $rgba->{ fg } = $pal->[ ( $attr & 15 ) ];
195 }
196 elsif ( $_ == 5 ) {
197 23 $attr |= 128;
198 23 $rgba->{ bg } = $pal->[ ( $attr & 240 ) >> 4 ];
199 }
200 ▶ elsif ( $_ == 7 || $_ == 27 ) {
Condition33%1/3
$_ == 7 or $_ == 27
l!l&&r!l&&!r
00209
MC/DC0%0/2
$_ == 7 or $_ == 27
$_ == 7 $_ == 27
Truth table33%1/3
A or B
A= $_ == 7B= $_ == 27
ABresult
1X1
011
000
201 0 my $oldfg = $attr & 15;
202 0 my $oldbg = ( $attr & 240 ) >> 4;
203 0 $attr = $oldbg | ( $oldfg << 4 );
204
205 0 $rgba->{ fg } = $pal->[ ( $attr & 15 ) ];
206 0 $rgba->{ bg } = $pal->[ ( $attr & 240 ) >> 4 ];
207 }
208 elsif ( $_ == 25 ) {
209 0 $attr &= 127;
210 0 $rgba->{ bg } = $pal->[ ( $attr & 240 ) >> 4 ];
211 }
212 ▶ elsif ( $_ >= 30 and $_ <= 37 ) {
Condition66%2/3
$_ >= 30 and $_ <= 37
!ll&&!rl&&r
094115
MC/DC50%1/2
$_ >= 30 and $_ <= 37
$_ >= 30 $_ <= 37
Truth table66%2/3
A and B
A= $_ >= 30B= $_ <= 37
ABresult
0X0
100
111
213 115 $attr &= 248;
214 115 $attr |= ( $_ - 30 );
215 115 $rgba->{ fg } = $pal->[ ( $attr & 15 ) ];
216 }
217 ▶ elsif ( $_ >= 40 and $_ <= 47 ) {
Condition33%1/3
$_ >= 40 and $_ <= 47
!ll&&!rl&&r
0094
MC/DC0%0/2
$_ >= 40 and $_ <= 47
$_ >= 40 $_ <= 47
Truth table33%1/3
A and B
A= $_ >= 40B= $_ <= 47
ABresult
0X0
100
111
218 94 $attr &= 143;
219 94 $attr |= ( ( $_ - 40 ) << 4 );
220 94 $rgba->{ bg } = $pal->[ ( $attr & 240 ) >> 4 ];
221 }
222 }
223  
224 148 $self->attr( $attr );
225 }
226  
227 sub move_up {
228 3 ▶ my $self = shift;
Subroutine move_up: called CC=3 SCAR=11.0
Pod documented
229 3 ▶ my $y = $self->y - ( shift || 1 );
Condition100%2/2
shift() || 1
l!l
21
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
230 3 ▶ $y = 0 if $y < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $y < 0 0 3 3
231 3 $self->y( $y );
232 }
233  
234 sub move_down {
235 2 ▶ my $self = shift;
Subroutine move_down: called CC=2 SCAR=6.9
Pod documented
236 2 ▶ my $y = shift || 1;
Condition100%2/2
shift() || 1
l!l
11
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
237  
238 2 $self->y( $self->y + $y );
239 }
240  
241 sub move_right {
242 2 ▶ my $self = shift;
Subroutine move_right: called CC=2 SCAR=6.9
Pod documented
243 2 ▶ my $x = $self->x + ( shift || 1 );
Condition100%2/2
shift() || 1
l!l
11
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
244  
245 # check $x against $self->linewrap?
246  
247 2 $self->x( $x );
248 }
249  
250 sub move_left {
251 2 ▶ my $self = shift;
Subroutine move_left: called CC=3 SCAR=11.0
Pod documented
252 2 ▶ my $x = $self->x - ( shift || 1 );
Condition100%2/2
shift() || 1
l!l
11
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
253  
254 2 ▶ $x = 0 if $x < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $x < 0 0 2 2
255  
256 2 $self->x( $x );
257 }
258  
259 sub save_position {
260 1 ▶ my $self = shift;
Subroutine save_position: called CC=1 SCAR=0.0
Pod documented
261  
262 1 $self->save_x( $self->x );
263 1 $self->save_y( $self->y );
264 }
265  
266 sub restore_position {
267 1 ▶ my $self = shift;
Subroutine restore_position: called CC=1 SCAR=0.0
Pod documented
268  
269 1 $self->x( $self->save_x );
270 1 $self->y( $self->save_y );
271 }
272  
273 sub clear_line {
274 3 ▶ my $self = shift;
Subroutine clear_line: called CC=4 SCAR=13.9
Pod documented
275 3 my $arg = shift;
276  
277 3 ▶ if ( !$arg ) { # clear to end of line
Branch: 3 branches
BranchTrueFalseTotal
if (not $arg) { } 1 2 3
elsif ($arg == 1) { } 1 1 2
elsif ($arg == 2) { } 1 0 1
278 1 $self->image->clear_line( $self->y, [ $self->x, -1 ] );
279 }
280 elsif ( $arg == 1 ) { # clear to start of line
281 1 $self->image->clear_line( $self->y, [ 0, $self->x ] );
282 }
283 elsif ( $arg == 2 ) { #clear whole line
284 1 $self->image->clear_line( $self->y );
285 }
286 }
287  
288 sub clear_screen {
289 7 ▶ my $self = shift;
Subroutine clear_screen: called CC=6 SCAR=17.9
Pod documented
290 7 my $arg = shift;
291  
292 7 ▶ if( !$arg ) { # clear to end of screen, including cursor
Branch: 3 branches
BranchTrueFalseTotal
if (not $arg) { } 1 6 7
elsif ($arg == 1) { } 1 5 6
elsif ($arg == 2) { } 5 0 5
293 1 my $next = $self->y + 1;
294 1 $self->image->delete_line( $next ) for 1..$self->image->height - $next + 1;
295 1 $self->image->clear_line( $self->y, [ $self->x, -1 ] );
296 }
297 elsif( $arg == 1 ) { # clear to start of screen, including cursor
298 1 $self->image->clear_line( $_ ) for 0..$self->y - 1;
299 1 $self->image->clear_line( $self->y, [ 0, $self->x ] );
300 }
301 elsif( $arg == 2 ) { # clear whole screen
302 5 $self->image->clear_screen;
303 5 $self->x( 0 );
304 5 $self->y( 0 );
305 }
306 }
307  
308 sub rgb {
309 2 ▶ my $self = shift;
Subroutine rgb: called CC=2 SCAR=6.9
Pod documented
310 2 my $mode = shift;
311 2 my @rgb = @_;
312  
313 2 $self->image->render_options->{ truecolor } = 1;
314 2 $self->is_truecolor( 1 );
315  
316 2 ▶ $self->rgbattr->{ $mode == 0 ? 'bg' : 'fg' } = [ @rgb ];
Branch: 1 branch
BranchTrueFalseTotal
$mode == 0 ? : 1 1 2
317 }
318  
319 sub feature_on {
320 1 ▶ my $self = shift;
Subroutine feature_on: called CC=2 SCAR=7.0
Pod documented
321 1 my $arg = shift;
322  
323 1 ▶ if( $arg eq '?33' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg eq "?33") 1 0 1
324 1 $self->image->render_options->{ blink_mode } = 0;
325 }
326 }
327  
328 sub feature_off {
329 0 ▶ my $self = shift;
Subroutine feature_off: not called CC=2 SCAR=17.9
Pod documented
330 0 my $arg = shift;
331  
332 0 ▶ if( $arg eq '?33' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg eq "?33") 0 0 0
333 0 $self->image->render_options->{ blink_mode } = 1;
334 }
335 }
336  
337 sub new_line {
338 13020 ▶ my $self = shift;
Subroutine new_line: called CC=1 SCAR=0.0
Pod documented
339  
340 13020 $self->y( $self->y + 1 );
341 13020 $self->x( 0 );
342 }
343  
344 sub tab {
345 2 ▶ my $self = shift;
Subroutine tab: called CC=3 SCAR=11.0
Pod documented
346 2 my $count = ( $self->x + 1 ) % $self->tabstop;
347 2 ▶ if ( $count ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count) 2 0 2
348 2 $count = $self->tabstop - $count;
349 2 for ( 1 .. $count ) {
350 14 $self->store( ' ' );
351 }
352 }
353 }
354  
355 sub store {
356 239 ▶ my $self = shift;
Subroutine store: called CC=7 SCAR=19.8
Pod documented
357 239 my $char = shift;
358 239 my $x = shift;
359 239 my $y = shift;
360 239 my $attr = shift;
361  
362 239 my $pal = $self->image->palette->colors;
363  
364 239 ▶ my %colors = ( attr => defined $attr ? $attr : $self->attr );
Branch: 1 branch
BranchTrueFalseTotal
defined $attr ? : 0 239 239
365 239 ▶ if( $self->is_truecolor ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_truecolor) 3 236 239
366 3 delete $colors{ attr };
367 3 ▶ $attr = defined $attr ? $attr : $self->rgbattr;
Branch: 1 branch
BranchTrueFalseTotal
defined $attr ? : 0 3 3
368 3 push @{ $pal }, $attr->{ fg };
369 3 $colors{ fg } = scalar @{ $pal } - 1;
370 3 push @{ $pal }, $attr->{ bg };
371 3 $colors{ bg } = scalar @{ $pal } - 1;
372 }
373  
374 239 ▶ if ( defined $x and defined $y ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $x and defined $y) { } 0 239 239
Condition33%1/3
defined $x and defined $y
!ll&&!rl&&r
23900
MC/DC0%0/2
defined $x and defined $y
defined $x defined $y
Truth table33%1/3
A and B
A= defined $xB= defined $y
ABresult
0X0
100
111
375 0 $self->image->putpixel( { char => $char, %colors }, $x, $y );
376 }
377 else {
378 239 $self->image->putpixel( { char => $char, %colors },
379 $self->x, $self->y );
380 239 $self->x( $self->x + 1 );
381 }
382  
383 239 ▶ if ( $self->x >= $self->linewrap ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->x >= $self->linewrap) 2 237 239
384 2 $self->new_line;
385 }
386 }
387  
388 =head1 NAME
389  
390 Image::TextMode::Reader::ANSI - Reads ANSI files
391  
392 =head1 DESCRIPTION
393  
394 Provides reading capabilities for the ANSI format.
395  
396 =head1 ACCESSORS
397  
398 =over 4
399  
400 =item * tabstop - every Nth character will be a tab stop location (default: 8)
401  
402 =item * save_x - saved x position (default: 0)
403  
404 =item * save_y - saved y position (default: 0)
405  
406 =item * x - current x (default: 0)
407  
408 =item * y - current y (default: 0)
409  
410 =item * attr - current attribute info (default: 7, gray on black)
411  
412 =item * state - state of the parser (default: C<$S_TXT>)
413  
414 =item * image - the image we're parsing into
415  
416 =item * linewrap - max width before we wrap to the next line (default: 80)
417  
418 =back
419  
420 =head1 METHODS
421  
422 =head2 set_position( [$x, $y] )
423  
424 Moves the cursor to C<$x, $y>.
425  
426 =head2 set_attributes( @args )
427  
428 Sets the default attribute information (fg and bg).
429  
430 =head2 move_up( $y )
431  
432 Moves the cursor up C<$y> lines.
433  
434 =head2 move_down( $y )
435  
436 Moves the cursor down C<$y> lines.
437  
438 =head2 move_left( $x )
439  
440 Moves the cursor left C<$x> columns.
441  
442 =head2 move_right( $x )
443  
444 Moves the cursor right C<$x> columns.
445  
446 =head2 save_position( )
447  
448 Saves the current cursor position.
449  
450 =head2 restore_position( )
451  
452 Restores the saved cursor position.
453  
454 =head2 clear_screen( )
455  
456 Clears all data on the canvas.
457  
458 =head2 clear_line( $y )
459  
460 Clears the line at C<$y>.
461  
462 =head2 rgb( $mode, $r, $g, $b )
463  
464 Set the attribute to RGB color. Also, sets image to true-color mode.
465  
466 =head2 feature_on( $code )
467  
468 Enables a feature.
469  
470 =head2 feature_off( $code )
471  
472 Disables a feature.
473  
474 =head2 new_line( )
475  
476 Simulates a C<\n> character.
477  
478 =head2 tab( )
479  
480 Simulates a C<\t> character.
481  
482 =head2 store( $char, $x, $y [, $attr] )
483  
484 Stores C<$char> at position C<$x, $y> with either the supplied attribute
485 or the current attribute setting.
486  
487 =head1 AUTHOR
488  
489 Brian Cassidy E<lt>bricas@cpan.orgE<gt>
490  
491 =head1 COPYRIGHT AND LICENSE
492  
493 Copyright 2008-2014 by Brian Cassidy
494  
495 This library is free software; you can redistribute it and/or modify
496 it under the same terms as Perl itself.
497  
498 =cut
499  
500 8 1;
« TextMode/Renderer/GD.pm ↑ Summary TextMode/Loader.pm »