X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FConvert%2FColor%2FLCh.pm;h=e12fdc44e98d98b9f5e0400d8306a9a987176ac7;hb=e74bc37c7da43559d7298d1aadf2ddae360263b5;hp=83cf1bf6fa0945ec1fb50385cd05c08b279821cd;hpb=1f72b051c754be821a14b94b1828d71e40631de3;p=convert-color-hsluv.git diff --git a/lib/Convert/Color/LCh.pm b/lib/Convert/Color/LCh.pm index 83cf1bf..e12fdc4 100644 --- a/lib/Convert/Color/LCh.pm +++ b/lib/Convert/Color/LCh.pm @@ -1,11 +1,11 @@ package Convert::Color::LCh; -use 5.014000; +use 5.008009; use strict; use warnings; use parent qw/Convert::Color/; -our $VERSION = '0.001'; +our $VERSION = '0.002'; use Convert::Color::LUV; use Math::Trig ':pi'; @@ -37,6 +37,7 @@ sub new_from_luv { my ($class, $luv) = @_; my ($l, $u, $v) = @$luv; my $c = sqrt $u * $u + $v * $v; + return $class->new($l, $c, 0) if $c < 0.00000001; my $hrad = atan2 $v, $u; my $h = $hrad * 180 / pi; $h += 360 if $h < 0;