line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Graphics::Color::YIQ; |
2
|
|
|
|
|
|
|
$Graphics::Color::YIQ::VERSION = '0.30'; |
3
|
1
|
|
|
1
|
|
23991
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use MooseX::Aliases; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
extends qw(Graphics::Color); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: YIQ color space |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'luminance' => ( |
12
|
|
|
|
|
|
|
is => 'rw', |
13
|
|
|
|
|
|
|
isa => 'Num', |
14
|
|
|
|
|
|
|
default => 1, |
15
|
|
|
|
|
|
|
alias => 'y' |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has 'in_phase' => ( |
20
|
|
|
|
|
|
|
is => 'rw', |
21
|
|
|
|
|
|
|
isa => 'Num', |
22
|
|
|
|
|
|
|
default => 1, |
23
|
|
|
|
|
|
|
alias => 'i' |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has 'quadrature' => ( |
28
|
|
|
|
|
|
|
is => 'rw', |
29
|
|
|
|
|
|
|
isa => 'Num', |
30
|
|
|
|
|
|
|
default => 1, |
31
|
|
|
|
|
|
|
alias => 'q' |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has 'name' => ( is => 'rw', isa => 'Str' ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub as_string { |
39
|
|
|
|
|
|
|
my ($self) = @_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return sprintf('%s,%s,%s', |
42
|
|
|
|
|
|
|
$self->luminance, $self->in_phase, $self->quadrature |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub as_array { |
48
|
|
|
|
|
|
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return ($self->luminance, $self->in_phase, $self->quadrature); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub equal_to { |
55
|
|
|
|
|
|
|
my ($self, $other) = @_; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
return 0 unless defined($other); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
unless($self->luminance == $other->luminance) { |
60
|
|
|
|
|
|
|
return 0; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
unless($self->in_phase == $other->in_phase) { |
63
|
|
|
|
|
|
|
return 0; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
unless($self->quadrature == $other->quadrature) { |
66
|
|
|
|
|
|
|
return 0; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return 1; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
74
|
|
|
|
|
|
|
no Moose; |
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=pod |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 NAME |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Graphics::Color::YIQ - YIQ color space |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 VERSION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
version 0.30 |
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) 2014 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 |