]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 16 Jun 2012 18:28:54 +0000 (18:28 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 16 Jun 2012 18:28:54 +0000 (18:28 +0000)
MagickCore/colorspace.c
MagickCore/gem.c
MagickCore/image.c
MagickCore/magick-type.h
MagickCore/pixel-accessor.h
PerlMagick/t/read.t
PerlMagick/t/write.t
coders/bmp.c
coders/txt.c

index 7101d4273e6a34f68c1be9318fde6aa79a9a8234..e9e513e5336d1d1e3c03f17a3e235e4d7d6cd54a 100644 (file)
@@ -267,11 +267,11 @@ static MagickBooleanType sRGBTransformImage(Image *image,
           blue=QuantumRange*sRGBDecompanding(QuantumScale*
             GetPixelBlue(image,q));
           SetPixelCyan(image,ClampToQuantum((MagickRealType) (QuantumRange-
-            GetPixelRed(image,q))),q);
+            red)),q);
           SetPixelMagenta(image,ClampToQuantum((MagickRealType) (QuantumRange-
-            GetPixelGreen(image,q))),q);
+            green)),q);
           SetPixelYellow(image,ClampToQuantum((MagickRealType) (QuantumRange-
-            GetPixelBlue(image,q))),q);
+            blue)),q);
           q+=GetPixelChannels(image);
         }
         sync=SyncCacheViewAuthenticPixels(image_view,exception);
@@ -811,15 +811,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.33333f*(MagickRealType) i;
-        y_map[i].x=0.33334f*(MagickRealType) i;
-        z_map[i].x=0.33333f*(MagickRealType) i;
-        x_map[i].y=0.50000f*(MagickRealType) i;
-        y_map[i].y=0.00000f*(MagickRealType) i;
-        z_map[i].y=(-0.50000f)*(MagickRealType) i;
-        x_map[i].z=(-0.25000f)*(MagickRealType) i;
-        y_map[i].z=0.50000f*(MagickRealType) i;
-        z_map[i].z=(-0.25000f)*(MagickRealType) i;
+        x_map[i].x=0.33333*(MagickRealType) i;
+        y_map[i].x=0.33334*(MagickRealType) i;
+        z_map[i].x=0.33333*(MagickRealType) i;
+        x_map[i].y=0.50000*(MagickRealType) i;
+        y_map[i].y=0.00000*(MagickRealType) i;
+        z_map[i].y=(-0.50000)*(MagickRealType) i;
+        x_map[i].z=(-0.25000)*(MagickRealType) i;
+        y_map[i].z=0.50000*(MagickRealType) i;
+        z_map[i].z=(-0.25000)*(MagickRealType) i;
       }
       break;
     }
@@ -837,15 +837,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.298839f*(MagickRealType) i;
-        y_map[i].x=0.586811f*(MagickRealType) i;
-        z_map[i].x=0.114350f*(MagickRealType) i;
-        x_map[i].y=0.298839f*(MagickRealType) i;
-        y_map[i].y=0.586811f*(MagickRealType) i;
-        z_map[i].y=0.114350f*(MagickRealType) i;
-        x_map[i].z=0.298839f*(MagickRealType) i;
-        y_map[i].z=0.586811f*(MagickRealType) i;
-        z_map[i].z=0.114350f*(MagickRealType) i;
+        x_map[i].x=0.298839*(MagickRealType) i;
+        y_map[i].x=0.586811*(MagickRealType) i;
+        z_map[i].x=0.114350*(MagickRealType) i;
+        x_map[i].y=0.298839*(MagickRealType) i;
+        y_map[i].y=0.586811*(MagickRealType) i;
+        z_map[i].y=0.114350*(MagickRealType) i;
+        x_map[i].z=0.298839*(MagickRealType) i;
+        y_map[i].z=0.586811*(MagickRealType) i;
+        z_map[i].z=0.114350*(MagickRealType) i;
       }
       image->type=GrayscaleType;
       break;
@@ -871,15 +871,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.298839f*(MagickRealType) i;
-        y_map[i].x=0.586811f*(MagickRealType) i;
-        z_map[i].x=0.114350f*(MagickRealType) i;
-        x_map[i].y=(-0.168730f)*(MagickRealType) i;
-        y_map[i].y=(-0.331264f)*(MagickRealType) i;
-        z_map[i].y=0.500000f*(MagickRealType) i;
-        x_map[i].z=0.500000f*(MagickRealType) i;
-        y_map[i].z=(-0.418688f)*(MagickRealType) i;
-        z_map[i].z=(-0.081312f)*(MagickRealType) i;
+        x_map[i].x=0.298839*(MagickRealType) i;
+        y_map[i].x=0.586811*(MagickRealType) i;
+        z_map[i].x=0.114350*(MagickRealType) i;
+        x_map[i].y=(-0.168730)*(MagickRealType) i;
+        y_map[i].y=(-0.331264)*(MagickRealType) i;
+        z_map[i].y=0.500000*(MagickRealType) i;
+        x_map[i].z=0.500000*(MagickRealType) i;
+        y_map[i].z=(-0.418688)*(MagickRealType) i;
+        z_map[i].z=(-0.081312)*(MagickRealType) i;
       }
       break;
     }
@@ -896,15 +896,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.21260f*(MagickRealType) i;
-        y_map[i].x=0.71520f*(MagickRealType) i;
-        z_map[i].x=0.07220f*(MagickRealType) i;
-        x_map[i].y=0.21260f*(MagickRealType) i;
-        y_map[i].y=0.71520f*(MagickRealType) i;
-        z_map[i].y=0.07220f*(MagickRealType) i;
-        x_map[i].z=0.21260f*(MagickRealType) i;
-        y_map[i].z=0.71520f*(MagickRealType) i;
-        z_map[i].z=0.07220f*(MagickRealType) i;
+        x_map[i].x=0.21260*(MagickRealType) i;
+        y_map[i].x=0.71520*(MagickRealType) i;
+        z_map[i].x=0.07220*(MagickRealType) i;
+        x_map[i].y=0.21260*(MagickRealType) i;
+        y_map[i].y=0.71520*(MagickRealType) i;
+        z_map[i].y=0.07220*(MagickRealType) i;
+        x_map[i].z=0.21260*(MagickRealType) i;
+        y_map[i].z=0.71520*(MagickRealType) i;
+        z_map[i].z=0.07220*(MagickRealType) i;
       }
       break;
     }
