line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
8
|
|
|
8
|
|
710
|
use v5.12; |
|
8
|
|
|
|
|
26
|
|
2
|
8
|
|
|
8
|
|
41
|
use warnings; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
411
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# CMYK color space specific code |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Graphics::Toolkit::Color::Space::Instance::CMYK; |
7
|
8
|
|
|
8
|
|
478
|
use Graphics::Toolkit::Color::Space; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
369
|
|
8
|
8
|
|
|
8
|
|
66
|
use Graphics::Toolkit::Color::Space::Util ':all'; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
2619
|
|
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
|
17
|
my ($r, $g, $b) = @_; |
15
|
6
|
50
|
|
|
|
28
|
return unless defined $b; |
16
|
6
|
|
|
|
|
48
|
my $km = max($r, $g, $b); |
17
|
6
|
50
|
|
|
|
22
|
return (0,0,0,1) unless $km; # prevent / 0 |
18
|
6
|
|
|
|
|
40
|
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
|
8
|
my ($c, $m, $y, $k) = @_; |
27
|
3
|
|
|
|
|
37
|
return ( (1-$c) * (1-$k) , |
28
|
|
|
|
|
|
|
(1-$m) * (1-$k) , |
29
|
|
|
|
|
|
|
(1-$y) * (1-$k) , |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$cmyk_def; |