From 1efa581fd554f39a32b9122aa193be86c1515b79 Mon Sep 17 00:00:00 2001 From: Cristy Date: Fri, 3 Mar 2017 14:44:12 -0500 Subject: [PATCH] ... --- MagickCore/enhance.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index 529c4643b..1a0280d99 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -2948,6 +2948,10 @@ static inline void ModulateHCL(const double percent_hue, */ ConvertRGBToHCL(*red,*green,*blue,&hue,&chroma,&luma); hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue > 1.0) + hue-=1.0; chroma*=0.01*percent_chroma; luma*=0.01*percent_luma; ConvertHCLToRGB(hue,chroma,luma,red,green,blue); @@ -2967,6 +2971,10 @@ static inline void ModulateHCLp(const double percent_hue, */ ConvertRGBToHCLp(*red,*green,*blue,&hue,&chroma,&luma); hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue > 1.0) + hue-=1.0; chroma*=0.01*percent_chroma; luma*=0.01*percent_luma; ConvertHCLpToRGB(hue,chroma,luma,red,green,blue); @@ -2986,6 +2994,10 @@ static inline void ModulateHSB(const double percent_hue, */ ConvertRGBToHSB(*red,*green,*blue,&hue,&saturation,&brightness); hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue > 1.0) + hue-=1.0; saturation*=0.01*percent_saturation; brightness*=0.01*percent_brightness; ConvertHSBToRGB(hue,saturation,brightness,red,green,blue); @@ -3005,6 +3017,10 @@ static inline void ModulateHSI(const double percent_hue, */ ConvertRGBToHSI(*red,*green,*blue,&hue,&saturation,&intensity); hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue > 1.0) + hue-=1.0; saturation*=0.01*percent_saturation; intensity*=0.01*percent_intensity; ConvertHSIToRGB(hue,saturation,intensity,red,green,blue); @@ -3024,6 +3040,10 @@ static inline void ModulateHSL(const double percent_hue, */ ConvertRGBToHSL(*red,*green,*blue,&hue,&saturation,&lightness); hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue >= 1.0) + hue-=1.0; saturation*=0.01*percent_saturation; lightness*=0.01*percent_lightness; ConvertHSLToRGB(hue,saturation,lightness,red,green,blue); @@ -3043,6 +3063,10 @@ static inline void ModulateHSV(const double percent_hue, */ ConvertRGBToHSV(*red,*green,*blue,&hue,&saturation,&value); hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue >= 1.0) + hue-=1.0; saturation*=0.01*percent_saturation; value*=0.01*percent_value; ConvertHSVToRGB(hue,saturation,value,red,green,blue); @@ -3062,6 +3086,10 @@ static inline void ModulateHWB(const double percent_hue, */ ConvertRGBToHWB(*red,*green,*blue,&hue,&whiteness,&blackness); hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue >= 1.0) + hue-=1.0; blackness*=0.01*percent_blackness; whiteness*=0.01*percent_whiteness; ConvertHWBToRGB(hue,whiteness,blackness,red,green,blue); @@ -3083,6 +3111,10 @@ static inline void ModulateLCHab(const double percent_luma, luma*=0.01*percent_luma; chroma*=0.01*percent_chroma; hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue >= 1.0) + hue-=1.0; ConvertLCHabToRGB(luma,chroma,hue,red,green,blue); } @@ -3102,6 +3134,10 @@ static inline void ModulateLCHuv(const double percent_luma, luma*=0.01*percent_luma; chroma*=0.01*percent_chroma; hue+=0.5*(0.01*percent_hue-1.0); + while (hue < 0.0) + hue+=1.0; + while (hue >= 1.0) + hue-=1.0; ConvertLCHuvToRGB(luma,chroma,hue,red,green,blue); } -- 2.40.0