@@ -928,15 +928,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.212600f*(MagickRealType) i;
-        y_map[i].x=0.715200f*(MagickRealType) i;
-        z_map[i].x=0.072200f*(MagickRealType) i;
-        x_map[i].y=(-0.114572f)*(MagickRealType) i;
-        y_map[i].y=(-0.385428f)*(MagickRealType) i;
-        z_map[i].y=0.500000f*(MagickRealType) i;
-        x_map[i].z=0.500000f*(MagickRealType) i;
-        y_map[i].z=(-0.454153f)*(MagickRealType) i;
-        z_map[i].z=(-0.045847f)*(MagickRealType) i;
+        x_map[i].x=0.212600*(MagickRealType) i;
+        y_map[i].x=0.715200*(MagickRealType) i;
+        z_map[i].x=0.072200*(MagickRealType) i;
+        x_map[i].y=(-0.114572)*(MagickRealType) i;
+        y_map[i].y=(-0.385428)*(MagickRealType) i;
+        z_map[i].y=0.500000*(MagickRealType) i;
+        x_map[i].z=0.500000*(MagickRealType) i;
+        y_map[i].z=(-0.454153)*(MagickRealType) i;
+        z_map[i].z=(-0.045847)*(MagickRealType) i;
       }
       break;
     }
@@ -956,19 +956,19 @@ static MagickBooleanType sRGBTransformImage(Image *image,
           v;
 
         v=(MagickRealType) i/(MagickRealType) MaxMap;
-        if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.0404482362771082f)
-          v/=12.92f;
+        if (((MagickRealType) i/(MagickRealType) MaxMap) <= 0.0404482362771082)
+          v/=12.92;
         else
           v=(MagickRealType) pow((((double) i/MaxMap)+0.055)/1.055,2.4);
-        x_map[i].x=1.0f*MaxMap*v;
-        y_map[i].x=0.0f*MaxMap*v;
-        z_map[i].x=0.0f*MaxMap*v;
-        x_map[i].y=0.0f*MaxMap*v;
-        y_map[i].y=1.0f*MaxMap*v;
-        z_map[i].y=0.0f*MaxMap*v;
-        x_map[i].z=0.0f*MaxMap*v;
-        y_map[i].z=0.0f*MaxMap*v;
-        z_map[i].z=1.0f*MaxMap*v;
+        x_map[i].x=1.0*MaxMap*v;
+        y_map[i].x=0.0*MaxMap*v;
+        z_map[i].x=0.0*MaxMap*v;
+        x_map[i].y=0.0*MaxMap*v;
+        y_map[i].y=1.0*MaxMap*v;
+        z_map[i].y=0.0*MaxMap*v;
+        x_map[i].z=0.0*MaxMap*v;
+        y_map[i].z=0.0*MaxMap*v;
+        z_map[i].z=1.0*MaxMap*v;
       }
       break;
     }
@@ -987,27 +987,27 @@ static MagickBooleanType sRGBTransformImage(Image *image,
       primary_info.z=(double) ScaleQuantumToMap(ScaleCharToQuantum(137));
       for (i=0; i <= (ssize_t) (0.018*MaxMap); i++)
       {
-        x_map[i].x=0.003962014134275617f*(MagickRealType) i;
-        y_map[i].x=0.007778268551236748f*(MagickRealType) i;
-        z_map[i].x=0.001510600706713781f*(MagickRealType) i;
-        x_map[i].y=(-0.002426619775463276f)*(MagickRealType) i;
-        y_map[i].y=(-0.004763965913702149f)*(MagickRealType) i;
-        z_map[i].y=0.007190585689165425f*(MagickRealType) i;
-        x_map[i].z=0.006927257754597858f*(MagickRealType) i;
-        y_map[i].z=(-0.005800713697502058f)*(MagickRealType) i;
-        z_map[i].z=(-0.0011265440570958f)*(MagickRealType) i;
+        x_map[i].x=0.003962014134275617*(MagickRealType) i;
+        y_map[i].x=0.007778268551236748*(MagickRealType) i;
+        z_map[i].x=0.001510600706713781*(MagickRealType) i;
+        x_map[i].y=(-0.002426619775463276)*(MagickRealType) i;
+        y_map[i].y=(-0.004763965913702149)*(MagickRealType) i;
+        z_map[i].y=0.007190585689165425*(MagickRealType) i;
+        x_map[i].z=0.006927257754597858*(MagickRealType) i;
+        y_map[i].z=(-0.005800713697502058)*(MagickRealType) i;
+        z_map[i].z=(-0.0011265440570958)*(MagickRealType) i;
       }
       for ( ; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.2201118963486454*(1.099f*(MagickRealType) i-0.099f);
-        y_map[i].x=0.4321260306242638*(1.099f*(MagickRealType) i-0.099f);
-        z_map[i].x=0.08392226148409894*(1.099f*(MagickRealType) i-0.099f);
-        x_map[i].y=(-0.1348122097479598)*(1.099f*(MagickRealType) i-0.099f);
-        y_map[i].y=(-0.2646647729834528)*(1.099f*(MagickRealType) i-0.099f);
-        z_map[i].y=0.3994769827314126*(1.099f*(MagickRealType) i-0.099f);
-        x_map[i].z=0.3848476530332144*(1.099f*(MagickRealType) i-0.099f);
-        y_map[i].z=(-0.3222618720834477)*(1.099f*(MagickRealType) i-0.099f);
-        z_map[i].z=(-0.06258578094976668)*(1.099f*(MagickRealType) i-0.099f);
+        x_map[i].x=0.2201118963486454*(1.099*(MagickRealType) i-0.099);
+        y_map[i].x=0.4321260306242638*(1.099*(MagickRealType) i-0.099);
+        z_map[i].x=0.08392226148409894*(1.099*(MagickRealType) i-0.099);
+        x_map[i].y=(-0.1348122097479598)*(1.099*(MagickRealType) i-0.099);
+        y_map[i].y=(-0.2646647729834528)*(1.099*(MagickRealType) i-0.099);
+        z_map[i].y=0.3994769827314126*(1.099*(MagickRealType) i-0.099);
+        x_map[i].z=0.3848476530332144*(1.099*(MagickRealType) i-0.099);
+        y_map[i].z=(-0.3222618720834477)*(1.099*(MagickRealType) i-0.099);
+        z_map[i].z=(-0.06258578094976668)*(1.099*(MagickRealType) i-0.099);
       }
       break;
     }
