From: cristy Date: Thu, 5 Jan 2012 12:40:50 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6457 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0701c478be9390e70fc2c2fac7b2aec71642745;p=imagemagick --- diff --git a/MagickCore/quantum-export.c b/MagickCore/quantum-export.c index fd8a70fce..a45ae90c6 100644 --- a/MagickCore/quantum-export.c +++ b/MagickCore/quantum-export.c @@ -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))