| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# linear standard (S)RGB, RGB with removed gamma |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Graphics::Toolkit::Color::Space::Instance::RGBLinear; |
|
5
|
15
|
|
|
15
|
|
319628
|
use v5.12; |
|
|
15
|
|
|
|
|
55
|
|
|
6
|
15
|
|
|
15
|
|
105
|
use warnings; |
|
|
15
|
|
|
|
|
27
|
|
|
|
15
|
|
|
|
|
1154
|
|
|
7
|
15
|
|
|
15
|
|
756
|
use Graphics::Toolkit::Color::Space qw/gamma_correct/; |
|
|
15
|
|
|
|
|
31
|
|
|
|
15
|
|
|
|
|
4813
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $gamma = 2.4; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub from_rgb { |
|
12
|
30
|
|
|
30
|
0
|
57
|
my ($rgb) = shift; |
|
13
|
30
|
100
|
|
|
|
61
|
return [ map { (abs($_) > 0.04045) ? gamma_correct((($_ + 0.055) / 1.055 ), $gamma) |
|
|
90
|
|
|
|
|
278
|
|
|
14
|
|
|
|
|
|
|
: ($_ / 12.92) } @$rgb ]; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
sub to_rgb { |
|
17
|
30
|
|
|
30
|
0
|
52
|
my ($lrgb) = shift; |
|
18
|
30
|
100
|
|
|
|
61
|
return [ map { (abs($_) > 0.0031308) ? ((gamma_correct($_, 1/$gamma) * 1.055) - 0.055) |
|
|
90
|
|
|
|
|
240
|
|
|
19
|
|
|
|
|
|
|
: ($_ * 12.92) } @$lrgb ]; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Graphics::Toolkit::Color::Space->new( |
|
23
|
|
|
|
|
|
|
name => 'LinearRGB', |
|
24
|
|
|
|
|
|
|
alias => 'linRGB', |
|
25
|
|
|
|
|
|
|
axis => [qw/red green blue/], |
|
26
|
|
|
|
|
|
|
precision => 6, |
|
27
|
|
|
|
|
|
|
convert => {RGB => [\&to_rgb, \&from_rgb]}, |
|
28
|
|
|
|
|
|
|
); |