@@ -1031,15 +1031,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.298839f*(MagickRealType) i;
-        y_map[i].x=0.586811f*(MagickRealType) i;
-        z_map[i].x=0.114350f*(MagickRealType) i;
-        x_map[i].y=0.59600f*(MagickRealType) i;
-        y_map[i].y=(-0.27400f)*(MagickRealType) i;
-        z_map[i].y=(-0.32200f)*(MagickRealType) i;
-        x_map[i].z=0.21100f*(MagickRealType) i;
-        y_map[i].z=(-0.52300f)*(MagickRealType) i;
-        z_map[i].z=0.31200f*(MagickRealType) i;
+        x_map[i].x=0.298839*(MagickRealType) i;
+        y_map[i].x=0.586811*(MagickRealType) i;
+        z_map[i].x=0.114350*(MagickRealType) i;
+        x_map[i].y=0.59600*(MagickRealType) i;
+        y_map[i].y=(-0.27400)*(MagickRealType) i;
+        z_map[i].y=(-0.32200)*(MagickRealType) i;
+        x_map[i].z=0.21100*(MagickRealType) i;
+        y_map[i].z=(-0.52300)*(MagickRealType) i;
+        z_map[i].z=0.31200*(MagickRealType) i;
       }
       break;
     }
@@ -1063,15 +1063,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.298839f*(MagickRealType) i;
-        y_map[i].x=0.586811f*(MagickRealType) i;
-        z_map[i].x=0.114350f*(MagickRealType) i;
-        x_map[i].y=(-0.168736f)*(MagickRealType) i;
-        y_map[i].y=(-0.331264f)*(MagickRealType) i;
-        z_map[i].y=0.500000f*(MagickRealType) i;
-        x_map[i].z=0.500000f*(MagickRealType) i;
-        y_map[i].z=(-0.418688f)*(MagickRealType) i;
-        z_map[i].z=(-0.081312f)*(MagickRealType) i;
+        x_map[i].x=0.298839*(MagickRealType) i;
+        y_map[i].x=0.586811*(MagickRealType) i;
+        z_map[i].x=0.114350*(MagickRealType) i;
+        x_map[i].y=(-0.168736)*(MagickRealType) i;
+        y_map[i].y=(-0.331264)*(MagickRealType) i;
+        z_map[i].y=0.500000*(MagickRealType) i;
+        x_map[i].z=0.500000*(MagickRealType) i;
+        y_map[i].z=(-0.418688)*(MagickRealType) i;
+        z_map[i].z=(-0.081312)*(MagickRealType) i;
       }
       break;
     }
@@ -1095,15 +1095,15 @@ static MagickBooleanType sRGBTransformImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=0.298839f*(MagickRealType) i;
-        y_map[i].x=0.586811f*(MagickRealType) i;
-        z_map[i].x=0.114350f*(MagickRealType) i;
-        x_map[i].y=(-0.14740f)*(MagickRealType) i;
-        y_map[i].y=(-0.28950f)*(MagickRealType) i;
-        z_map[i].y=0.43690f*(MagickRealType) i;
-        x_map[i].z=0.61500f*(MagickRealType) i;
-        y_map[i].z=(-0.51500f)*(MagickRealType) i;
-        z_map[i].z=(-0.10000f)*(MagickRealType) i;
+        x_map[i].x=0.298839*(MagickRealType) i;
+        y_map[i].x=0.586811*(MagickRealType) i;
+        z_map[i].x=0.114350*(MagickRealType) i;
+        x_map[i].y=(-0.14740)*(MagickRealType) i;
+        y_map[i].y=(-0.28950)*(MagickRealType) i;
+        z_map[i].y=0.43690*(MagickRealType) i;
+        x_map[i].z=0.61500*(MagickRealType) i;
+        y_map[i].z=(-0.51500)*(MagickRealType) i;
+        z_map[i].z=(-0.10000)*(MagickRealType) i;
       }
       break;
     }
