% MagickCore Image Composite Methods %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
#include "MagickCore/cache.h"
#include "MagickCore/cache-private.h"
#include "MagickCore/cache-view.h"
+#include "MagickCore/channel.h"
#include "MagickCore/client.h"
#include "MagickCore/color.h"
#include "MagickCore/color-private.h"
h,
m,
r,
- x,
- z;
+ x;
/*
Convert HCL to RGB colorspace.
b=x;
}
m=luma-(0.298839*r+0.586811*g+0.114350*b);
- z=1.0;
- if (m < 0.0)
- {
- z=luma/(luma-m);
- m=0.0;
- }
- else
- if (m+c > 1.0)
- {
- z=(1.0-luma)/(m+c-luma);
- m=1.0-z*c;
- }
- *red=QuantumRange*(z*r+m);
- *green=QuantumRange*(z*g+m);
- *blue=QuantumRange*(z*b+m);
+ *red=QuantumRange*(r+m);
+ *green=QuantumRange*(g+m);
+ *blue=QuantumRange*(b+m);
}
static void CompositeHCL(const MagickRealType red,const MagickRealType green,
}
case ColorDodgeCompositeOp:
{
- if ((fabs(Sca-Sa) < MagickEpsilon) && (fabs(Dca) < MagickEpsilon))
- {
- pixel=QuantumRange*gamma*(Sca*(1.0-Da)+Dca*(1.0-Sa));
- break;
- }
- if (fabs(Sca-Sa) < MagickEpsilon)
+ if ((Sca*Da+Dca*Sa) >= Sa*Da)
{
pixel=QuantumRange*gamma*(Sa*Da+Sca*(1.0-Da)+Dca*(1.0-Sa));
break;
case CopyBlackCompositeOp:
{
if (channel == BlackPixelChannel)
- pixel=(MagickRealType) GetPixelBlack(composite_image,p);
+ pixel=(MagickRealType) (QuantumRange-
+ GetPixelBlack(composite_image,p));
break;
}
case CopyBlueCompositeOp:
{
pixel=Sc+Dc;
if (pixel > QuantumRange)
- pixel-=(QuantumRange+1.0);
- pixel=gamma*(pixel*Sa*Da+Sa*Sc*(1.0-Da)+Da*Dc*(1.0-Sa));
+ pixel-=QuantumRange;
+ pixel=gamma*(Sa*Da*pixel+Sa*Sc*(1.0-Da)+Da*Dc*(1.0-Sa));
break;
}
case ModulusSubtractCompositeOp:
{
pixel=Sc-Dc;
if (pixel < 0.0)
- pixel+=(QuantumRange+1.0);
- pixel=gamma*(pixel*Sa*Da+Sa*Sc*(1.0-Da)+Da*Dc*(1.0-Sa));
+ pixel+=QuantumRange;
+ pixel=gamma*(Sa*Da*pixel+Sa*Sc*(1.0-Da)+Da*Dc*(1.0-Sa));
break;
}
case MultiplyCompositeOp: