line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Graphics::Color::YIQ; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
36494
|
$Graphics::Color::YIQ::VERSION = '0.29'; |
4
|
|
|
|
|
|
|
} |
5
|
1
|
|
|
1
|
|
412
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use MooseX::Aliases; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends qw(Graphics::Color); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: YIQ color space |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'luminance' => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
isa => 'Num', |
16
|
|
|
|
|
|
|
default => 1, |
17
|
|
|
|
|
|
|
alias => 'y' |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has 'in_phase' => ( |
22
|
|
|
|
|
|
|
is => 'rw', |
23
|
|
|
|
|
|
|
isa => 'Num', |
24
|
|
|
|
|
|
|
default => 1, |
25
|
|
|
|
|
|
|
alias => 'i' |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'quadrature' => ( |
30
|
|
|
|
|
|
|
is => 'rw', |
31
|
|
|
|
|
|
|
isa => 'Num', |
32
|
|
|
|
|
|
|
default => 1, |
33
|
|
|
|
|
|
|
alias => 'q' |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has 'name' => ( is => 'rw', isa => 'Str' ); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub as_string { |
41
|
|
|
|
|
|
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
return sprintf('%s,%s,%s', |
44
|
|
|
|
|
|
|
$self->luminance, $self->in_phase, $self->quadrature |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub as_array { |
50
|
|
|
|
|
|
|
my ($self) = @_; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return ($self->luminance, $self->in_phase, $self->quadrature); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub equal_to { |
57
|
|
|
|
|
|
|
my ($self, $other) = @_; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return 0 unless defined($other); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
unless($self->luminance == $other->luminance) { |
62
|
|
|
|
|
|
|
return 0; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
unless($self->in_phase == $other->in_phase) { |
65
|
|
|
|
|
|
|
return 0; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
unless($self->quadrature == $other->quadrature) { |
68
|
|
|
|
|
|
|
return 0; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
return 1; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
76
|
|
|
|
|
|
|
no Moose; |
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |
79
|
|
|
|
|
|
|
=pod |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 NAME |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Graphics::Color::YIQ - YIQ color space |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 VERSION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
version 0.29 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
use Graphics::Color::YIQ; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $color = Graphics::Color::YIQ->new({ |
94
|
|
|
|
|
|
|
luminance => 0.5, |
95
|
|
|
|
|
|
|
in_phase => .5, |
96
|
|
|
|
|
|
|
quadrature => .25, |
97
|
|
|
|
|
|
|
}); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 DESCRIPTION |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Graphics::Color::YIQ represents a Color in an YIQ color space. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DISCLAIMER |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
I couldn't find clear information on the bounds of each value, so at the |
106
|
|
|
|
|
|
|
moment there are none. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 luminance |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 y |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Set/Get the luminance component of this Color. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 in_phase |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 i |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Set/Get the in_phase component of this Color. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 quadrature |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 q |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Set/Get the quadrature component of this Color. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 name |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Get the name of this color. Only valid if the color was created by name. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 not_equal_to |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The opposite of equal_to. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 METHODS |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 as_string |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Get a string version of this Color in the form of |
141
|
|
|
|
|
|
|
LUMINANCE,IN-PHASE,QUADRATURE |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 as_array |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Get the YIQ values as an array |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 equal_to |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Compares this color to the provided one. Returns 1 if true, else 0; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 AUTHOR |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Cory G Watson <gphat@cpan.org> |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Cold Hard Code, LLC. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
160
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |
163
|
|
|
|
|
|
|
|