| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# Display P3, D65 same transfer function as SRGB |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Graphics::Toolkit::Color::Space::Instance::DisplayP3; |
|
5
|
15
|
|
|
15
|
|
291425
|
use v5.12; |
|
|
15
|
|
|
|
|
57
|
|
|
6
|
15
|
|
|
15
|
|
100
|
use warnings; |
|
|
15
|
|
|
|
|
23
|
|
|
|
15
|
|
|
|
|
924
|
|
|
7
|
15
|
|
|
15
|
|
528
|
use Graphics::Toolkit::Color::Space qw/gamma_correct/; |
|
|
15
|
|
|
|
|
26
|
|
|
|
15
|
|
|
|
|
4691
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $gamma = 2.4; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub from_dp3l { |
|
12
|
4
|
|
|
4
|
0
|
7
|
my ($lrgb) = shift; |
|
13
|
4
|
100
|
|
|
|
8
|
return [ map { (abs($_) > 0.0031308) ? ( (gamma_correct($_, 1/$gamma) * 1.055) - 0.055) |
|
|
12
|
|
|
|
|
34
|
|
|
14
|
|
|
|
|
|
|
: ($_ * 12.92) } @$lrgb ]; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
sub to_dp3l { |
|
17
|
4
|
|
|
4
|
0
|
6
|
my ($rgb) = shift; |
|
18
|
4
|
100
|
|
|
|
8
|
return [ map { (abs($_) > 0.04045) ? gamma_correct((($_ + 0.055) / 1.055 ), $gamma) |
|
|
12
|
|
|
|
|
29
|
|
|
19
|
|
|
|
|
|
|
: ($_ / 12.92) } @$rgb ]; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Graphics::Toolkit::Color::Space->new( |
|
23
|
|
|
|
|
|
|
name => 'display-p3', |
|
24
|
|
|
|
|
|
|
alias => 'P3', |
|
25
|
|
|
|
|
|
|
axis => [qw/red green blue/], |
|
26
|
|
|
|
|
|
|
precision => 6, |
|
27
|
|
|
|
|
|
|
convert => {'Display-P3-Linear' => [\&to_dp3l, \&from_dp3l]}, |
|
28
|
|
|
|
|
|
|
); |