]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 17 Jun 2012 02:18:22 +0000 (02:18 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 17 Jun 2012 02:18:22 +0000 (02:18 +0000)
MagickCore/colorspace-private.h
MagickCore/colorspace.c
MagickCore/gem.c
MagickCore/pixel-accessor.h
MagickCore/xwindow-private.h

index 0f9339c4c486dbead1249c8deaea68f9eafead64..053f3f9a4ec244545ca8e388fe34f64680e601d8 100644 (file)
@@ -42,9 +42,9 @@ static inline void ConvertsRGBToCMYK(PixelInfo *pixel)
       pixel->black=(MagickRealType) QuantumRange;
       return;
     }
-  cyan=(MagickRealType) (1.0-sRGBDecompanding(QuantumScale*pixel->red));
-  magenta=(MagickRealType) (1.0-sRGBDecompanding(QuantumScale*pixel->green));
-  yellow=(MagickRealType) (1.0-sRGBDecompanding(QuantumScale*pixel->blue));
+  cyan=(MagickRealType) (1.0-DecompandsRGB(QuantumScale*pixel->red));
+  magenta=(MagickRealType) (1.0-DecompandsRGB(QuantumScale*pixel->green));
+  yellow=(MagickRealType) (1.0-DecompandsRGB(QuantumScale*pixel->blue));
   black=cyan;
   if (magenta < black)
     black=magenta;
