Color/YIQ.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 3 / 3 totaltotal 89.3% 42 / 47 CC 5 SCAR 12.0
CC
5
Cov
87%
equal_to
5.6
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« Color/HSL.pm ↑ Summary Color/YUV.pm »
1 package Graphics::Color::YIQ;
2 1 $Graphics::Color::YIQ::VERSION = '0.31';
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use MooseX::Aliases;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 extends qw(Graphics::Color);
7  
8 # ABSTRACT: YIQ color space
9  
10  
11 1 has 'luminance' => (
12 is => 'rw',
13 isa => 'Num',
14 default => 1,
15 alias => 'y'
16 );
17  
18  
19 1 has 'in_phase' => (
20 is => 'rw',
21 isa => 'Num',
22 default => 1,
23 alias => 'i'
24 );
25  
26  
27 1 has 'quadrature' => (
28 is => 'rw',
29 isa => 'Num',
30 default => 1,
31 alias => 'q'
32 );
33  
34  
35 1 has 'name' => ( is => 'rw', isa => 'Str' );
36  
37  
38 1 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
39 1 my ($self) = @_;
40  
41 1 return sprintf('%s,%s,%s',
42 $self->luminance, $self->in_phase, $self->quadrature
43 );
44 }
45  
46  
47 1 ▶sub as_array {
Subroutine as_array: called CC=1 SCAR=0.0
Pod documented
48 1 my ($self) = @_;
49  
50 1 return ($self->luminance, $self->in_phase, $self->quadrature);
51 }
52  
53  
54 2 ▶sub equal_to {
Subroutine equal_to: called CC=5 SCAR=17.3
Pod documented
55 2 my ($self, $other) = @_;
56  
57 2 ▶ return 0 unless defined($other);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $other 0 2 2
58  
59 2 ▶ unless($self->luminance == $other->luminance) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->luminance == $other->luminance) 0 2 2
60 0 return 0;
61 }
62 2 ▶ unless($self->in_phase == $other->in_phase) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->in_phase == $other->in_phase) 1 1 2
63 1 return 0;
64 }
65 1 ▶ unless($self->quadrature == $other->quadrature) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->quadrature == $other->quadrature) 0 1 1
66 0 return 0;
67 }
68  
69 1 return 1;
70 }
71  
72  
73 1 __PACKAGE__->meta->make_immutable;
74 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
75 1 1;
76  
77 __END__
« Color/HSL.pm ↑ Summary Color/YUV.pm »