line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
686
|
use v5.12; |
|
8
|
|
|
|
|
27
|
|
2
|
8
|
|
|
8
|
|
41
|
use warnings; |
|
8
|
|
|
|
|
43
|
|
|
8
|
|
|
|
|
318
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# CMYK color space specific code |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Graphics::Toolkit::Color::Space::Instance::CMYK; |
7
|
8
|
|
|
8
|
|
461
|
use Graphics::Toolkit::Color::Space; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
241
|
|
8
|
8
|
|
|
8
|
|
76
|
use Graphics::Toolkit::Color::Space::Util ':all'; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
2438
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $cmyk_def = Graphics::Toolkit::Color::Space->new( axis => [qw/cyan magenta yellow key/] ); |
11
|
|
|
|
|
|
|
$cmyk_def->add_converter('RGB', \&to_rgb, \&from_rgb ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub from_rgb { |
14
|
6
|
|
|
6
|
0
|
16
|
my ($r, $g, $b) = @_; |
15
|
6
|
50
|
|
|
|
33
|
return unless defined $b; |
16
|
6
|
|
|
|
|
40
|
my $km = max($r, $g, $b); |
17
|
6
|
50
|
|
|
|
19
|
return (0,0,0,1) unless $km; # prevent / 0 |
18
|
6
|
|
|
|
|
35
|
return ( ($km - $r) / $km, |
19
|
|
|
|
|
|
|
($km - $g) / $km, |
20
|
|
|
|
|
|
|
($km - $b) / $km, |
21
|
|
|
|
|
|
|
1 - $km |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub to_rgb { |
26
|
3
|
|
|
3
|
0
|
9
|
my ($c, $m, $y, $k) = @_; |
27
|
3
|
|
|
|
|
26
|
return ( (1-$c) * (1-$k) , |
28
|
|
|
|
|
|
|
(1-$m) * (1-$k) , |
29
|
|
|
|
|
|
|
(1-$y) * (1-$k) , |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$cmyk_def; |