| 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
|
16
|
|
|
16
|
|
262210
|
use v5.12; |
|
|
16
|
|
|
|
|
48
|
|
|
6
|
16
|
|
|
16
|
|
80
|
use warnings; |
|
|
16
|
|
|
|
|
18
|
|
|
|
16
|
|
|
|
|
783
|
|
|
7
|
16
|
|
|
16
|
|
423
|
use Graphics::Toolkit::Color::Space qw/spow/; |
|
|
16
|
|
|
|
|
25
|
|
|
|
16
|
|
|
|
|
3724
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $gamma = 2.4; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub from_p3 { |
|
12
|
4
|
|
|
4
|
0
|
6
|
my ($rgb) = shift; |
|
13
|
4
|
100
|
|
|
|
7
|
return [ map { (abs($_) > 0.04045) ? spow((($_ + 0.055) / 1.055 ), $gamma) |
|
|
12
|
|
|
|
|
34
|
|
|
14
|
|
|
|
|
|
|
: ($_ / 12.92) } @$rgb ]; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
sub to_p3 { |
|
17
|
4
|
|
|
4
|
0
|
6
|
my ($lrgb) = shift; |
|
18
|
4
|
100
|
|
|
|
8
|
return [ map { (abs($_) > 0.0031308) ? ( (spow($_, 1/$gamma) * 1.055) - 0.055) |
|
|
12
|
|
|
|
|
38
|
|
|
19
|
|
|
|
|
|
|
: ($_ * 12.92) } @$lrgb ]; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Graphics::Toolkit::Color::Space->new( |
|
23
|
|
|
|
|
|
|
name => 'display-p3', |
|
24
|
|
|
|
|
|
|
alias_name => 'P3', |
|
25
|
|
|
|
|
|
|
family => 'RGB', |
|
26
|
|
|
|
|
|
|
axis => [qw/red green blue/], |
|
27
|
|
|
|
|
|
|
precision => 6, |
|
28
|
|
|
|
|
|
|
convert => {'Display-P3-Linear' => [\&from_p3, \&to_p3]}, |
|
29
|
|
|
|
|
|
|
); |