]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 5 Jan 2012 12:40:50 +0000 (12:40 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 5 Jan 2012 12:40:50 +0000 (12:40 +0000)
MagickCore/quantum-export.c

index fd8a70fcede2e60884642206a90d36476a588ad2..a45ae90c62b997f6115b3df5b0dafe0efb880c82 100644 (file)
@@ -240,9 +240,6 @@ MagickExport size_t ExportQuantumPixels(Image *image,CacheView *image_view,
   EndianType
     endian;
 
-  MagickRealType
-    alpha;
-
   MagickSizeType
     number_pixels;
 
@@ -290,6 +287,9 @@ MagickExport size_t ExportQuantumPixels(Image *image,CacheView *image_view,
     }
   if (quantum_info->alpha_type == AssociatedQuantumAlpha)
     {
+      MagickRealType
+        Sa;
+
       register Quantum
         *restrict q;
 
@@ -301,11 +301,24 @@ MagickExport size_t ExportQuantumPixels(Image *image,CacheView *image_view,
         q=GetCacheViewAuthenticPixelQueue(image_view);
       for (x=0; x < (ssize_t) image->columns; x++)
       {
-        alpha=QuantumScale*GetPixelAlpha(image,q);
-        SetPixelRed(image,ClampToQuantum(alpha*GetPixelRed(image,q)),q);
-        SetPixelGreen(image,ClampToQuantum(alpha*GetPixelGreen(image,q)),q);
-        SetPixelBlue(image,ClampToQuantum(alpha*GetPixelBlue(image,q)),q);
-        q++;
+        register ssize_t
+          i;
+
+        Sa=QuantumScale*GetPixelAlpha(image,q);
+        for (i=0; i < (ssize_t) channels; i++)
+        {
+          PixelChannel
+            channel;
+
+          PixelTrait
+            traits;
+
+          channel=GetPixelChannelMapChannel(image,i);
+          traits=GetPixelChannelMapTraits(image,channel);
+          if ((traits & UpdatePixelTrait) != 0)
+            q[i]=ClampToQuantum(Sa*q[i]);
+        }
+        q+=channels;
       }
     }
   if ((quantum_type == RGBOQuantum) || (quantum_type == CMYKOQuantum) ||
@@ -320,7 +333,7 @@ MagickExport size_t ExportQuantumPixels(Image *image,CacheView *image_view,
       for (x=0; x < (ssize_t) number_pixels; x++)
       {
         SetPixelAlpha(image,GetPixelAlpha(image,q),q);
-        q++;
+        q+=channels;
       }
     }
   if ((quantum_type == CbYCrQuantum) || (quantum_type == CbYCrAQuantum))