| 1 | |||||||||||
| 2 | # Rec.709 illuminant D65, 2° standard observer | ||||||||||
| 3 | |||||||||||
| 4 | package Graphics::Toolkit::Color::Space::Instance::Rec709; | ||||||||||
| 5 | 16 | ▶ | use v5.12; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 16 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 16 | ▶ | use Graphics::Toolkit::Color::Space qw/spow/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 4 | ▶ | sub from_lrgb { | ||||||||
|
Subroutine
from_lrgb: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 10 | 4 | my $lrgb = shift; | |||||||||
| 11 | 4 | ▶ | return [ map {(abs($_) < 0.018) ? ($_ * 4.5) : ((spow($_, 0.45) * 1.099) - 0.099)} @$lrgb]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | } | ||||||||||
| 13 | 4 | ▶ | sub to_lrgb { | ||||||||
|
Subroutine
to_lrgb: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 14 | 4 | my $rgb = shift; | |||||||||
| 15 | 4 | ▶ | return [ map {(abs($_) < 0.081) ? ($_ / 4.5) : spow(($_ + 0.099) / 1.099, 1 / 0.45)} @$rgb]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | |||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 16 | Graphics::Toolkit::Color::Space->new( | |||||||||
| 20 | name => 'Rec.709', | ||||||||||
| 21 | alias_name => 'BT.709', | ||||||||||
| 22 | family => 'RGB', | ||||||||||
| 23 | axis => [qw/red green blue/], | ||||||||||
| 24 | precision => 6, | ||||||||||
| 25 | convert => {LinearRGB => [\&to_lrgb, \&from_lrgb]}, | ||||||||||
| 26 | ); | ||||||||||