Color/Space/Instance/RGBLinear.pm

filter: Statementstmt 100% 16 / 16 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 92.5% 25 / 27 CC 3 SCAR 4.5
CC
3
Cov
100%
from_lrgb
2.0
to_lrgb
2.0
BEGIN
1.0
CRAP 1.6
« Color/Space/Instance/DisplayP3.pm ↑ Summary Color/Space/Instance/AdobeRGB.pm »
1  
2 # linear standard (S)RGB, RGB with removed gamma
3  
4 package Graphics::Toolkit::Color::Space::Instance::RGBLinear;
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 16 my $gamma = 2.4;
10  
11 90 ▶sub from_lrgb {
Subroutine from_lrgb: called CC=2 SCAR=6.9
Pod undocumented
12 90 my ($lrgb) = shift;
13 90 ▶ return [ map { (abs($_) > 0.0031308) ? ((spow($_, 1/$gamma) * 1.055) - 0.055)
Branch: 1 branch
BranchTrueFalseTotal
abs $_ > 0.0031308 ? : 178 92 270
14 : ($_ * 12.92) } @$lrgb ];
15 }
16 140 ▶sub to_lrgb {
Subroutine to_lrgb: called CC=2 SCAR=6.9
Pod undocumented
17 140 my ($rgb) = shift;
18 140 ▶ return [ map { (abs($_) > 0.04045) ? spow((($_ + 0.055) / 1.055 ), $gamma)
Branch: 1 branch
BranchTrueFalseTotal
abs $_ > 0.04045 ? : 214 206 420
19 : ($_ / 12.92) } @$rgb ];
20 }
21  
22 16 Graphics::Toolkit::Color::Space->new(
23 name => 'LinearRGB',
24 alias_name => 'linRGB',
25 family => 'RGB',
26 axis => [qw/red green blue/],
27 precision => 6,
28 convert => {RGB => [\&from_lrgb, \&to_lrgb]},
29 );
« Color/Space/Instance/DisplayP3.pm ↑ Summary Color/Space/Instance/AdobeRGB.pm »