@@ -1289,23 +1289,23 @@ MagickExport MagickBooleanType SetImageColorspace(Image *image,
 {
   image->colorspace=colorspace;
   image->rendering_intent=UndefinedIntent;
-  image->gamma=1.000f;
+  image->gamma=1.000;
   (void) ResetMagickMemory(&image->chromaticity,0,sizeof(image->chromaticity));
   if (IssRGBColorspace(colorspace) != MagickFalse)
     {
       image->rendering_intent=PerceptualIntent;
-      image->gamma=1.000f/2.200f;
-      image->chromaticity.red_primary.x=0.6400f;
-      image->chromaticity.red_primary.y=0.3300f;
-      image->chromaticity.red_primary.z=0.0300f;
-      image->chromaticity.green_primary.x=0.3000f;
-      image->chromaticity.green_primary.y=0.6000f;
-      image->chromaticity.green_primary.z=0.1000f;
-      image->chromaticity.blue_primary.x=0.1500f;
-      image->chromaticity.blue_primary.y=0.0600f;
-      image->chromaticity.blue_primary.z=0.7900f;
-      image->chromaticity.white_point.x=0.3127f;
-      image->chromaticity.white_point.y=0.3290f;
+      image->gamma=1.000/2.200;
+      image->chromaticity.red_primary.x=0.6400;
+      image->chromaticity.red_primary.y=0.3300;
+      image->chromaticity.red_primary.z=0.0300;
+      image->chromaticity.green_primary.x=0.3000;
+      image->chromaticity.green_primary.y=0.6000;
+      image->chromaticity.green_primary.z=0.1000;
+      image->chromaticity.blue_primary.x=0.1500;
+      image->chromaticity.blue_primary.y=0.0600;
+      image->chromaticity.blue_primary.z=0.7900;
+      image->chromaticity.white_point.x=0.3127;
+      image->chromaticity.white_point.y=0.3290;
       image->chromaticity.white_point.z=0.3583f;
     }
   return(SyncImagePixelCache(image,exception));
@@ -2354,18 +2354,18 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=(MagickRealType) i;
-        y_map[i].x=0.500000f*(2.000000*(MagickRealType) i-(MagickRealType)
+        y_map[i].x=0.500000*(2.000000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].x=(-0.333340f)*(2.000000f*(MagickRealType) i-(MagickRealType)
+        z_map[i].x=(-0.333340)*(2.000000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].y=(MagickRealType) i;
-        y_map[i].y=0.000000f;
-        z_map[i].y=0.666665f*(2.000000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].y=0.000000;
+        z_map[i].y=0.666665*(2.000000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].z=(MagickRealType) i;
-        y_map[i].z=(-0.500000f)*(2.000000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].z=(-0.500000)*(2.000000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].z=(-0.333340f)*(2.000000f*(MagickRealType) i-(MagickRealType)
+        z_map[i].z=(-0.333340)*(2.000000*(MagickRealType) i-(MagickRealType)
           MaxMap);
       }
       break;
@@ -2390,18 +2390,18 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=(MagickRealType) i;
-        y_map[i].x=0.000000f;
-        z_map[i].x=(1.402000f*0.500000f)*(2.000000f*(MagickRealType) i-
+        y_map[i].x=0.000000;
+        z_map[i].x=(1.402000*0.500000)*(2.000000*(MagickRealType) i-
           (MagickRealType) MaxMap);
         x_map[i].y=(MagickRealType) i;
-        y_map[i].y=(-0.344136f*0.500000f)*(2.000000f*(MagickRealType) i-
+        y_map[i].y=(-0.344136*0.500000)*(2.000000*(MagickRealType) i-
           (MagickRealType) MaxMap);
-        z_map[i].y=(-0.714136f*0.500000f)*(2.000000f*(MagickRealType) i-
+        z_map[i].y=(-0.714136*0.500000)*(2.000000*(MagickRealType) i-
           (MagickRealType) MaxMap);
         x_map[i].z=(MagickRealType) i;
-        y_map[i].z=(1.772000f*0.500000f)*(2.000000f*(MagickRealType) i-
+        y_map[i].z=(1.772000*0.500000)*(2.000000*(MagickRealType) i-
           (MagickRealType) MaxMap);
-        z_map[i].z=0.000000f;
+        z_map[i].z=0.000000;
       }
       break;
     }
@@ -2424,18 +2424,18 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=(MagickRealType) i;
-        y_map[i].x=0.000000f;
-        z_map[i].x=(1.574800f*0.50000f)*(2.00000f*(MagickRealType) i-
+        y_map[i].x=0.000000;
+        z_map[i].x=(1.574800*0.50000)*(2.00000*(MagickRealType) i-
           (MagickRealType) MaxMap);
         x_map[i].y=(MagickRealType) i;
-        y_map[i].y=(-0.187324f*0.50000f)*(2.00000f*(MagickRealType) i-
+        y_map[i].y=(-0.187324*0.50000)*(2.00000*(MagickRealType) i-
           (MagickRealType) MaxMap);
-        z_map[i].y=(-0.468124f*0.50000f)*(2.00000f*(MagickRealType) i-
+        z_map[i].y=(-0.468124*0.50000)*(2.00000*(MagickRealType) i-
           (MagickRealType) MaxMap);
         x_map[i].z=(MagickRealType) i;
-        y_map[i].z=(1.855600f*0.50000f)*(2.00000f*(MagickRealType) i-
+        y_map[i].z=(1.855600*0.50000)*(2.00000*(MagickRealType) i-
           (MagickRealType) MaxMap);
-        z_map[i].z=0.00000f;
+        z_map[i].z=0.00000;
       }
       break;
     }
@@ -2462,15 +2462,15 @@ static MagickBooleanType TransformsRGBImage(Image *image,
           v*=12.92f;
         else
           v=(MagickRealType) (1.055*pow((double) i/MaxMap,1.0/2.4)-0.055);
-        x_map[i].x=1.0f*MaxMap*v;
-        y_map[i].x=0.0f*MaxMap*v;
-        z_map[i].x=0.0f*MaxMap*v;
-        x_map[i].y=0.0f*MaxMap*v;
-        y_map[i].y=1.0f*MaxMap*v;
-        z_map[i].y=0.0f*MaxMap*v;
-        x_map[i].z=0.0f*MaxMap*v;
-        y_map[i].z=0.0f*MaxMap*v;
-        z_map[i].z=1.0f*MaxMap*v;
+        x_map[i].x=1.0*MaxMap*v;
+        y_map[i].x=0.0*MaxMap*v;
+        z_map[i].x=0.0*MaxMap*v;
+        x_map[i].y=0.0*MaxMap*v;
+        y_map[i].y=1.0*MaxMap*v;
+        z_map[i].y=0.0*MaxMap*v;
+        x_map[i].z=0.0*MaxMap*v;
+        y_map[i].z=0.0*MaxMap*v;
+        z_map[i].z=1.0*MaxMap*v;
       }
       break;
     }
@@ -2491,19 +2491,19 @@ static MagickBooleanType TransformsRGBImage(Image *image,
 #endif
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
-        x_map[i].x=1.3584000f*(MagickRealType) i;
-        y_map[i].x=0.0000000f;
-        z_map[i].x=1.8215000f*((MagickRealType) i-(MagickRealType)
+        x_map[i].x=1.3584000*(MagickRealType) i;
+        y_map[i].x=0.0000000;
+        z_map[i].x=1.8215000*((MagickRealType) i-(MagickRealType)
           ScaleQuantumToMap(ScaleCharToQuantum(137)));
-        x_map[i].y=1.3584000f*(MagickRealType) i;
-        y_map[i].y=(-0.4302726f)*((MagickRealType) i-(MagickRealType)
+        x_map[i].y=1.3584000*(MagickRealType) i;
+        y_map[i].y=(-0.4302726)*((MagickRealType) i-(MagickRealType)
           ScaleQuantumToMap(ScaleCharToQuantum(156)));
-        z_map[i].y=(-0.9271435f)*((MagickRealType) i-(MagickRealType)
+        z_map[i].y=(-0.9271435)*((MagickRealType) i-(MagickRealType)
           ScaleQuantumToMap(ScaleCharToQuantum(137)));
-        x_map[i].z=1.3584000f*(MagickRealType) i;
-        y_map[i].z=2.2179000f*((MagickRealType) i-(MagickRealType)
+        x_map[i].z=1.3584000*(MagickRealType) i;
+        y_map[i].z=2.2179000*((MagickRealType) i-(MagickRealType)
           ScaleQuantumToMap(ScaleCharToQuantum(156)));
-        z_map[i].z=0.0000000f;
+        z_map[i].z=0.0000000;
       }
       break;
     }
@@ -2526,19 +2526,19 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=(MagickRealType) i;
-        y_map[i].x=0.47810f*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].x=0.47810*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].x=0.31070f*(2.00000f*(MagickRealType) i-(MagickRealType)
+        z_map[i].x=0.31070*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].y=(MagickRealType) i;
-        y_map[i].y=(-0.13635f)*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].y=(-0.13635)*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].y=(-0.32340f)*(2.00000f*(MagickRealType) i-(MagickRealType)
+        z_map[i].y=(-0.32340)*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].z=(MagickRealType) i;
-        y_map[i].z=(-0.55185f)*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].z=(-0.55185)*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].z=0.85030f*(2.00000f*(MagickRealType) i-(MagickRealType)
+        z_map[i].z=0.85030*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
       }
       break;
@@ -2562,18 +2562,18 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=(MagickRealType) i;
-        y_map[i].x=0.000000f;
-        z_map[i].x=0.701000f*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].x=0.000000;
+        z_map[i].x=0.701000*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].y=(MagickRealType) i;
-        y_map[i].y=(-0.172068f)*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].y=(-0.172068)*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].y=0.357068f*(2.00000f*(MagickRealType) i-(MagickRealType)
+        z_map[i].y=0.357068*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].z=(MagickRealType) i;
-        y_map[i].z=0.88600f*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].z=0.88600*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].z=0.00000f;
+        z_map[i].z=0.00000;
       }
       break;
     }
