SWF/Type/RGB.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 42 CC 3 SCAR 13.3
CC
3
Cov
0%
build
6.0
string
6.0
parse
2.0
CRAP 3.8
1 package IO::SWF::Type::RGB;
2  
3 use strict;
4 use warnings;
5  
6 use base 'IO::SWF::Type';
7  
8 use IO::SWF::Bit;
9  
10 sub parse {
11 my ($reader, $opts_href) = @_;
12 my %rgb = ();
13 $rgb{'Red'} = $reader->getUI8();
14 $rgb{'Green'} = $reader->getUI8();
15 $rgb{'Blue'} = $reader->getUI8();
16 return \%rgb;
17 }
18  
19 sub build {
20 my ($writer, $rgb_href, $opts_href) = @_;
21 my %rgb = ref($rgb_href) ? %{$rgb_href} : ();
22 $writer->putUI8($rgb{'Red'});
23 $writer->putUI8($rgb{'Green'});
24 $writer->putUI8($rgb{'Blue'});
25 }
26  
27 sub string {
28 my ($color_href, $opts_href) = @_;
29 my %color = ref($color_href) ? %{$color_href} : ();
30 return sprintf("#%02x%02x%02x", $color{'Red'}, $color{'Green'}, $color{'Blue'});
31 }
32  
33 1;