File Coverage

lib/Graphics/Toolkit/Color/Space/Instance/CIERGB.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 17 19 89.4


line stmt bran cond sub pod time code
1              
2             # CIE 1931 RGB (linear with illuminant E)
3              
4             package Graphics::Toolkit::Color::Space::Instance::CIERGB;
5 16     16   284305 use v5.12;
  16         48  
6 16     16   57 use warnings;
  16         22  
  16         778  
7 16     16   501 use Graphics::Toolkit::Color::Space qw/mult_matrix_vector_3/;
  16         33  
  16         3003  
8              
9             sub from_rgb {
10             [ mult_matrix_vector_3( [[ 0.4887180, 0.3106803, 0.2006017 ],
11             [ 0.1762044, 0.8129847, 0.0108109 ],
12 3     3 0 7 [ 0.0000000, 0.0102048, 0.9897952 ] ], @{$_[0]}) ];
  3         7  
13             }
14             sub to_rgb {
15             [ mult_matrix_vector_3( [[ 2.3706743, -0.9000405, -0.4706338 ],
16             [ -0.5138850, 1.4253036, 0.0885814 ],
17 3     3 0 8 [ 0.0052982, -0.0146949, 1.0093968 ] ], @{$_[0]}) ];
  3         8  
18             }
19              
20             Graphics::Toolkit::Color::Space->new(
21             name => 'CIERGB',
22             family => 'RGB',
23             axis => [qw/red green blue/],
24             precision => 6,
25             convert => {XYZ => [\&from_rgb, \&to_rgb]},
26             );