@@ -2596,18 +2596,18 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=(MagickRealType) i;
-        y_map[i].x=0.00000f;
-        z_map[i].x=0.56990f*(2.0000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].x=0.00000;
+        z_map[i].x=0.56990*(2.0000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].y=(MagickRealType) i;
-        y_map[i].y=(-0.19690f)*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].y=(-0.19690)*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].y=(-0.29025f)*(2.00000f*(MagickRealType) i-(MagickRealType)
+        z_map[i].y=(-0.29025)*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
         x_map[i].z=(MagickRealType) i;
-        y_map[i].z=1.01395f*(2.00000f*(MagickRealType) i-(MagickRealType)
+        y_map[i].z=1.01395*(2.00000*(MagickRealType) i-(MagickRealType)
           MaxMap);
-        z_map[i].z=0.00000f;
+        z_map[i].z=0.00000;
       }
       break;
     }
@@ -2623,13 +2623,13 @@ static MagickBooleanType TransformsRGBImage(Image *image,
       for (i=0; i <= (ssize_t) MaxMap; i++)
       {
         x_map[i].x=(MagickRealType) i;
-        y_map[i].x=0.0f;
-        z_map[i].x=0.0f;
-        x_map[i].y=0.0f;
+        y_map[i].x=0.0;
+        z_map[i].x=0.0;
+        x_map[i].y=0.0;
         y_map[i].y=(MagickRealType) i;
-        z_map[i].y=0.0f;
-        x_map[i].z=0.0f;
-        y_map[i].z=0.0f;
+        z_map[i].y=0.0;
+        x_map[i].z=0.0;
+        y_map[i].z=0.0;
         z_map[i].z=(MagickRealType) i;
       }
       break;
index 64801161ec73d3c86326058702ca5e1157805ee8..8f6a6ced0b35024db948ed28209188f1eead2f64 100644 (file)
@@ -88,7 +88,7 @@
 MagickPrivate void ConvertHSBTosRGB(const double hue,const double saturation,
   const double brightness,double *red,double *green,double *blue)
 {
-  MagickRealType
+  double
     f,
     h,
     p,
@@ -103,7 +103,7 @@ MagickPrivate void ConvertHSBTosRGB(const double hue,const double saturation,
   assert(blue != (double *) NULL);
   if (saturation == 0.0)
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*brightness);
+      *red=QuantumRange*brightness;
       *green=(*red);
       *blue=(*red);
       return;
@@ -118,44 +118,44 @@ MagickPrivate void ConvertHSBTosRGB(const double hue,const double saturation,
     case 0:
     default:
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*brightness);
-      *green=(double) ClampToQuantum((MagickRealType) QuantumRange*t);
-      *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*p);
+      *red=QuantumRange*sRGBCompanding(brightness);
+      *green=QuantumRange*sRGBCompanding(t);
+      *blue=QuantumRange*sRGBCompanding(p);
       break;
     }
     case 1:
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*q);
-      *green=(double) ClampToQuantum((MagickRealType) QuantumRange*brightness);
-      *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*p);
+      *red=QuantumRange*sRGBCompanding(q);
+      *green=QuantumRange*sRGBCompanding(brightness);
+      *blue=QuantumRange*sRGBCompanding(p);
       break;
     }
     case 2:
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*p);
-      *green=(double) ClampToQuantum((MagickRealType) QuantumRange*brightness);
-      *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*t);
+      *red=QuantumRange*sRGBCompanding(p);
+      *green=QuantumRange*sRGBCompanding(brightness);
+      *blue=QuantumRange*sRGBCompanding(t);
       break;
     }
     case 3:
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*p);
-      *green=(double) ClampToQuantum((MagickRealType) QuantumRange*q);
-      *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*brightness);
+      *red=QuantumRange*sRGBCompanding(p);
+      *green=QuantumRange*sRGBCompanding(q);
+      *blue=QuantumRange*sRGBCompanding(brightness);
       break;
     }
     case 4:
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*t);
-      *green=(double) ClampToQuantum((MagickRealType) QuantumRange*p);
-      *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*brightness);
+      *red=QuantumRange*sRGBCompanding(t);
+      *green=QuantumRange*sRGBCompanding(p);
+      *blue=QuantumRange*sRGBCompanding(brightness);
       break;
     }
     case 5:
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*brightness);
-      *green=(double) ClampToQuantum((MagickRealType) QuantumRange*p);
-      *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*q);
+      *red=QuantumRange*sRGBCompanding(brightness);
+      *green=QuantumRange*sRGBCompanding(p);
+      *blue=QuantumRange*sRGBCompanding(q);
       break;
     }
   }
@@ -189,8 +189,7 @@ MagickPrivate void ConvertHSBTosRGB(const double hue,const double saturation,
 %
 */
 
-static inline MagickRealType ConvertHueTosRGB(MagickRealType m1,
-  MagickRealType m2,MagickRealType hue)
+static inline double ConvertHueTosRGB(double m1,double m2,double hue)
 {
   if (hue < 0.0)
     hue+=1.0;
@@ -208,7 +207,7 @@ static inline MagickRealType ConvertHueTosRGB(MagickRealType m1,
 MagickExport void ConvertHSLTosRGB(const double hue,const double saturation,
   const double lightness,double *red,double *green,double *blue)
 {
-  MagickRealType
+  double
     b,
     g,
     r,
@@ -223,7 +222,7 @@ MagickExport void ConvertHSLTosRGB(const double hue,const double saturation,
   assert(blue != (double *) NULL);
   if (saturation == 0)
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*lightness);
+      *red=QuantumRange*lightness;
       *green=(*red);
       *blue=(*red);
       return;
@@ -236,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=(double) ClampToQuantum((MagickRealType) QuantumRange*r);
-  *green=(double) ClampToQuantum((MagickRealType) QuantumRange*g);
-  *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*b);
+  *red=QuantumRange*sRGBCompanding(r);
+  *green=QuantumRange*sRGBCompanding(g);
+  *blue=QuantumRange*sRGBCompanding(b);
 }
 \f
 /*
@@ -271,7 +270,7 @@ MagickExport void ConvertHSLTosRGB(const double hue,const double saturation,
 MagickPrivate void ConvertHWBTosRGB(const double hue,const double whiteness,
   const double blackness,double *red,double *green,double *blue)
 {
-  MagickRealType
+  double
     b,
     f,
     g,
@@ -291,9 +290,9 @@ MagickPrivate void ConvertHWBTosRGB(const double hue,const double whiteness,
   v=1.0-blackness;
   if (hue == -1.0)
     {
-      *red=(double) ClampToQuantum((MagickRealType) QuantumRange*v);
-      *green=(double) ClampToQuantum((MagickRealType) QuantumRange*v);
-      *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*v);
+      *red=QuantumRange*sRGBCompanding(v);
+      *green=QuantumRange*sRGBCompanding(v);
+      *blue=QuantumRange*sRGBCompanding(v);
       return;
     }
   i=(ssize_t) floor(6.0*hue);
@@ -312,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=(double) ClampToQuantum((MagickRealType) QuantumRange*r);
-  *green=(double) ClampToQuantum((MagickRealType) QuantumRange*g);
-  *blue=(double) ClampToQuantum((MagickRealType) QuantumRange*b);
+  *red=QuantumRange*sRGBCompanding(r);
+  *green=QuantumRange*sRGBCompanding(g);
+  *blue=QuantumRange*sRGBCompanding(b);
 }
 \f
 /*
@@ -348,10 +347,13 @@ MagickPrivate void ConvertHWBTosRGB(const double hue,const double whiteness,
 MagickPrivate void ConvertsRGBToHSB(const double red,const double green,
   const double blue,double *hue,double *saturation,double *brightness)
 {
-  MagickRealType
+  double
+    b,
     delta,
+    g,
     max,
-    min;
+    min,
+    r;
 
   /*
     Convert RGB to HSB colorspace.
@@ -362,26 +364,29 @@ MagickPrivate void ConvertsRGBToHSB(const double red,const double green,
   *hue=0.0;
   *saturation=0.0;
   *brightness=0.0;
-  min=(MagickRealType) (red < green ? red : green);
-  if ((MagickRealType) blue < min)
-    min=(MagickRealType) blue;
-  max=(MagickRealType) (red > green ? red : green);
-  if ((MagickRealType) blue > max)
-    max=(MagickRealType) blue;
+  r=QuantumRange*sRGBDecompanding(QuantumScale*red);
+  g=QuantumRange*sRGBDecompanding(QuantumScale*green);
+  b=QuantumRange*sRGBDecompanding(QuantumScale*blue);
+  min=r < g ? r : g;
+  if (b < min)
+    min=b;
+  max=r > g ? r : g;
+  if (b > max)
+    max=b;
   if (max == 0.0)
     return;
   delta=max-min;
-  *saturation=(double) (delta/max);
-  *brightness=(double) (QuantumScale*max);
+  *saturation=delta/max;
+  *brightness=QuantumScale*max;
   if (delta == 0.0)
     return;
-  if ((MagickRealType) red == max)
-    *hue=(double) ((green-(MagickRealType) blue)/delta);
+  if (r == max)
+    *hue=(g-b)/delta;
   else
-    if ((MagickRealType) green == max)
-      *hue=(double) (2.0+(blue-(MagickRealType) red)/delta);
+    if (g == max)
+      *hue=2.0+(b-r)/delta;
     else
-      *hue=(double) (4.0+(red-(MagickRealType) green)/delta);
+      *hue=4.0+(r-g)/delta;
   *hue/=6.0;
   if (*hue < 0.0)
     *hue+=1.0;
@@ -433,7 +438,7 @@ static inline double MagickMin(const double x,const double y)
 MagickExport void ConvertsRGBToHSL(const double red,const double green,
   const double blue,double *hue,double *saturation,double *lightness)
 {
-  MagickRealType
+  double
     b,
     delta,
     g,
@@ -447,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=QuantumScale*red;
-  g=QuantumScale*green;
-  b=QuantumScale*blue;
+  r=sRGBDecompanding(QuantumScale*red);
+  g=sRGBDecompanding(QuantumScale*green);
+  b=sRGBDecompanding(QuantumScale*blue);
   max=MagickMax(r,MagickMax(g,b));
   min=MagickMin(r,MagickMin(g,b));
   *lightness=(double) ((min+max)/2.0);
@@ -511,11 +516,12 @@ MagickExport void ConvertsRGBToHSL(const double red,const double green,
 MagickPrivate void ConvertsRGBToHWB(const double red,const double green,
   const double blue,double *hue,double *whiteness,double *blackness)
 {
-  long
-    i;
-
-  MagickRealType
+  double
+    b,
     f,
+    g,
+    p,
+    r,
     v,
     w;
 
@@ -525,10 +531,11 @@ MagickPrivate void ConvertsRGBToHWB(const double red,const double green,
   assert(hue != (double *) NULL);
   assert(whiteness != (double *) NULL);
   assert(blackness != (double *) NULL);
-  w=(MagickRealType) MagickMin((double) red,MagickMin((double) green,(double)
-    blue));
-  v=(MagickRealType) MagickMax((double) red,MagickMax((double) green,(double)
-    blue));
+  r=QuantumRange*sRGBDecompanding(QuantumScale*red);
+  g=QuantumRange*sRGBDecompanding(QuantumScale*green);
+  b=QuantumRange*sRGBDecompanding(QuantumScale*blue);
+  w=MagickMin(r,MagickMin(g,b));
+  v=MagickMax(r,MagickMax(g,b));
   *blackness=1.0-QuantumScale*v;
   *whiteness=QuantumScale*w;
   if (v == w)
@@ -536,11 +543,9 @@ MagickPrivate void ConvertsRGBToHWB(const double red,const double green,
       *hue=(-1.0);
       return;
     }
-  f=((MagickRealType) red == w) ? green-(MagickRealType) blue :
-    (((MagickRealType) green == w) ? blue-(MagickRealType) red : red-
-    (MagickRealType) green);
-  i=((MagickRealType) red == w) ? 3 : (((MagickRealType) green == w) ? 5 : 1);
-  *hue=((double) i-f/(v-1.0*w))/6.0;
+  f=(r == w) ? g-b : ((g == w) ? b-r : r-g);
+  p=(r == w) ? 3.0 : ((g == w) ? 5.0 : 1.0);
+  *hue=(p-f/(v-1.0*w))/6.0;
 }
 \f
 /*
@@ -769,7 +774,7 @@ MagickPrivate size_t GetOptimalKernelWidth1D(const double radius,
   if (gamma <= MagickEpsilon)
     return(3UL);
   alpha=MagickEpsilonReciprocal(2.0*gamma*gamma);
-  beta=(double) MagickEpsilonReciprocal(MagickSQ2PI*gamma);
+  beta=(double) MagickEpsilonReciprocal((MagickRealType) MagickSQ2PI*gamma);
   for (width=5; ; )
   {
     normalize=0.0;
@@ -809,7 +814,7 @@ MagickPrivate size_t GetOptimalKernelWidth2D(const double radius,
   if (gamma <= MagickEpsilon)
     return(3UL);
   alpha=MagickEpsilonReciprocal(2.0*gamma*gamma);
-  beta=(double) MagickEpsilonReciprocal(Magick2PI*gamma*gamma);
+  beta=(double) MagickEpsilonReciprocal((MagickRealType) Magick2PI*gamma*gamma);
   for (width=5; ; )
   {
     normalize=0.0;
index d7bce055c80da5caa6817f2252370896701b94e4..017430791f8117df51a1464af0ac35e06338bb82 100644 (file)
@@ -3780,7 +3780,7 @@ MagickExport MagickBooleanType SyncImage(Image *image,ExceptionInfo *exception)
       status=MagickFalse;
   }
   image_view=DestroyCacheView(image_view);
-  if (range_exception != MagickFalse)
+  if ((image->ping == MagickFalse) && (range_exception != MagickFalse))
     (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError,
       "InvalidColormapIndex","'%s'",image->filename);
   return(status);
index b8099b82757d0977a9d43141f3c652a0354243a2..799ec351d744b787896545c29c10a0fd2f8128ba 100644 (file)
@@ -37,7 +37,7 @@ extern "C" {
 #endif
 
 #if (MAGICKCORE_QUANTUM_DEPTH == 8)
-#define MagickEpsilon  ((MagickRealType) 1.0e-6)
+#define MagickEpsilon  ((MagickRealType) 1.0e-7)
 #define MaxColormapSize  256UL
 #define MaxMap  255UL
 
@@ -56,7 +56,7 @@ typedef unsigned char Quantum;
 #define QuantumFormat  "%u"
 #endif
 #elif (MAGICKCORE_QUANTUM_DEPTH == 16)
-#define MagickEpsilon  ((MagickRealType) 1.0e-10)
+#define MagickEpsilon  ((MagickRealType) 1.0e-16)
 #define MaxColormapSize  65536UL
 #define MaxMap  65535UL
 
@@ -75,7 +75,7 @@ typedef unsigned short Quantum;
 #define QuantumFormat  "%u"
 #endif
 #elif (MAGICKCORE_QUANTUM_DEPTH == 32)
-#define MagickEpsilon  ((MagickRealType) 1.0e-10)
+#define MagickEpsilon  ((MagickRealType) 1.0e-16)
 #define MaxColormapSize  65536UL
 #define MaxMap  65535UL
 
@@ -90,7 +90,7 @@ typedef unsigned int Quantum;
 #define QuantumFormat  "%u"
 #endif
 #elif (MAGICKCORE_QUANTUM_DEPTH == 64) && defined(MAGICKCORE_HAVE_LONG_DOUBLE_WIDER)
-#define MagickEpsilon  ((MagickRealType) 1.0e-10)
+#define MagickEpsilon  ((MagickRealType) 1.0e-16)
 #define MaxColormapSize  65536UL
 #define MaxMap  65535UL
 
index 95d0bf6b0d0680a3e4e3b9193978261365e891bc..26a3d15b39a3945b6acd59a8adc769b267ee032c 100644 (file)
@@ -251,9 +251,9 @@ static inline Quantum GetPixelIntensity(const Image *restrict image,
     return(pixel[image->channel_map[GrayPixelChannel].offset]);
   if (image->colorspace != sRGBColorspace)
     {
-      red=pixel[image->channel_map[RedPixelChannel].offset];
-      green=pixel[image->channel_map[GreenPixelChannel].offset];
-      blue=pixel[image->channel_map[BluePixelChannel].offset];
+      red=(double) pixel[image->channel_map[RedPixelChannel].offset];
+      green=(double) pixel[image->channel_map[GreenPixelChannel].offset];
+      blue=(double) pixel[image->channel_map[BluePixelChannel].offset];
     }
   else
     {
@@ -292,9 +292,9 @@ static inline Quantum GetPixelLuminance(const Image *restrict image,
 
   if (image->colorspace != sRGBColorspace)
     {
-      red=pixel[image->channel_map[RedPixelChannel].offset];
-      green=pixel[image->channel_map[GreenPixelChannel].offset];
-      blue=pixel[image->channel_map[BluePixelChannel].offset];
+      red=(double) pixel[image->channel_map[RedPixelChannel].offset];
+      green=(double) pixel[image->channel_map[GreenPixelChannel].offset];
+      blue=(double) pixel[image->channel_map[BluePixelChannel].offset];
     }
   else
     {
index 172cb5870c258747dbe37f1876e996114f54a3c6..daff7d1caef2997c402fedb31b1fa28a9b202be8 100644 (file)
@@ -66,11 +66,11 @@ testReadCompare('granite:', 'reference/read/granite.miff', q/size=>"70x46"/, 0.0
 
 print("MAT (MatLab gray 8-bit LSB integer) ...\n");
 ++$test;
-testReadCompare('input_gray_lsb_08bit.mat', 'reference/read/input_gray_lsb_08bit_mat.miff', q//, 0.2, 0.9);
+testReadCompare('input_gray_lsb_08bit.mat', 'reference/read/input_gray_lsb_08bit_mat.miff', q//, 0.2, 1.0);
 
 print("MAT (MatLab gray 8-bit MSB integer) ...\n");
 ++$test;
-testReadCompare('input_gray_msb_08bit.mat', 'reference/read/input_gray_msb_08bit_mat.miff', q//, 0.20, 0.9);
+testReadCompare('input_gray_msb_08bit.mat', 'reference/read/input_gray_msb_08bit_mat.miff', q//, 0.20, 1.0);
 
 print("MAT (MatLab gray 64-bit LSB double) ...\n");
 ++$test;
index 70c614196dddb544498125d3da3f8c445001c11e..6170dd3195ea61902f896afbd801d14b8668cc54 100644 (file)
@@ -123,7 +123,7 @@ print("Portable graymap format (gray scale), ASCII format ...\n");
 testReadWrite( 'PGM:input_p2.pgm',
   'PGM:output_p2.pgm',
   q/compression=>'None'/,
-  '7a2979a50795593006e3e2bcc8c5d700bc21faa08de4de3bcb940ab65a980bef');
+  'a52f1015dcd3290c136b892874b0ef06516d28a846a2a7383d896267a5299aba');
 
 print("Apple Macintosh QuickDraw/PICT file ...\n");
 ++$test;
@@ -144,7 +144,7 @@ print("Portable graymap format (gray scale), binary format ...\n");
 testReadWrite( 'PGM:input_p5.pgm',
   'PGM:output_p5.pgm',
   q//,
-  '7a2979a50795593006e3e2bcc8c5d700bc21faa08de4de3bcb940ab65a980bef');
+  'a52f1015dcd3290c136b892874b0ef06516d28a846a2a7383d896267a5299aba');
 
 print("Portable pixmap format (color), binary format ...\n");
 ++$test;
index 48e2d3a5c32fd9c1c3aacb8e2fc4f5df21f5cb86..4f904279f51fe2d384dd4ab68d2e177f68ac1ea8 100644 (file)
@@ -1100,7 +1100,7 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception)
           q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
           if (q == (Quantum *) NULL)
             break;
-          for (x = (ssize_t)image->columns; x != 0; --x)
+          for (x=(ssize_t) image->columns; x != 0; --x)
           {
             index=ConstrainColormapIndex(image,*p++,exception);
             SetPixelIndex(image,index,q);
index 29ac14ab74cec0363c246a5103b9ed74b0f083e8..db31a0df7b216fb60c54248041bc249c806f6439 100644 (file)
@@ -441,8 +441,8 @@ static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     type=ParseCommandOption(MagickColorspaceOptions,MagickFalse,colorspace);
     if (type < 0)
       ThrowReaderException(CorruptImageError,"ImproperImageHeader");
-    image->colorspace=(ColorspaceType) type;
     (void) SetImageBackgroundColor(image,exception);
+    (void) SetImageColorspace(image,(ColorspaceType) type,exception);
     GetPixelInfo(image,&pixel);
     range=GetQuantumRange(image->depth);
     for (y=0; y < (ssize_t) image->rows; y++)