line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Convert::Color::HUSLp; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
484
|
use 5.008009; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
4
|
use parent qw/Convert::Color::HUSL/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
84
|
use Convert::Color::XYZ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
9
|
1
|
|
|
1
|
|
3
|
use Convert::Color::LUV; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
10
|
1
|
|
|
1
|
|
5
|
use Convert::Color::LCh; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
11
|
1
|
|
|
1
|
|
4
|
use List::Util qw/min/; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
49
|
|
12
|
1
|
|
|
1
|
|
4
|
use Math::Trig qw/:pi/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
101
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
BEGIN { |
15
|
1
|
|
|
1
|
|
161
|
*_get_bounds = *Convert::Color::HUSL::_get_bounds; ## no critic (ProtectPrivate) |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__PACKAGE__->register_color_space('huslp'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _intersect_line_line { |
23
|
24564
|
|
|
24564
|
|
19642
|
my ($l1, $l2) = @_; |
24
|
24564
|
|
|
|
|
42571
|
($l1->[1] - $l2->[1]) / ($l2->[0] - $l1->[0]) |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _distance_from_pole { |
28
|
24564
|
|
|
24564
|
|
18641
|
my ($x, $y) = @_; |
29
|
24564
|
|
|
|
|
42251
|
sqrt $x * $x + $y * $y |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub max_chroma_for_lh { |
33
|
4094
|
|
|
4094
|
0
|
4272
|
my ($self, $l) = @_; |
34
|
24564
|
|
|
|
|
21843
|
min map { |
35
|
4094
|
|
|
|
|
7575
|
my ($m, $n) = @$_; |
36
|
24564
|
|
|
|
|
36020
|
my $x = _intersect_line_line $_, [-1 / $m, 0]; |
37
|
24564
|
|
|
|
|
35060
|
_distance_from_pole $x, $n + $x * $m |
38
|
|
|
|
|
|
|
} _get_bounds $l |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |