use warnings;
use List::Util qw( min max );
-our $VERSION = '1.02';
+our $VERSION = '1.03';
# ITU-R recommendation 601 luma co-efficients
our $kr = .299;
}
sub hue {
+ # colour shift (red = 0 .. 1)
my ($r, $g, $b) = @{ $_[0] };
my $hue = atan2 sqrt(3) * ($g - $b), $r*2 - $g - $b;
- return ($hue + $PI) / $PI / 2; # 0 .. 1
+ $hue /= $PI * 2; # -.5 .. .5
+ $hue++ if $hue < 0; # fp $hue %= 1
+ return $hue;
}
sub rgb24 {