From: dirk Date: Mon, 11 Jul 2016 18:53:14 +0000 (+0200) Subject: Fixed rotational blur for images with an alpha channel. X-Git-Tag: 7.0.2-5~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27b8b3308c514849ba6c6ababc5d1e1265cbff38;p=imagemagick Fixed rotational blur for images with an alpha channel. --- diff --git a/MagickCore/effect.c b/MagickCore/effect.c index 7a4b36530..87bbb1913 100644 --- a/MagickCore/effect.c +++ b/MagickCore/effect.c @@ -2942,7 +2942,8 @@ MagickExport Image *RotationalBlurImage(const Image *image,const double angle, } gamma=0.0; pixel=0.0; - if ((blur_traits & BlendPixelTrait) == 0) + if ((GetPixelChannelTraits(image,AlphaChannel) == UndefinedPixelTrait) || + (channel == AlphaChannel)) { for (j=0; j < (ssize_t) n; j+=(ssize_t) step) { @@ -2964,6 +2965,9 @@ MagickExport Image *RotationalBlurImage(const Image *image,const double angle, } for (j=0; j < (ssize_t) n; j+=(ssize_t) step) { + double + alpha; + r=GetCacheViewVirtualPixels(radial_view, (ssize_t) (blur_center.x+ center.x*cos_theta[j]-center.y*sin_theta[j]+0.5),(ssize_t) (blur_center.y+center.x*sin_theta[j]+center.y*cos_theta[j]+0.5), @@ -2973,8 +2977,9 @@ MagickExport Image *RotationalBlurImage(const Image *image,const double angle, status=MagickFalse; continue; } - pixel+=GetPixelAlpha(image,r)*r[i]; - gamma+=GetPixelAlpha(image,r); + alpha=(double) QuantumScale*GetPixelAlpha(image,r); + pixel+=alpha*r[i]; + gamma+=alpha; } gamma=PerceptibleReciprocal(gamma); SetPixelChannel(blur_image,channel,ClampToQuantum(gamma*pixel),q);