index e9e513e5336d1d1e3c03f17a3e235e4d7d6cd54a..6faad9e91af83f53de1b3d6458a722618c4c309b 100644 (file)
@@ -126,9 +126,9 @@ static inline void ConvertsRGBToXYZ(const Quantum red,const Quantum green,
   assert(X != (double *) NULL);
   assert(Y != (double *) NULL);
   assert(Z != (double *) NULL);
-  r=sRGBDecompanding(QuantumScale*red);
-  g=sRGBDecompanding(QuantumScale*green);
-  b=sRGBDecompanding(QuantumScale*blue);
+  r=DecompandsRGB(QuantumScale*red);
+  g=DecompandsRGB(QuantumScale*green);
+  b=DecompandsRGB(QuantumScale*blue);
   *X=0.4360747*r+0.3850649*g+0.1430804*b;
   *Y=0.2225045*r+0.7168786*g+0.0606169*b;
   *Z=0.0139322*r+0.0971045*g+0.7141733*b;
@@ -260,12 +260,9 @@ static MagickBooleanType sRGBTransformImage(Image *image,
             green,
             red;
 
-          red=QuantumRange*sRGBDecompanding(QuantumScale*
-            GetPixelRed(image,q));
-          green=QuantumRange*sRGBDecompanding(QuantumScale*
-            GetPixelGreen(image,q));
-          blue=QuantumRange*sRGBDecompanding(QuantumScale*
-            GetPixelBlue(image,q));
+          red=QuantumRange*DecompandsRGB(QuantumScale*GetPixelRed(image,q));
+          green=QuantumRange*DecompandsRGB(QuantumScale*GetPixelGreen(image,q));
+          blue=QuantumRange*DecompandsRGB(QuantumScale*GetPixelBlue(image,q));
           SetPixelCyan(image,ClampToQuantum((MagickRealType) (QuantumRange-
             red)),q);
           SetPixelMagenta(image,ClampToQuantum((MagickRealType) (QuantumRange-
@@ -1177,11 +1174,11 @@ static MagickBooleanType sRGBTransformImage(Image *image,
           }
         for (x=0; x < (ssize_t) image->columns; x++)
         {
-          red=ScaleQuantumToMap(ClampToQuantum(QuantumRange*sRGBDecompanding(
+          red=ScaleQuantumToMap(ClampToQuantum(QuantumRange*DecompandsRGB(
             QuantumScale*GetPixelRed(image,q))));
-          green=ScaleQuantumToMap(ClampToQuantum(QuantumRange*sRGBDecompanding(
+          green=ScaleQuantumToMap(ClampToQuantum(QuantumRange*DecompandsRGB(
             QuantumScale*GetPixelGreen(image,q))));
-          blue=ScaleQuantumToMap(ClampToQuantum(QuantumRange*sRGBDecompanding(
+          blue=ScaleQuantumToMap(ClampToQuantum(QuantumRange*DecompandsRGB(
             QuantumScale*GetPixelBlue(image,q))));
           pixel.red=(x_map[red].x+y_map[green].x+z_map[blue].x)+
             (MagickRealType) primary_info.x;
@@ -1229,11 +1226,11 @@ static MagickBooleanType sRGBTransformImage(Image *image,
         PixelInfo
           pixel;
 
-        red=ScaleQuantumToMap(ClampToQuantum(QuantumRange*sRGBDecompanding(
+        red=ScaleQuantumToMap(ClampToQuantum(QuantumRange*DecompandsRGB(
           QuantumScale*image->colormap[i].red)));
-        green=ScaleQuantumToMap(ClampToQuantum(QuantumRange*sRGBDecompanding(
+        green=ScaleQuantumToMap(ClampToQuantum(QuantumRange*DecompandsRGB(
           QuantumScale*image->colormap[i].green)));
-        blue=ScaleQuantumToMap(ClampToQuantum(QuantumRange*sRGBDecompanding(
+        blue=ScaleQuantumToMap(ClampToQuantum(QuantumRange*DecompandsRGB(
           QuantumScale*image->colormap[i].blue)));
         pixel.red=x_map[red].x+y_map[green].x+z_map[blue].x+primary_info.x;
         pixel.green=x_map[red].y+y_map[green].y+z_map[blue].y+primary_info.y;
@@ -1464,9 +1461,9 @@ static inline void ConvertXYZTosRGB(const double x,const double y,const double z
   r=3.1338561*x-1.6168667*y-0.4906146*z;
   g=(-0.9787684*x+1.9161415*y+0.0334540*z);
   b=0.0719453*x-0.2289914*y+1.4052427*z;
-  *red=RoundToQuantum((MagickRealType) QuantumRange*sRGBCompanding(r));
-  *green=RoundToQuantum((MagickRealType) QuantumRange*sRGBCompanding(g));
-  *blue=RoundToQuantum((MagickRealType) QuantumRange*sRGBCompanding(b));
+  *red=RoundToQuantum((MagickRealType) QuantumRange*CompandsRGB(r));
+  *green=RoundToQuantum((MagickRealType) QuantumRange*CompandsRGB(g));
+  *blue=RoundToQuantum((MagickRealType) QuantumRange*CompandsRGB(b));
 }
 
 static inline void ConvertCMYKTosRGB(PixelInfo *pixel)
@@ -2698,11 +2695,11 @@ static MagickBooleanType TransformsRGBImage(Image *image,
                 pixel.blue)];
 #endif
             }
-          SetPixelRed(image,ClampToQuantum(QuantumRange*sRGBCompanding(
+          SetPixelRed(image,ClampToQuantum(QuantumRange*CompandsRGB(
             QuantumScale*ScaleMapToQuantum(pixel.red))),q);
-          SetPixelGreen(image,ClampToQuantum(QuantumRange*sRGBCompanding(
+          SetPixelGreen(image,ClampToQuantum(QuantumRange*CompandsRGB(
             QuantumScale*ScaleMapToQuantum(pixel.green))),q);
-          SetPixelBlue(image,ClampToQuantum(QuantumRange*sRGBCompanding(
+          SetPixelBlue(image,ClampToQuantum(QuantumRange*CompandsRGB(
             QuantumScale*ScaleMapToQuantum(pixel.blue))),q);
           q+=GetPixelChannels(image);
         }
@@ -2763,11 +2760,11 @@ static MagickBooleanType TransformsRGBImage(Image *image,
 #endif
           }
         image->colormap[i].red=(double) ClampToQuantum(QuantumRange*
-          sRGBCompanding(QuantumScale*ScaleMapToQuantum(pixel.red)));
+          CompandsRGB(QuantumScale*ScaleMapToQuantum(pixel.red)));
         image->colormap[i].green=(double) ClampToQuantum(QuantumRange*
-          sRGBCompanding(QuantumScale*ScaleMapToQuantum(pixel.green)));
+          CompandsRGB(QuantumScale*ScaleMapToQuantum(pixel.green)));
         image->colormap[i].blue=(double) ClampToQuantum(QuantumRange*
-          sRGBCompanding(QuantumScale*ScaleMapToQuantum(pixel.blue)));
+          CompandsRGB(QuantumScale*ScaleMapToQuantum(pixel.blue)));
       }
       (void) SyncImage(image,exception);
       break;
index 8f6a6ced0b35024db948ed28209188f1eead2f64..6071ce20f14f4f6589103a83c77642ad52bd8feb 100644 (file)
@@ -118,44 +118,44 @@ MagickPrivate void ConvertHSBTosRGB(const double hue,const double saturation,
     case 0:
     default:
     {
-      *red=QuantumRange*sRGBCompanding(brightness);
-      *green=QuantumRange*sRGBCompanding(t);
-      *blue=QuantumRange*sRGBCompanding(p);
+      *red=QuantumRange*CompandsRGB(brightness);
+      *green=QuantumRange*CompandsRGB(t);
+      *blue=QuantumRange*CompandsRGB(p);
       break;
     }
     case 1:
     {
-      *red=QuantumRange*sRGBCompanding(q);
-      *green=QuantumRange*sRGBCompanding(brightness);
-      *blue=QuantumRange*sRGBCompanding(p);
+      *red=QuantumRange*CompandsRGB(q);
+      *green=QuantumRange*CompandsRGB(brightness);
+      *blue=QuantumRange*CompandsRGB(p);
       break;
     }
     case 2:
     {
-      *red=QuantumRange*sRGBCompanding(p);
-      *green=QuantumRange*sRGBCompanding(brightness);
-      *blue=QuantumRange*sRGBCompanding(t);
+      *red=QuantumRange*CompandsRGB(p);
+      *green=QuantumRange*CompandsRGB(brightness);
+      *blue=QuantumRange*CompandsRGB(t);
       break;
     }
     case 3:
     {
-      *red=QuantumRange*sRGBCompanding(p);
-      *green=QuantumRange*sRGBCompanding(q);
-      *blue=QuantumRange*sRGBCompanding(brightness);
+      *red=QuantumRange*CompandsRGB(p);
+      *green=QuantumRange*CompandsRGB(q);
+      *blue=QuantumRange*CompandsRGB(brightness);
       break;
     }
     case 4:
     {
-      *red=QuantumRange*sRGBCompanding(t);
-      *green=QuantumRange*sRGBCompanding(p);
-      *blue=QuantumRange*sRGBCompanding(brightness);
+      *red=QuantumRange*CompandsRGB(t);
+      *green=QuantumRange*CompandsRGB(p);
+      *blue=QuantumRange*CompandsRGB(brightness);
       break;
     }
     case 5:
     {
-      *red=QuantumRange*sRGBCompanding(brightness);
-      *green=QuantumRange*sRGBCompanding(p);
-      *blue=QuantumRange*sRGBCompanding(q);
+      *red=QuantumRange*CompandsRGB(brightness);
+      *green=QuantumRange*CompandsRGB(p);
+      *blue=QuantumRange*CompandsRGB(q);
       break;
     }
   }
@@ -235,9 +235,9 @@ MagickExport void ConvertHSLTosRGB(const double hue,const double saturation,
   r=ConvertHueTosRGB(m1,m2,hue+1.0/3.0);
   g=ConvertHueTosRGB(m1,m2,hue);
   b=ConvertHueTosRGB(m1,m2,hue-1.0/3.0);
-  *red=QuantumRange*sRGBCompanding(r);
-  *green=QuantumRange*sRGBCompanding(g);
-  *blue=QuantumRange*sRGBCompanding(b);
+  *red=QuantumRange*CompandsRGB(r);
+  *green=QuantumRange*CompandsRGB(g);
+  *blue=QuantumRange*CompandsRGB(b);
 }
 \f
 /*
@@ -290,9 +290,9 @@ MagickPrivate void ConvertHWBTosRGB(const double hue,const double whiteness,
   v=1.0-blackness;
   if (hue == -1.0)
     {
-      *red=QuantumRange*sRGBCompanding(v);
-      *green=QuantumRange*sRGBCompanding(v);
-      *blue=QuantumRange*sRGBCompanding(v);
+      *red=QuantumRange*CompandsRGB(v);
+      *green=QuantumRange*CompandsRGB(v);
+      *blue=QuantumRange*CompandsRGB(v);
       return;
     }
   i=(ssize_t) floor(6.0*hue);
@@ -311,9 +311,9 @@ MagickPrivate void ConvertHWBTosRGB(const double hue,const double whiteness,
     case 4: r=n; g=whiteness; b=v; break;
     case 5: r=v; g=whiteness; b=n; break;
   }
-  *red=QuantumRange*sRGBCompanding(r);
-  *green=QuantumRange*sRGBCompanding(g);
-  *blue=QuantumRange*sRGBCompanding(b);
+  *red=QuantumRange*CompandsRGB(r);
+  *green=QuantumRange*CompandsRGB(g);
+  *blue=QuantumRange*CompandsRGB(b);
 }
 \f
 /*
@@ -364,9 +364,9 @@ MagickPrivate void ConvertsRGBToHSB(const double red,const double green,
   *hue=0.0;
   *saturation=0.0;
   *brightness=0.0;
-  r=QuantumRange*sRGBDecompanding(QuantumScale*red);
-  g=QuantumRange*sRGBDecompanding(QuantumScale*green);
-  b=QuantumRange*sRGBDecompanding(QuantumScale*blue);
+  r=QuantumRange*DecompandsRGB(QuantumScale*red);
+  g=QuantumRange*DecompandsRGB(QuantumScale*green);
+  b=QuantumRange*DecompandsRGB(QuantumScale*blue);
   min=r < g ? r : g;
   if (b < min)
     min=b;
@@ -452,9 +452,9 @@ MagickExport void ConvertsRGBToHSL(const double red,const double green,
   assert(hue != (double *) NULL);
   assert(saturation != (double *) NULL);
   assert(lightness != (double *) NULL);
-  r=sRGBDecompanding(QuantumScale*red);
-  g=sRGBDecompanding(QuantumScale*green);
-  b=sRGBDecompanding(QuantumScale*blue);
+  r=DecompandsRGB(QuantumScale*red);
+  g=DecompandsRGB(QuantumScale*green);
+  b=DecompandsRGB(QuantumScale*blue);
   max=MagickMax(r,MagickMax(g,b));
   min=MagickMin(r,MagickMin(g,b));
   *lightness=(double) ((min+max)/2.0);
@@ -531,9 +531,9 @@ MagickPrivate void ConvertsRGBToHWB(const double red,const double green,
   assert(hue != (double *) NULL);
   assert(whiteness != (double *) NULL);
   assert(blackness != (double *) NULL);
-  r=QuantumRange*sRGBDecompanding(QuantumScale*red);
-  g=QuantumRange*sRGBDecompanding(QuantumScale*green);
-  b=QuantumRange*sRGBDecompanding(QuantumScale*blue);
+  r=QuantumRange*DecompandsRGB(QuantumScale*red);
+  g=QuantumRange*DecompandsRGB(QuantumScale*green);
+  b=QuantumRange*DecompandsRGB(QuantumScale*blue);
   w=MagickMin(r,MagickMin(g,b));
   v=MagickMax(r,MagickMax(g,b));
   *blackness=1.0-QuantumScale*v;
index 26a3d15b39a3945b6acd59a8adc769b267ee032c..491a70f16589c4935f9ad236ff462782c6eb9763 100644 (file)
@@ -31,14 +31,14 @@ extern "C" {
 
 #undef index
 
-static inline double sRGBCompanding(const double intensity)
+static inline double CompandsRGB(const double intensity)
 {
   if (intensity <= 0.0031308)
     return(intensity*12.92);
   return(1.055*pow(intensity,1.0/2.4)-0.055);
 }
 
-static inline double sRGBDecompanding(const double intensity)
+static inline double DecompandsRGB(const double intensity)
 {
   if (intensity <= 0.04045)
     return(intensity/12.92);
@@ -197,9 +197,9 @@ static inline Quantum GetPixelInfoIntensity(
     }
   else
     {
-      red=QuantumRange*sRGBDecompanding(QuantumScale*pixel_info->red);
-      green=QuantumRange*sRGBDecompanding(QuantumScale*pixel_info->green);
-      blue=QuantumRange*sRGBDecompanding(QuantumScale*pixel_info->blue);
+      red=QuantumRange*DecompandsRGB(QuantumScale*pixel_info->red);
+      green=QuantumRange*DecompandsRGB(QuantumScale*pixel_info->green);
+      blue=QuantumRange*DecompandsRGB(QuantumScale*pixel_info->blue);
     }
 #if !defined(MAGICKCORE_HDRI_SUPPORT)
   return((Quantum) (0.298839*red+0.586811*green+0.114350*blue+0.5));
@@ -227,9 +227,9 @@ static inline Quantum GetPixelInfoLuminance(
     }
   else
     {
-      red=QuantumRange*sRGBDecompanding(QuantumScale*pixel_info->red);
-      green=QuantumRange*sRGBDecompanding(QuantumScale*pixel_info->green);
-      blue=QuantumRange*sRGBDecompanding(QuantumScale*pixel_info->blue);
+      red=QuantumRange*DecompandsRGB(QuantumScale*pixel_info->red);
+      green=QuantumRange*DecompandsRGB(QuantumScale*pixel_info->green);
+      blue=QuantumRange*DecompandsRGB(QuantumScale*pixel_info->blue);
     }
 #if !defined(MAGICKCORE_HDRI_SUPPORT)
   luminance=(Quantum) (0.21267*red+0.71516*green+0.07217*blue+0.5);
@@ -257,11 +257,11 @@ static inline Quantum GetPixelIntensity(const Image *restrict image,
     }
   else
     {
-      red=QuantumRange*sRGBDecompanding(QuantumScale*
+      red=QuantumRange*DecompandsRGB(QuantumScale*
         pixel[image->channel_map[RedPixelChannel].offset]);
-      green=QuantumRange*sRGBDecompanding(QuantumScale*
+      green=QuantumRange*DecompandsRGB(QuantumScale*
         pixel[image->channel_map[GreenPixelChannel].offset]);
-      blue=QuantumRange*sRGBDecompanding(QuantumScale*
+      blue=QuantumRange*DecompandsRGB(QuantumScale*
         pixel[image->channel_map[BluePixelChannel].offset]);
     }
 #if !defined(MAGICKCORE_HDRI_SUPPORT)
@@ -298,11 +298,11 @@ static inline Quantum GetPixelLuminance(const Image *restrict image,
     }
   else
     {
-      red=QuantumRange*sRGBDecompanding(QuantumScale*
+      red=QuantumRange*DecompandsRGB(QuantumScale*
         pixel[image->channel_map[RedPixelChannel].offset]);
-      green=QuantumRange*sRGBDecompanding(QuantumScale*
+      green=QuantumRange*DecompandsRGB(QuantumScale*
         pixel[image->channel_map[GreenPixelChannel].offset]);
-      blue=QuantumRange*sRGBDecompanding(QuantumScale*
+      blue=QuantumRange*DecompandsRGB(QuantumScale*
         pixel[image->channel_map[BluePixelChannel].offset]);
     }
 #if !defined(MAGICKCORE_HDRI_SUPPORT)
index c0710560a5a8723853277cb300d35fd8ae31bc62..62c887ce3148c3e1b85a2730bdc6cd7df29f77d8 100644 (file)
@@ -606,9 +606,9 @@ static inline MagickRealType XPixelIntensity(const XColor *pixel)
   MagickRealType
     intensity;
 
-  red=QuantumRange*sRGBDecompanding(QuantumScale*pixel->red);
-  green=QuantumRange*sRGBDecompanding(QuantumScale*pixel->green);
-  blue=QuantumRange*sRGBDecompanding(QuantumScale*pixel->blue);
+  red=QuantumRange*DecompandsRGB(QuantumScale*pixel->red);
+  green=QuantumRange*DecompandsRGB(QuantumScale*pixel->green);
+  blue=QuantumRange*DecompandsRGB(QuantumScale*pixel->blue);
   intensity=0.298839*red+0.586811*green+0.114350*blue;
   return(intensity);
 }