% 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"
r=c;
b=x;
}
- m=luma-(0.298839f*r+0.586811f*g+0.114350f*b);
+ m=luma-(0.298839*r+0.586811*g+0.114350*b);
*red=QuantumRange*(r+m);
*green=QuantumRange*(g+m);
*blue=QuantumRange*(b+m);
h=0.0;
else
if (red == max)
- h=fmod(6.0+(g-b)/c,6.0);
+ h=fmod((g-b)/c+6.0,6.0);
else
if (green == max)
h=((b-r)/c)+2.0;
h=((r-g)/c)+4.0;
*hue=(h/6.0);
*chroma=QuantumScale*c;
- *luma=QuantumScale*(0.298839f*r+0.586811f*g+0.114350f*b);
+ *luma=QuantumScale*(0.298839*r+0.586811*g+0.114350*b);
}
static MagickBooleanType CompositeOverImage(Image *image,
Sc: source color.
Dc: destination color.
*/
- if (GetPixelMask(image,q) != 0)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
Sa: normalized source alpha.
Da: normalized destination alpha.
*/
- if (GetPixelMask(composite_image,p) != 0)
+ if (GetPixelReadMask(composite_image,p) == 0)
{
p+=GetPixelChannels(composite_image);
channels=GetPixelChannels(composite_image);
register ssize_t
i;
- if (GetPixelMask(composite_image,p) != 0)
+ if (GetPixelReadMask(composite_image,p) == 0)
{
p+=GetPixelChannels(composite_image);
q+=GetPixelChannels(image);
*/
(void) GetOneVirtualPixel(composite_image,x-x_offset,y-y_offset,
source,exception);
- if (GetPixelMask(image,q) != 0)
+ if (GetPixelReadMask(image,q) == 0)
{
q+=GetPixelChannels(image);
continue;
break;
}
}
- if (GetPixelMask(image,q) != 0)
+ if (GetPixelReadMask(image,q) == 0)
{
p+=GetPixelChannels(composite_image);
q+=GetPixelChannels(image);
}
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:
exception);
status=MagickTrue;
if ((image->compose != CopyCompositeOp) &&
- ((image->compose != OverCompositeOp) || (image->alpha_trait == BlendPixelTrait) ||
+ ((image->compose != OverCompositeOp) ||
+ (image->alpha_trait == BlendPixelTrait) ||
(texture_image->alpha_trait == BlendPixelTrait)))
{
/*
register ssize_t
i;
- if (GetPixelMask(image,q) != 0)
+ if (GetPixelReadMask(image,q) == 0)
{
p+=GetPixelChannels(texture_image);
q+=GetPixelChannels(image);