| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Graphics::Color::CMYK; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
1
|
|
|
1
|
|
20983
|
$Graphics::Color::CMYK::VERSION = '0.29'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
1
|
|
|
1
|
|
455
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use MooseX::Aliases; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends qw(Graphics::Color); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: CMYK color model |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Graphics::Color::Types qw(Number360OrLess NumberOneOrLess); |
|
13
|
|
|
|
|
|
|
use Graphics::Color::RGB; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'cyan' => ( |
|
17
|
|
|
|
|
|
|
is => 'rw', |
|
18
|
|
|
|
|
|
|
isa => NumberOneOrLess, |
|
19
|
|
|
|
|
|
|
default => 1, |
|
20
|
|
|
|
|
|
|
alias => 'c' |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'magenta' => ( |
|
25
|
|
|
|
|
|
|
is => 'rw', |
|
26
|
|
|
|
|
|
|
isa => NumberOneOrLess, |
|
27
|
|
|
|
|
|
|
default => 1, |
|
28
|
|
|
|
|
|
|
alias => 'm' |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'yellow' => ( |
|
33
|
|
|
|
|
|
|
is => 'rw', |
|
34
|
|
|
|
|
|
|
isa => NumberOneOrLess, |
|
35
|
|
|
|
|
|
|
default => 1, |
|
36
|
|
|
|
|
|
|
alias => 'y' |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has 'key' => ( |
|
41
|
|
|
|
|
|
|
is => 'rw', |
|
42
|
|
|
|
|
|
|
isa => NumberOneOrLess, |
|
43
|
|
|
|
|
|
|
default => 1, |
|
44
|
|
|
|
|
|
|
alias => 'k' |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has 'name' => ( is => 'rw', isa => 'Str' ); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub as_string { |
|
52
|
|
|
|
|
|
|
my ($self) = @_; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return sprintf('%0.2f,%0.2f,%0.2f,%0.2f', |
|
55
|
|
|
|
|
|
|
$self->cyan, $self->magenta, $self->yellow, $self->key |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub as_percent_string { |
|
61
|
|
|
|
|
|
|
my ($self) = @_; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return sprintf("%d%%, %d%%, %d%%, %d%%", |
|
64
|
|
|
|
|
|
|
$self->cyan * 100, $self->magenta * 100, $self->yellow * 100, |
|
65
|
|
|
|
|
|
|
$self->key * 100 |
|
66
|
|
|
|
|
|
|
); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub as_array { |
|
71
|
|
|
|
|
|
|
my ($self) = @_; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return ($self->cyan, $self->magenta, $self->yellow, $self->key); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub equal_to { |
|
78
|
|
|
|
|
|
|
my ($self, $other) = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
return 0 unless defined($other); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
unless($self->cyan == $other->cyan) { |
|
83
|
|
|
|
|
|
|
return 0; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
unless($self->magenta == $other->magenta) { |
|
86
|
|
|
|
|
|
|
return 0; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
unless($self->yellow == $other->yellow) { |
|
89
|
|
|
|
|
|
|
return 0; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
|
|
|
|
|
|
unless($self->key == $other->key) { |
|
92
|
|
|
|
|
|
|
return 0; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
return 1; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
no Moose; |
|
101
|
|
|
|
|
|
|
1; |
|
102
|
|
|
|
|
|
|
__END__ |
|
103
|
|
|
|
|
|
|
=pod |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Graphics::Color::CMYK - CMYK color model |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 VERSION |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
version 0.29 |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
use Graphics::Color::CMYK; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
my $color = Graphics::Color::CMYK->new({ |
|
118
|
|
|
|
|
|
|
cyan => 120, |
|
119
|
|
|
|
|
|
|
magenta => .5, |
|
120
|
|
|
|
|
|
|
yellow => .25, |
|
121
|
|
|
|
|
|
|
key => .5 |
|
122
|
|
|
|
|
|
|
}); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Graphics::Color::CMYK represents a Color in CMYK color model. Cyan stands for |
|
127
|
|
|
|
|
|
|
B<Cyan> B<Magenta> B<Yellow> B<Key> (or black). |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 cyan |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 c |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Set/Get the cyan component of this Color. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 magenta |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 m |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Set/Get the magenta component of this Color. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 yellow |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 y |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Set/Get the yellow component of this Color. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 key |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 k |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Set/Get the key (black) component of this Color. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 name |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Get the name of this color. Only valid if the color was created by name. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 METHODS |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 as_string |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Get a string version of this Color in the form of: |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
CYAN,MAGENTA,YELLOW,KEY |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 as_percent_string |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Return a percent formatted value for this color. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 as_array |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Get the CMYK values as an array |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 equal_to |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Compares this color to the provided one. Returns 1 if true, else 0; |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 not_equal_to |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
The opposite of C<equal_to>. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 AUTHOR |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Cory G Watson <gphat@cpan.org> |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Cold Hard Code, LLC. |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
192
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
|
195
|
|
|
|
|
|
|
|