Found a workaround.
If I revert all changes to composite-private.h and readd if fabs then my problems are resolved.
Code: Select all
diff -burN ImageMagick-6.9.1-4/magick/composite-private.h ImageMagick-6.9.1-3/magick/composite-private.h
--- magick/composite-private.h 2015-05-30 02:49:19.000000000 +0200
+++ magick/composite-private.h 2015-04-12 20:09:13.000000000 +0200
@@ -51,9 +51,6 @@
const MagickRealType alpha,const PixelPacket *q,const MagickRealType beta,
PixelPacket *composite)
{
- double
- gamma;
-
MagickRealType
Da,
Sa;
@@ -61,31 +58,24 @@
/*
Compose pixel p over pixel q with the given opacities.
*/
- if (fabs((double) (alpha-TransparentOpacity)) < MagickEpsilon)
- {
- *composite=(*q);
- return;
- }
Sa=1.0-QuantumScale*alpha;
Da=1.0-QuantumScale*beta;
- gamma=Sa*(-Da)+Sa+Da;
- gamma=PerceptibleReciprocal(gamma);
#if !defined(MAGICKCORE_HDRI_SUPPORT)
SetPixelOpacity(composite,(MagickRealType) (QuantumRange*
(1.0-RoundToUnity(Sa+Da-Sa*Da))+0.5));
- SetPixelRed(composite,ClampToQuantum(gamma*MagickOver_((MagickRealType)
- GetPixelRed(p),alpha,(MagickRealType) GetPixelRed(q),beta)));
- SetPixelGreen(composite,ClampToQuantum(gamma*MagickOver_((MagickRealType)
- GetPixelGreen(p),alpha,(MagickRealType) GetPixelGreen(q),beta)));
- SetPixelBlue(composite,ClampToQuantum(gamma*MagickOver_((MagickRealType)
- GetPixelBlue(p),alpha,(MagickRealType) GetPixelBlue(q),beta)));
+ SetPixelRed(composite,MagickOver_((MagickRealType)
+ GetPixelRed(p),alpha,(MagickRealType) GetPixelRed(q),beta)+0.5);
+ SetPixelGreen(composite,MagickOver_((MagickRealType)
+ GetPixelGreen(p),alpha,(MagickRealType) GetPixelGreen(q),beta)+0.5);
+ SetPixelBlue(composite,MagickOver_((MagickRealType)
+ GetPixelBlue(p),alpha,(MagickRealType) GetPixelBlue(q),beta)+0.5);
#else
SetPixelOpacity(composite,QuantumRange*(1.0-RoundToUnity(Sa+Da-Sa*Da)));
- SetPixelRed(composite,gamma*MagickOver_((MagickRealType)
+ SetPixelRed(composite,MagickOver_((MagickRealType)
GetPixelRed(p),alpha,(MagickRealType) GetPixelRed(q),beta));
- SetPixelGreen(composite,gamma*MagickOver_((MagickRealType)
+ SetPixelGreen(composite,MagickOver_((MagickRealType)
GetPixelGreen(p),alpha,(MagickRealType) GetPixelGreen(q),beta));
- SetPixelBlue(composite,gamma*MagickOver_((MagickRealType)
+ SetPixelBlue(composite,MagickOver_((MagickRealType)
GetPixelBlue(p),alpha,(MagickRealType) GetPixelBlue(q),beta));
#endif
}
@@ -94,9 +84,6 @@
const MagickRealType alpha,const MagickPixelPacket *q,
const MagickRealType beta,MagickPixelPacket *composite)
{
- double
- gamma;
-
MagickRealType
Da,
Sa;
@@ -106,15 +93,13 @@
*/
Sa=1.0-QuantumScale*alpha;
Da=1.0-QuantumScale*beta;
- gamma=Sa*(-Da)+Sa+Da;
- gamma=PerceptibleReciprocal(gamma);
composite->opacity=(MagickRealType) (QuantumRange*(1.0-
RoundToUnity(Sa+Da-Sa*Da)));
- composite->red=gamma*MagickOver_(p->red,alpha,q->red,beta);
- composite->green=gamma*MagickOver_(p->green,alpha,q->green,beta);
- composite->blue=gamma*MagickOver_(p->blue,alpha,q->blue,beta);
+ composite->red=MagickOver_(p->red,alpha,q->red,beta);
+ composite->green=MagickOver_(p->green,alpha,q->green,beta);
+ composite->blue=MagickOver_(p->blue,alpha,q->blue,beta);
if (q->colorspace == CMYKColorspace)
- composite->index=gamma*MagickOver_(p->index,alpha,q->index,beta);
+ composite->index=MagickOver_(p->index,alpha,q->index,beta);
}
static inline void MagickPixelCompositePlus(const MagickPixelPacket *p,
But that broke another plugin I got.... never ending story.