in reply to Re: Converting CMYK values to RGB values
in thread Converting CMYK values to RGB values
Using map allows for code that is (IMHO) somewhat clearer and more concise.
sub cmyk2rgb { my ($cyan, $magenta, $yellow, $black) = @_; my $white = 255 - $black; use integer; return map $_ > 255 ? 0 : 255 - $_ => map $_ * $white / 255 + $black => ($cyan, $magenta, $yellow); }
— Arien
|
|---|