#include "MagickCore/string_.h"
#include "MagickCore/thread-private.h"
#include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
#include "MagickCore/version.h"
\f
/*
% %
% %
% %
-% C o m p o s i t e I m a g e C h a n n e l %
+% C o m p o s i t e I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% CompositeImageChannel() returns the second image composited onto the first
+% CompositeImage() returns the second image composited onto the first
% at the specified offset, using the specified composite method.
%
-% The format of the CompositeImageChannel method is:
+% The format of the CompositeImage method is:
%
% MagickBooleanType CompositeImage(Image *image,
% const CompositeOperator compose,Image *composite_image,
-% const ssize_t x_offset,const ssize_t y_offset)
-% MagickBooleanType CompositeImageChannel(Image *image,
-% const ChannelType channel,const CompositeOperator compose,
-% Image *composite_image,const ssize_t x_offset,const ssize_t y_offset)
+% const ssize_t x_offset,const ssize_t y_offset,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the destination image, modified by he composition
%
-% o channel: the channel.
-%
% o compose: This operator affects how the composite is applied to
% the image. The operators and how they are utilized are listed here
% http://www.w3.org/TR/SVG12/#compositing.
%
% Previous to IM v6.5.3-3 this was called "modify-outside-overlay"
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static inline double MagickMin(const double x,const double y)
return(MagickOver_(q,beta,p,alpha)); /* dst-over */
}
-static inline void CompositeDarken(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeDarken(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
gamma;
Darken is equivalent to a 'Minimum' method OR a greyscale version of a
binary 'Or' OR the 'Intersection' of pixel sets.
*/
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=MagickMin(p->red,q->red);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=MagickMin(p->green,q->green);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=MagickMin(p->blue,q->blue);
- if ((channel & BlackChannel) != 0 &&
+ if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0 &&
(q->colorspace == CMYKColorspace))
composite->black=MagickMin(p->black,q->black);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=MagickMax(p->alpha,q->alpha);
return;
}
composite->black=gamma*Darken(p->black,p->alpha,q->black,q->alpha);
}
-static inline void CompositeDarkenIntensity(const PixelInfo *p,
- const PixelInfo *q,const ChannelType channel,PixelInfo *composite)
+static inline void CompositeDarkenIntensity(const Image *image,
+ const PixelInfo *p,const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
If 'Sync' flag select whole pixel based on alpha weighted intensity.
Otherwise use intensity only, but restrict copy according to channel.
*/
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
MagickBooleanType
from_p;
from_p=GetPixelInfoIntensity(p) < GetPixelInfoIntensity(q) ? MagickTrue :
MagickFalse;
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=from_p != MagickFalse ? p->red : q->red;
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=from_p != MagickFalse ? p->green : q->green;
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=from_p != MagickFalse ? p->blue : q->blue;
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=from_p != MagickFalse ? p->black : q->black;
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=from_p != MagickFalse ? p->alpha : q->alpha;
return;
}
return(Sa*p+Da*q-Sa*Da*2.0*MagickMin(p,q));
}
-static inline void CompositeDifference(const PixelInfo *p,
- const PixelInfo *q,const ChannelType channel,PixelInfo *composite)
+static inline void CompositeDifference(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
Sa=QuantumScale*p->alpha; /* simplify and speed up equations */
Da=QuantumScale*q->alpha;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=fabs((double) (p->red-q->red));
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=fabs((double) (p->green-q->green));
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=fabs((double) (p->blue-q->blue));
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=fabs((double) (p->black-q->black));
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=fabs((double) (p->alpha-q->alpha));
return;
}
return(Sca*Da*Da/Dca+Sca*(1.0-Da)+Dca*(1.0-Sa));
}
-static inline void CompositeDivide(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeDivide(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
Sa=QuantumScale*p->alpha; /* simplify and speed up equations */
Da=QuantumScale*q->alpha;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=QuantumRange*Divide(QuantumScale*p->red,1.0,
QuantumScale*q->red,1.0);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=QuantumRange*Divide(QuantumScale*p->green,1.0,
QuantumScale*q->green,1.0);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=QuantumRange*Divide(QuantumScale*p->blue,1.0,
QuantumScale*q->blue,1.0);
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=QuantumRange*Divide(QuantumScale*p->black,1.0,
QuantumScale*q->black,1.0);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=QuantumRange*(1.0-Divide(Sa,1.0,Da,1.0));
return;
}
return(Sca*Da+Dca*Sa-2.0*Sca*Dca+Sca*(1.0-Da)+Dca*(1.0-Sa));
}
-static inline void CompositeExclusion(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeExclusion(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
gamma,
Sa=QuantumScale*p->alpha; /* simplify and speed up equations */
Da=QuantumScale*q->alpha;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=QuantumRange*Exclusion(QuantumScale*p->red,1.0,
QuantumScale*q->red,1.0);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=QuantumRange*Exclusion(QuantumScale*p->green,1.0,
QuantumScale*q->green,1.0);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=QuantumRange*Exclusion(QuantumScale*p->blue,1.0,
QuantumScale*q->blue,1.0);
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=QuantumRange*Exclusion(QuantumScale*p->black,1.0,
QuantumScale*q->black,1.0);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=QuantumRange*(1.0-Exclusion(Sa,1.0,Da,1.0));
return;
}
*hue=0.0;
*saturation=0.0;
*brightness=(double) (QuantumScale*max);
- if (max == 0.0)
+ if (fabs(max) < MagickEpsilon)
return;
*saturation=(double) (1.0-min/max);
delta=max-min;
- if (delta == 0.0)
+ if (fabs(delta) < MagickEpsilon)
return;
- if (red == max)
+ if (fabs(red-max) < MagickEpsilon)
*hue=(double) ((green-blue)/delta);
else
- if (green == max)
+ if (fabs(green-max) < MagickEpsilon)
*hue=(double) (2.0+(blue-red)/delta);
else
- if (blue == max)
+ if (fabs(blue-max) < MagickEpsilon)
*hue=(double) (4.0+(red-green)/delta);
*hue/=6.0;
if (*hue < 0.0)
return(MagickOver_(q,beta,p,alpha)); /* dst-over */
}
-static inline void CompositeLighten(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeLighten(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
gamma;
Lighten is also equvalent to a 'Maximum' method OR a greyscale version of a
binary 'And' OR the 'Union' of pixel sets.
*/
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=MagickMax(p->red,q->red);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=MagickMax(p->green,q->green);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=MagickMax(p->blue,q->blue);
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=MagickMax(p->black,q->black);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=MagickMin(p->alpha,q->alpha);
return;
}
composite->black=gamma*Lighten(p->black,p->alpha,q->black,q->alpha);
}
-static inline void CompositeLightenIntensity(const PixelInfo *p,
- const PixelInfo *q,const ChannelType channel,PixelInfo *composite)
+static inline void CompositeLightenIntensity(const Image *image,
+ const PixelInfo *p,const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
If 'Sync' flag select whole pixel based on alpha weighted intensity.
Otherwise use Intenisty only, but restrict copy according to channel.
*/
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
MagickBooleanType
from_p;
from_p=GetPixelInfoIntensity(p) > GetPixelInfoIntensity(q) ? MagickTrue :
MagickFalse;
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=from_p != MagickFalse ? p->red : q->red;
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=from_p != MagickFalse ? p->green : q->green;
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=from_p != MagickFalse ? p->blue : q->blue;
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=from_p != MagickFalse ? p->black : q->black;
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=from_p != MagickFalse ? p->alpha : q->alpha;
return;
}
return(gamma);
}
-static inline void CompositeMathematics(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel, const GeometryInfo *args, PixelInfo *composite)
+static inline void CompositeMathematics(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,const GeometryInfo *args,PixelInfo *composite)
{
MagickRealType
Da,
Sa=QuantumScale*p->alpha; /* ??? - AT */
Da=QuantumScale*q->alpha;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=QuantumRange*Mathematics(QuantumScale*p->red,1.0,
QuantumScale*q->red,1.0,args);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=QuantumRange*Mathematics(QuantumScale*p->green,1.0,
QuantumScale*q->green,1.0,args);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=QuantumRange*Mathematics(QuantumScale*p->blue,1.0,
QuantumScale*q->blue,1.0,args);
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=QuantumRange*Mathematics(QuantumScale*p->black,1.0,
QuantumScale*q->black,1.0,args);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=QuantumRange*(1.0-Mathematics(Sa,1.0,Da,1.0,args));
return;
}
QuantumScale*q->black*Da,Da,args);
}
-static inline void CompositePlus(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositePlus(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
/*
NOTE: "Plus" does not use 'over' alpha-blending but uses a special
The CompositePixelInfoPlus() function is defined in
"composite-private.h" so it can also be used for Image Blending.
*/
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=p->red+q->red;
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=p->green+q->green;
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=p->blue+q->blue;
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=p->black+q->black;
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=p->alpha+q->alpha-QuantumRange;
return;
}
return(Sca+Dca-2.0*Dca*Sa);
}
-static inline void CompositeMinus(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeMinus(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
Sa=QuantumScale*p->alpha; /* simplify and speed up equations */
Da=QuantumScale*q->alpha;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=p->red-q->red;
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=p->green-q->green;
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=p->blue-q->blue;
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=p->black-q->black;
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=QuantumRange*(1.0-(Sa-Da));
return;
}
return(pixel*Sa*Da+p*Sa*(1.0-Da)+q*Da*(1.0-Sa));
}
-static inline void CompositeModulusAdd(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeModulusAdd(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
gamma,
Sa;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=ModulusAdd(p->red,1.0,q->red,1.0);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=ModulusAdd(p->green,1.0,q->green,1.0);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=ModulusAdd(p->blue,1.0,q->blue,1.0);
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=ModulusAdd(p->black,1.0,q->black,1.0);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=ModulusAdd(p->alpha,1.0,q->alpha,1.0);
return;
}
return(pixel*Sa*Da+p*Sa*(1.0-Da)+q*Da*(1.0-Sa));
}
-static inline void CompositeModulusSubtract(const PixelInfo *p,
- const PixelInfo *q, const ChannelType channel,PixelInfo *composite)
+static inline void CompositeModulusSubtract(const Image *image,
+ const PixelInfo *p,const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
gamma,
Sa;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels,
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=ModulusSubtract(p->red,1.0,q->red,1.0);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=ModulusSubtract(p->green,1.0,q->green,1.0);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=ModulusSubtract(p->blue,1.0,q->blue,1.0);
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=ModulusSubtract(p->black,1.0,q->black,1.0);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=ModulusSubtract(p->alpha,1.0,q->alpha,1.0);
return;
}
return(Sca*Dca+Sca*(1.0-Da)+Dca*(1.0-Sa));
}
-static inline void CompositeMultiply(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeMultiply(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
Sa=QuantumScale*p->alpha; /* simplify and speed up equations */
Da=QuantumScale*q->alpha;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=QuantumScale*p->red*q->red;
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=QuantumScale*p->green*q->green;
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=QuantumScale*p->blue*q->blue;
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=QuantumScale*p->black*q->black;
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=QuantumRange*(1.0-Sa*Da);
return;
}
return(Sca+Dca-Sca*Dca);
}
-static inline void CompositeScreen(const PixelInfo *p,const PixelInfo *q,
- const ChannelType channel,PixelInfo *composite)
+static inline void CompositeScreen(const Image *image,const PixelInfo *p,
+ const PixelInfo *q,PixelInfo *composite)
{
MagickRealType
Da,
Sa=QuantumScale*p->alpha; /* simplify and speed up equations */
Da=QuantumScale*q->alpha;
- if ((channel & SyncChannels) == 0)
+ if (image->sync == MagickFalse)
{
/*
Handle channels as separate grayscale channels.
*/
- if ((channel & RedChannel) != 0)
+ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
composite->red=QuantumRange*Screen(QuantumScale*p->red,
QuantumScale*q->red);
- if ((channel & GreenChannel) != 0)
+ if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
composite->green=QuantumRange*Screen(QuantumScale*p->green,
QuantumScale*q->green);
- if ((channel & BlueChannel) != 0)
+ if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
composite->blue=QuantumRange*Screen(QuantumScale*p->blue,
QuantumScale*q->blue);
- if (((channel & BlackChannel) != 0) &&
+ if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
(q->colorspace == CMYKColorspace))
composite->black=QuantumRange*Screen(QuantumScale*p->black,
QuantumScale*q->black);
- if ((channel & AlphaChannel) != 0)
+ if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
composite->alpha=QuantumRange*(1.0-Screen(Sa,Da));
return;
}
MagickExport MagickBooleanType CompositeImage(Image *image,
const CompositeOperator compose,const Image *composite_image,
- const ssize_t x_offset,const ssize_t y_offset)
-{
- MagickBooleanType
- status;
-
- status=CompositeImageChannel(image,DefaultChannels,compose,composite_image,
- x_offset,y_offset);
- return(status);
-}
-
-MagickExport MagickBooleanType CompositeImageChannel(Image *image,
- const ChannelType channel,const CompositeOperator compose,
- const Image *composite_image,const ssize_t x_offset,const ssize_t y_offset)
+ const ssize_t x_offset,const ssize_t y_offset,ExceptionInfo *exception)
{
#define CompositeImageTag "Composite/Image"
double
sans;
- ExceptionInfo
- *exception;
-
GeometryInfo
geometry_info;
MagickOffsetType
progress;
- PixelInfo
- zero;
-
MagickRealType
amount,
destination_dissolve,
MagickStatusType
flags;
+ PixelInfo
+ zero;
+
ssize_t
y;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(composite_image != (Image *) NULL);
assert(composite_image->signature == MagickSignature);
- if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
GetPixelInfo(image,&zero);
destination_image=(Image *) NULL;
if ((y_offset+(ssize_t) composite_image->rows) >= (ssize_t) image->rows)
break;
status=MagickTrue;
- exception=(&image->exception);
image_view=AcquireCacheView(image);
composite_view=AcquireCacheView(composite_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
channel to exist, to add transparency.
*/
if (image->matte == MagickFalse)
- (void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
+ (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
modify_outside_overlay=MagickTrue;
break;
}
Y = green_channel; compose:args = x_scale[,y_scale[,angle]].
*/
destination_image=CloneImage(image,image->columns,image->rows,MagickTrue,
- &image->exception);
+ exception);
if (destination_image == (Image *) NULL)
return(MagickFalse);
/*
Blur Image by resampling.
*/
pixel=zero;
- exception=(&image->exception);
- resample_filter=AcquireResampleFilter(image,&image->exception);
+ resample_filter=AcquireResampleFilter(image,exception);
SetResampleFilter(resample_filter,CubicFilter,2.0);
destination_view=AcquireCacheView(destination_image);
composite_view=AcquireCacheView(composite_image);
p=GetCacheViewVirtualPixels(composite_view,0,y,composite_image->columns,
1,exception);
q=QueueCacheViewAuthenticPixels(destination_view,0,y,
- destination_image->columns,1,&image->exception);
+ destination_image->columns,1,exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
break;
for (x=0; x < (ssize_t) composite_image->columns; x++)
compose:args = x_scale[,y_scale[,center.x,center.y]]
*/
destination_image=CloneImage(image,image->columns,image->rows,MagickTrue,
- &image->exception);
+ exception);
if (destination_image == (Image *) NULL)
return(MagickFalse);
SetGeometryInfo(&geometry_info);
displacement/distortion map. -- Like a lens...
*/
pixel=zero;
- exception=(&image->exception);
image_view=AcquireCacheView(image);
destination_view=AcquireCacheView(destination_image);
composite_view=AcquireCacheView(composite_image);
p=GetCacheViewVirtualPixels(composite_view,0,y,composite_image->columns,
1,exception);
q=QueueCacheViewAuthenticPixels(destination_view,0,y,
- destination_image->columns,1,&image->exception);
+ destination_image->columns,1,exception);
if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
break;
for (x=0; x < (ssize_t) composite_image->columns; x++)
progress=0;
midpoint=((MagickRealType) QuantumRange+1.0)/2;
GetPixelInfo(composite_image,&zero);
- exception=(&image->exception);
image_view=AcquireCacheView(image);
composite_view=AcquireCacheView(composite_image);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
p-=x_offset*GetPixelChannels(composite_image);
}
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
{
status=MagickFalse;
continue;
}
case PlusCompositeOp:
{
- CompositePlus(&source,&destination,channel,&composite);
+ CompositePlus(image,&source,&destination,&composite);
break;
}
case MinusDstCompositeOp:
{
- CompositeMinus(&source,&destination,channel,&composite);
+ CompositeMinus(image,&source,&destination,&composite);
break;
}
case MinusSrcCompositeOp:
{
- CompositeMinus(&destination,&source,channel,&composite);
+ CompositeMinus(image,&destination,&source,&composite);
break;
}
case ModulusAddCompositeOp:
{
- CompositeModulusAdd(&source,&destination,channel,&composite);
+ CompositeModulusAdd(image,&source,&destination,&composite);
break;
}
case ModulusSubtractCompositeOp:
{
- CompositeModulusSubtract(&source,&destination,channel,&composite);
+ CompositeModulusSubtract(image,&source,&destination,&composite);
break;
}
case DifferenceCompositeOp:
{
- CompositeDifference(&source,&destination,channel,&composite);
+ CompositeDifference(image,&source,&destination,&composite);
break;
}
case ExclusionCompositeOp:
{
- CompositeExclusion(&source,&destination,channel,&composite);
+ CompositeExclusion(image,&source,&destination,&composite);
break;
}
case MultiplyCompositeOp:
{
- CompositeMultiply(&source,&destination,channel,&composite);
+ CompositeMultiply(image,&source,&destination,&composite);
break;
}
case ScreenCompositeOp:
{
- CompositeScreen(&source,&destination,channel,&composite);
+ CompositeScreen(image,&source,&destination,&composite);
break;
}
case DivideDstCompositeOp:
{
- CompositeDivide(&source,&destination,channel,&composite);
+ CompositeDivide(image,&source,&destination,&composite);
break;
}
case DivideSrcCompositeOp:
{
- CompositeDivide(&destination,&source,channel,&composite);
+ CompositeDivide(image,&destination,&source,&composite);
break;
}
case DarkenCompositeOp:
{
- CompositeDarken(&source,&destination,channel,&composite);
+ CompositeDarken(image,&source,&destination,&composite);
break;
}
case LightenCompositeOp:
{
- CompositeLighten(&source,&destination,channel,&composite);
+ CompositeLighten(image,&source,&destination,&composite);
break;
}
case DarkenIntensityCompositeOp:
{
- CompositeDarkenIntensity(&source,&destination,channel,&composite);
+ CompositeDarkenIntensity(image,&source,&destination,&composite);
break;
}
case LightenIntensityCompositeOp:
{
- CompositeLightenIntensity(&source,&destination,channel,&composite);
+ CompositeLightenIntensity(image,&source,&destination,&composite);
break;
}
case MathematicsCompositeOp:
{
- CompositeMathematics(&source,&destination,channel,&geometry_info,
+ CompositeMathematics(image,&source,&destination,&geometry_info,
&composite);
break;
}
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp critical (MagickCore_CompositeImageChannel)
+ #pragma omp critical (MagickCore_CompositeImage)
#endif
proceed=SetImageProgress(image,CompositeImageTag,progress++,
image->rows);
%
% The format of the TextureImage method is:
%
-% MagickBooleanType TextureImage(Image *image,const Image *texture)
+% MagickBooleanType TextureImage(Image *image,const Image *texture,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o texture: This image is the texture to layer on the background.
%
*/
-MagickExport MagickBooleanType TextureImage(Image *image,const Image *texture)
+MagickExport MagickBooleanType TextureImage(Image *image,const Image *texture,
+ ExceptionInfo *exception)
{
#define TextureImageTag "Texture/Image"
*image_view,
*texture_view;
- ExceptionInfo
- *exception;
-
MagickBooleanType
status;
if (texture == (const Image *) NULL)
return(MagickFalse);
(void) SetImageVirtualPixelMethod(texture,TileVirtualPixelMethod);
- if (SetImageStorageClass(image,DirectClass) == MagickFalse)
+ if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
status=MagickTrue;
if ((image->compose != CopyCompositeOp) &&
thread_status;
thread_status=CompositeImage(image,image->compose,texture,x+
- texture->tile_offset.x,y+texture->tile_offset.y);
+ texture->tile_offset.x,y+texture->tile_offset.y,exception);
if (thread_status == MagickFalse)
{
status=thread_status;
Tile texture onto the image background (optimized).
*/
status=MagickTrue;
- exception=(&image->exception);
image_view=AcquireCacheView(image);
texture_view=AcquireCacheView(texture);
#if defined(MAGICKCORE_OPENMP_SUPPORT)