From: cristy Date: Tue, 13 Apr 2010 01:18:27 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~9657 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b099320cc915f347f8e62da5f83292e4c46d4c19;p=imagemagick --- diff --git a/ChangeLog b/ChangeLog index 1178f4724..19fb1f15a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -2010-04-8 6.6.1-2 Cristy +2010-04-12 6.6.1-3 Cristy + * For HSL to RGB, if color temperature is less than 0, set RGB to lightness. + +2010-04-08 6.6.1-2 Cristy * Improve support for device link profiles. 2010-04-06 6.6.1-1 Anthony Thyssen diff --git a/magick/gem.c b/magick/gem.c index 5a173f92c..5a1784d85 100644 --- a/magick/gem.c +++ b/magick/gem.c @@ -98,20 +98,18 @@ MagickExport void ConvertHSBToRGB(const double hue,const double saturation, assert(red != (Quantum *) NULL); assert(green != (Quantum *) NULL); assert(blue != (Quantum *) NULL); - if (saturation == 0.0) + h=6.0*(hue-floor(hue)); + f=h-floor((double) h); + p=brightness*(1.0-saturation); + q=brightness*(1.0-saturation*f); + t=brightness*(1.0-(saturation*(1.0-f))); + if ((saturation == 0.0) || (p < 0.0)) { *red=ClampToQuantum((MagickRealType) QuantumRange*brightness); *green=(*red); *blue=(*red); return; } - h=6.0*(hue-floor(hue)); - f=h-floor((double) h); - p=brightness*(1.0-saturation); - q=brightness*(1.0-saturation*f); - t=brightness*(1.0-(saturation*(1.0-f))); - if (p < 0.0) - return; switch ((int) h) { case 0: @@ -220,20 +218,18 @@ MagickExport void ConvertHSLToRGB(const double hue,const double saturation, assert(red != (Quantum *) NULL); assert(green != (Quantum *) NULL); assert(blue != (Quantum *) NULL); - if (saturation == 0) + if (lightness < 0.5) + m2=lightness*(saturation+1.0); + else + m2=(lightness+saturation)-(lightness*saturation); + m1=2.0*lightness-m2; + if ((saturation == 0.0) || (m1 < 0.0)) { *red=ClampToQuantum((MagickRealType) QuantumRange*lightness); *green=(*red); *blue=(*red); return; } - if (lightness < 0.5) - m2=lightness*(saturation+1.0); - else - m2=(lightness+saturation)-(lightness*saturation); - m1=2.0*lightness-m2; - if (m1 <= 0.0) - return; r=ConvertHueToRGB(m1,m2,hue+1.0/3.0); g=ConvertHueToRGB(m1,m2,hue); b=ConvertHueToRGB(m1,m2,hue-1.0/3.0);