PixelChannel \
channel; \
\
- switch (GetPixelChannelMapChannel(image,i)) \
+ switch (GetPixelChannelChannel(image,i)) \
{ \
case RedPixelChannel: \
{ \
default: \
name="undefined"; \
} \
- channel=GetPixelChannelMapChannel(image,i); \
+ channel=GetPixelChannelChannel(image,i); \
*traits='\0'; \
- if ((GetPixelChannelMapTraits(image,channel) & UpdatePixelTrait) != 0) \
+ if ((GetPixelChannelTraits(image,channel) & UpdatePixelTrait) != 0) \
(void) ConcatenateMagickString(traits,"update,",MaxTextExtent); \
- if ((GetPixelChannelMapTraits(image,channel) & BlendPixelTrait) != 0) \
+ if ((GetPixelChannelTraits(image,channel) & BlendPixelTrait) != 0) \
(void) ConcatenateMagickString(traits,"blend,",MaxTextExtent); \
- if ((GetPixelChannelMapTraits(image,channel) & CopyPixelTrait) != 0) \
+ if ((GetPixelChannelTraits(image,channel) & CopyPixelTrait) != 0) \
(void) ConcatenateMagickString(traits,"copy,",MaxTextExtent); \
if (*traits == '\0') \
(void) ConcatenateMagickString(traits,"undefined,",MaxTextExtent); \
%
*/
-static void ExportCharPixel(const Image *image,const RectangleInfo *roi,
+static void ExportCharPixel(Image *image,const RectangleInfo *roi,
const char *restrict map,const QuantumType *quantum_map,void *pixels,
ExceptionInfo *exception)
{
}
}
-static void ExportDoublePixel(const Image *image,const RectangleInfo *roi,
+static void ExportDoublePixel(Image *image,const RectangleInfo *roi,
const char *restrict map,const QuantumType *quantum_map,void *pixels,
ExceptionInfo *exception)
{
}
}
-static void ExportFloatPixel(const Image *image,const RectangleInfo *roi,
+static void ExportFloatPixel(Image *image,const RectangleInfo *roi,
const char *restrict map,const QuantumType *quantum_map,void *pixels,
ExceptionInfo *exception)
{
}
}
-static void ExportLongPixel(const Image *image,const RectangleInfo *roi,
+static void ExportLongPixel(Image *image,const RectangleInfo *roi,
const char *restrict map,const QuantumType *quantum_map,void *pixels,
ExceptionInfo *exception)
{
}
}
-static void ExportLongLongPixel(const Image *image,const RectangleInfo *roi,
+static void ExportLongLongPixel(Image *image,const RectangleInfo *roi,
const char *restrict map,const QuantumType *quantum_map,void *pixels,
ExceptionInfo *exception)
{
}
}
-static void ExportQuantumPixel(const Image *image,const RectangleInfo *roi,
+static void ExportQuantumPixel(Image *image,const RectangleInfo *roi,
const char *restrict map,const QuantumType *quantum_map,void *pixels,
ExceptionInfo *exception)
{
}
}
-static void ExportShortPixel(const Image *image,const RectangleInfo *roi,
+static void ExportShortPixel(Image *image,const RectangleInfo *roi,
const char *restrict map,const QuantumType *quantum_map,void *pixels,
ExceptionInfo *exception)
{
}
}
-MagickExport MagickBooleanType ExportImagePixels(const Image *image,
+MagickExport MagickBooleanType ExportImagePixels(Image *image,
const ssize_t x,const ssize_t y,const size_t width,const size_t height,
const char *map,const StorageType type,void *pixels,ExceptionInfo *exception)
{
{
pixel->storage_class=DirectClass;
pixel->colorspace=sRGBColorspace;
- pixel->matte=MagickFalse;
+ pixel->alpha_trait=UndefinedPixelTrait;
pixel->fuzz=0.0;
pixel->depth=MAGICKCORE_QUANTUM_DEPTH;
pixel->red=0.0;
pixel->green=0.0;
pixel->blue=0.0;
pixel->black=0.0;
- pixel->alpha=(MagickRealType) OpaqueAlpha;
+ pixel->alpha=(double) OpaqueAlpha;
pixel->index=0.0;
if (image == (const Image *) NULL)
return;
pixel->storage_class=image->storage_class;
pixel->colorspace=image->colorspace;
- pixel->matte=image->matte;
+ pixel->alpha_trait=image->alpha_trait;
pixel->depth=image->depth;
pixel->fuzz=image->fuzz;
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelAlpha(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
p++;
q+=GetPixelChannels(image);
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelGray(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGray(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelAlpha(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
case RedQuantum:
case CyanQuantum:
{
- SetPixelRed(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case GreenQuantum:
case MagentaQuantum:
{
- SetPixelGreen(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case BlueQuantum:
case YellowQuantum:
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case AlphaQuantum:
{
- SetPixelAlpha(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case OpacityQuantum:
{
- SetPixelAlpha(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case BlackQuantum:
{
- SetPixelBlack(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelBlack(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case IndexQuantum:
{
- SetPixelGray(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelGray(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
default:
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelAlpha(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
p++;
q+=GetPixelChannels(image);
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelGray(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGray(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelRed(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelAlpha(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
break;
for (x=0; x < (ssize_t) roi->width; x++)
{
- SetPixelRed(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelGreen(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
- SetPixelBlue(image,ClampToQuantum((MagickRealType) QuantumRange*
- (*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
p++;
q+=GetPixelChannels(image);
}
case RedQuantum:
case CyanQuantum:
{
- SetPixelRed(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelRed(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case GreenQuantum:
case MagentaQuantum:
{
- SetPixelGreen(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelGreen(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case BlueQuantum:
case YellowQuantum:
{
- SetPixelBlue(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelBlue(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case AlphaQuantum:
{
- SetPixelAlpha(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case OpacityQuantum:
{
- SetPixelAlpha(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelAlpha(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case BlackQuantum:
{
- SetPixelBlack(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelBlack(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
case IndexQuantum:
{
- SetPixelGray(image,ClampToQuantum((MagickRealType)
- QuantumRange*(*p)),q);
+ SetPixelGray(image,ClampToQuantum(QuantumRange*(*p)),q);
break;
}
default:
case 'A':
{
quantum_map[i]=AlphaQuantum;
- image->matte=MagickTrue;
+ image->alpha_trait=BlendPixelTrait;
break;
}
case 'B':
case 'i':
{
quantum_map[i]=IndexQuantum;
+ (void) SetImageColorspace(image,GRAYColorspace,exception);
break;
}
case 'm':
case 'o':
{
quantum_map[i]=OpacityQuantum;
- image->matte=MagickTrue;
+ image->alpha_trait=BlendPixelTrait;
break;
}
case 'P':
(void) ResetMagickMemory(image->channel_map,0,MaxPixelChannels*
sizeof(*image->channel_map));
trait=UpdatePixelTrait;
- if (image->matte != MagickFalse)
+ if (image->alpha_trait == BlendPixelTrait)
trait=(PixelTrait) (trait | BlendPixelTrait);
n=0;
if (image->colorspace == GRAYColorspace)
{
- SetPixelChannelMap(image,BluePixelChannel,trait,n);
- SetPixelChannelMap(image,GreenPixelChannel,trait,n);
- SetPixelChannelMap(image,RedPixelChannel,trait,n++);
+ SetPixelChannelAttributes(image,BluePixelChannel,trait,n);
+ SetPixelChannelAttributes(image,GreenPixelChannel,trait,n);
+ SetPixelChannelAttributes(image,RedPixelChannel,trait,n++);
}
else
{
- SetPixelChannelMap(image,RedPixelChannel,trait,n++);
- SetPixelChannelMap(image,GreenPixelChannel,trait,n++);
- SetPixelChannelMap(image,BluePixelChannel,trait,n++);
+ SetPixelChannelAttributes(image,RedPixelChannel,trait,n++);
+ SetPixelChannelAttributes(image,GreenPixelChannel,trait,n++);
+ SetPixelChannelAttributes(image,BluePixelChannel,trait,n++);
}
if (image->colorspace == CMYKColorspace)
- SetPixelChannelMap(image,BlackPixelChannel,trait,n++);
- if (image->matte != MagickFalse)
- SetPixelChannelMap(image,AlphaPixelChannel,CopyPixelTrait,n++);
+ SetPixelChannelAttributes(image,BlackPixelChannel,trait,n++);
+ if (image->alpha_trait != UndefinedPixelTrait)
+ SetPixelChannelAttributes(image,AlphaPixelChannel,CopyPixelTrait,n++);
if (image->storage_class == PseudoClass)
- SetPixelChannelMap(image,IndexPixelChannel,CopyPixelTrait,n++);
+ SetPixelChannelAttributes(image,IndexPixelChannel,CopyPixelTrait,n++);
if (image->mask != MagickFalse)
- SetPixelChannelMap(image,MaskPixelChannel,CopyPixelTrait,n++);
+ SetPixelChannelAttributes(image,MaskPixelChannel,CopyPixelTrait,n++);
assert((n+image->number_meta_channels) < MaxPixelChannels);
for (i=0; i < (ssize_t) image->number_meta_channels; i++)
- SetPixelChannelMap(image,(PixelChannel) (MetaPixelChannel+i),CopyPixelTrait,
- n++);
+ SetPixelChannelAttributes(image,(PixelChannel) (MetaPixelChannel+i),
+ CopyPixelTrait,n++);
image->number_channels=(size_t) n;
if (image->debug != MagickFalse)
LogPixelChannels(image);
- (void) SetPixelChannelMask(image,image->channel_mask);
+ (void) SetImageChannelMask(image,image->channel_mask);
}
\f
/*
%
*/
-static inline double MagickMax(const MagickRealType x,const MagickRealType y)
+static inline double MagickMax(const double x,const double y)
{
if (x > y)
return(x);
return(y);
}
-static inline void CatromWeights(const MagickRealType x,
- MagickRealType (*weights)[4])
+static inline void CatromWeights(const double x,double (*weights)[4])
{
- /*
- Nicolas Robidoux' 10 flops (4* + 5- + 1+) refactoring of the
- computation of the standard four 1D Catmull-Rom weights. The
- sampling location is assumed between the second and third input
- pixel locations, and x is the position relative to the second
- input pixel location. Formulas originally derived for the VIPS
- (Virtual Image Processing System) library.
- */
- MagickRealType
+ double
alpha,
beta,
gamma;
- alpha=(MagickRealType) 1.0-x;
- beta=(MagickRealType) (-0.5)*x*alpha;
+ /*
+ Nicolas Robidoux' 10 flops (4* + 5- + 1+) refactoring of the computation
+ of the standard four 1D Catmull-Rom weights. The sampling location is
+ assumed between the second and third input pixel locations, and x is the
+ position relative to the second input pixel location. Formulas originally
+ derived for the VIPS (Virtual Image Processing System) library.
+ */
+ alpha=(double) 1.0-x;
+ beta=(double) (-0.5)*x*alpha;
(*weights)[0]=alpha*beta;
(*weights)[3]=x*beta;
/*
- The following computation of the inner weights from the outer ones
- works for all Keys cubics.
+ The following computation of the inner weights from the outer ones work
+ for all Keys cubics.
*/
gamma=(*weights)[3]-(*weights)[0];
(*weights)[1]=alpha-(*weights)[0]+gamma;
(*weights)[2]=x-(*weights)[3]-gamma;
}
-static inline void SplineWeights(const MagickRealType x,
- MagickRealType (*weights)[4])
+static inline void SplineWeights(const double x,double (*weights)[4])
{
+ double
+ alpha,
+ beta;
+
/*
Nicolas Robidoux' 12 flops (6* + 5- + 1+) refactoring of the
computation of the standard four 1D cubic B-spline smoothing
third input pixel locations, and x is the position relative to the
second input pixel location.
*/
- MagickRealType
- alpha,
- beta;
-
- alpha=(MagickRealType) 1.0-x;
- (*weights)[3]=(MagickRealType) (1.0/6.0)*x*x*x;
- (*weights)[0]=(MagickRealType) (1.0/6.0)*alpha*alpha*alpha;
+ alpha=(double) 1.0-x;
+ (*weights)[3]=(double) (1.0/6.0)*x*x*x;
+ (*weights)[0]=(double) (1.0/6.0)*alpha*alpha*alpha;
beta=(*weights)[3]-(*weights)[0];
(*weights)[1]=alpha-(*weights)[0]+beta;
(*weights)[2]=x-(*weights)[3]-beta;
}
/*
-static inline ssize_t NearestNeighbor(const MagickRealType x)
+static inline ssize_t NearestNeighbor(const double x)
{
if (x >= 0.0)
return((ssize_t) (x+0.5));
MagickBooleanType
status;
- MagickRealType
+ double
alpha[16],
gamma,
pixels[16];
assert(image_view != (CacheView *) NULL);
status=MagickTrue;
*pixel=0.0;
- traits=GetPixelChannelMapTraits(image,channel);
+ traits=GetPixelChannelTraits(image,channel);
x_offset=(ssize_t) floor(x);
y_offset=(ssize_t) floor(y);
interpolate = method;
for (i=0; i < (ssize_t) count; i++)
{
alpha[i]=1.0;
- pixels[i]=(MagickRealType) p[i*GetPixelChannels(image)+channel];
+ pixels[i]=(double) p[i*GetPixelChannels(image)+channel];
}
else
for (i=0; i < (ssize_t) count; i++)
for (i=0; i < 4; i++)
{
alpha[i]=1.0;
- pixels[i]=(MagickRealType) p[i*GetPixelChannels(image)+channel];
+ pixels[i]=(double) p[i*GetPixelChannels(image)+channel];
}
else
for (i=0; i < 4; i++)
(epsilon.x*pixels[2]+delta.x*pixels[3]));
break;
}
+ case BlendInterpolatePixel:
+ {
+ p=GetCacheViewVirtualPixels(image_view,x_offset,y_offset,2,2,exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ if ((traits & BlendPixelTrait) == 0)
+ for (i=0; i < 4; i++)
+ {
+ alpha[i]=1.0;
+ pixels[i]=(MagickRealType) p[i*GetPixelChannels(image)+channel];
+ }
+ else
+ for (i=0; i < 4; i++)
+ {
+ alpha[i]=QuantumScale*GetPixelAlpha(image,p+i*
+ GetPixelChannels(image));
+ pixels[i]=alpha[i]*p[i*GetPixelChannels(image)+channel];
+ }
+ gamma=1.0; /* number of pixels blended together (its variable) */
+ for (i=0; i <= 1L; i++) {
+ if ( y-y_offset >= 0.75 ) { /* take right pixels */
+ alpha[i] = alpha[i+2];
+ pixels[i] = pixels[i+2];
+ }
+ else if ( y-y_offset > 0.25 ) {
+ gamma = 2.0; /* blend both pixels in row */
+ alpha[i] += alpha[i+2]; /* add up alpha weights */
+ pixels[i] += pixels[i+2];
+ }
+ }
+ if ( x-x_offset >= 0.75 ) { /* take bottom row blend */
+ alpha[0] = alpha[1];
+ pixels[0] = pixels[1];
+ }
+ else if ( x-x_offset > 0.25 ) {
+ gamma *= 2.0; /* blend both rows */
+ alpha[0] += alpha[1]; /* add up alpha weights */
+ pixels[0] += pixels[1];
+ }
+ if (channel != AlphaPixelChannel)
+ gamma=MagickEpsilonReciprocal(alpha[0]); /* (color) 1/alpha_weights */
+ else
+ gamma=MagickEpsilonReciprocal(gamma); /* (alpha) 1/number_of_pixels */
+ *pixel=gamma*pixels[0];
+ break;
+ }
case CatromInterpolatePixel:
{
- MagickRealType
+ double
cx[4],
cy[4];
for (i=0; i < 16; i++)
{
alpha[i]=1.0;
- pixels[i]=(MagickRealType) p[i*GetPixelChannels(image)+channel];
+ pixels[i]=(double) p[i*GetPixelChannels(image)+channel];
}
else
for (i=0; i < 16; i++)
GetPixelChannels(image));
pixels[i]=alpha[i]*p[i*GetPixelChannels(image)+channel];
}
- CatromWeights((MagickRealType) (x-x_offset),&cx);
- CatromWeights((MagickRealType) (y-y_offset),&cy);
- gamma=(channel == AlphaPixelChannel ? (MagickRealType) 1.0 :
+ CatromWeights((double) (x-x_offset),&cx);
+ CatromWeights((double) (y-y_offset),&cy);
+ gamma=(channel == AlphaPixelChannel ? (double) 1.0 :
MagickEpsilonReciprocal(cy[0]*(cx[0]*alpha[0]+cx[1]*alpha[1]+cx[2]*
alpha[2]+cx[3]*alpha[3])+cy[1]*(cx[0]*alpha[4]+cx[1]*alpha[5]+cx[2]*
alpha[6]+cx[3]*alpha[7])+cy[2]*(cx[0]*alpha[8]+cx[1]*alpha[9]+cx[2]*
for (i=0; i < 4; i++)
{
alpha[i]=1.0;
- pixels[i]=(MagickRealType) p[i*GetPixelChannels(image)+channel];
+ pixels[i]=(double) p[i*GetPixelChannels(image)+channel];
}
else
for (i=0; i < 4; i++)
}
case SplineInterpolatePixel:
{
- MagickRealType
+ double
cx[4],
cy[4];
for (i=0; i < 16; i++)
{
alpha[i]=1.0;
- pixels[i]=(MagickRealType) p[i*GetPixelChannels(image)+channel];
+ pixels[i]=(double) p[i*GetPixelChannels(image)+channel];
}
else
for (i=0; i < 16; i++)
GetPixelChannels(image));
pixels[i]=alpha[i]*p[i*GetPixelChannels(image)+channel];
}
- SplineWeights((MagickRealType) (x-x_offset),&cx);
- SplineWeights((MagickRealType) (y-y_offset),&cy);
- gamma=(channel == AlphaPixelChannel ? (MagickRealType) 1.0 :
+ SplineWeights((double) (x-x_offset),&cx);
+ SplineWeights((double) (y-y_offset),&cy);
+ gamma=(channel == AlphaPixelChannel ? (double) 1.0 :
MagickEpsilonReciprocal(cy[0]*(cx[0]*alpha[0]+cx[1]*alpha[1]+cx[2]*
alpha[2]+cx[3]*alpha[3])+cy[1]*(cx[0]*alpha[4]+cx[1]*alpha[5]+cx[2]*
alpha[6]+cx[3]*alpha[7])+cy[2]*(cx[0]*alpha[8]+cx[1]*alpha[9]+cx[2]*
MagickBooleanType
status;
- MagickRealType
+ double
alpha[16],
gamma,
pixels[16];
register ssize_t
j;
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
for (j=0; j < (ssize_t) count; j++)
- pixels[j]=(MagickRealType) p[j*GetPixelChannels(source)+i];
+ pixels[j]=(double) p[j*GetPixelChannels(source)+i];
sum=0.0;
if ((traits & BlendPixelTrait) == 0)
{
delta,
epsilon;
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
delta.y=y-y_offset;
epsilon.x=1.0-delta.x;
epsilon.y=1.0-delta.y;
- pixels[0]=(MagickRealType) p[i];
- pixels[1]=(MagickRealType) p[GetPixelChannels(source)+i];
- pixels[2]=(MagickRealType) p[2*GetPixelChannels(source)+i];
- pixels[3]=(MagickRealType) p[3*GetPixelChannels(source)+i];
+ pixels[0]=(double) p[i];
+ pixels[1]=(double) p[GetPixelChannels(source)+i];
+ pixels[2]=(double) p[2*GetPixelChannels(source)+i];
+ pixels[3]=(double) p[3*GetPixelChannels(source)+i];
if ((traits & BlendPixelTrait) == 0)
{
gamma=((epsilon.y*(epsilon.x+delta.x)+delta.y*(epsilon.x+delta.x)));
}
break;
}
+ case BlendInterpolatePixel:
+ {
+ p=GetCacheViewVirtualPixels(source_view,x_offset,y_offset,2,2,exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+ {
+ register ssize_t
+ j;
+
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ if ((traits & BlendPixelTrait) == 0)
+ for (j=0; j < 4; j++)
+ {
+ alpha[j]=1.0;
+ pixels[j]=(MagickRealType) p[j*GetPixelChannels(source)+channel];
+ }
+ else
+ for (j=0; j < 4; j++)
+ {
+ alpha[j]=QuantumScale*GetPixelAlpha(source,p+j*
+ GetPixelChannels(source));
+ pixels[j]=alpha[j]*p[j*GetPixelChannels(source)+channel];
+ }
+ gamma=1.0; /* number of pixels blended together (its variable) */
+ for (j=0; j <= 1L; j++) {
+ if ( y-y_offset >= 0.75 ) { /* take right pixels */
+ alpha[j] = alpha[j+2];
+ pixels[j] = pixels[j+2];
+ }
+ else if ( y-y_offset > 0.25 ) {
+ gamma = 2.0; /* blend both pixels in row */
+ alpha[j] += alpha[j+2]; /* add up alpha weights */
+ pixels[j] += pixels[j+2];
+ }
+ }
+ if ( x-x_offset >= 0.75 ) { /* take bottom row blend */
+ alpha[0] = alpha[1];
+ pixels[0] = pixels[1];
+ }
+ else if ( x-x_offset > 0.25 ) {
+ gamma *= 2.0; /* blend both rows */
+ alpha[0] += alpha[1]; /* add up alpha weights */
+ pixels[0] += pixels[1];
+ }
+ if ((traits & BlendPixelTrait) == 0)
+ gamma=MagickEpsilonReciprocal(alpha[0]); /* (color) 1/alpha_weights */
+ else
+ gamma=MagickEpsilonReciprocal(gamma); /* (alpha) 1/number_of_pixels */
+ SetPixelChannel(destination,channel,ClampToQuantum(gamma*pixels[0]),
+ pixel);
+ }
+ break;
+ }
case CatromInterpolatePixel:
{
- MagickRealType
+ double
cx[4],
cy[4];
register ssize_t
j;
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
for (j=0; j < 16; j++)
{
alpha[j]=1.0;
- pixels[j]=(MagickRealType) p[j*GetPixelChannels(source)+i];
+ pixels[j]=(double) p[j*GetPixelChannels(source)+i];
}
else
for (j=0; j < 16; j++)
GetPixelChannels(source));
pixels[j]=alpha[j]*p[j*GetPixelChannels(source)+i];
}
- CatromWeights((MagickRealType) (x-x_offset),&cx);
- CatromWeights((MagickRealType) (y-y_offset),&cy);
- gamma=((traits & BlendPixelTrait) ? (MagickRealType) (1.0) :
+ CatromWeights((double) (x-x_offset),&cx);
+ CatromWeights((double) (y-y_offset),&cy);
+ gamma=((traits & BlendPixelTrait) ? (double) (1.0) :
MagickEpsilonReciprocal(cy[0]*(cx[0]*alpha[0]+cx[1]*alpha[1]+cx[2]*
alpha[2]+cx[3]*alpha[3])+cy[1]*(cx[0]*alpha[4]+cx[1]*alpha[5]+cx[2]*
alpha[6]+cx[3]*alpha[7])+cy[2]*(cx[0]*alpha[8]+cx[1]*alpha[9]+cx[2]*
RectangleInfo
geometry;
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
}
for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
{
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
}
for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
{
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
delta,
luminance;
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
- pixels[0]=(MagickRealType) p[i];
- pixels[1]=(MagickRealType) p[GetPixelChannels(source)+i];
- pixels[2]=(MagickRealType) p[2*GetPixelChannels(source)+i];
- pixels[3]=(MagickRealType) p[3*GetPixelChannels(source)+i];
+ pixels[0]=(double) p[i];
+ pixels[1]=(double) p[GetPixelChannels(source)+i];
+ pixels[2]=(double) p[2*GetPixelChannels(source)+i];
+ pixels[3]=(double) p[3*GetPixelChannels(source)+i];
if ((traits & BlendPixelTrait) == 0)
{
alpha[0]=1.0;
}
case SplineInterpolatePixel:
{
- MagickRealType
+ double
cx[4],
cy[4];
register ssize_t
j;
- channel=GetPixelChannelMapChannel(source,i);
- traits=GetPixelChannelMapTraits(source,channel);
- destination_traits=GetPixelChannelMapTraits(destination,channel);
+ channel=GetPixelChannelChannel(source,i);
+ traits=GetPixelChannelTraits(source,channel);
+ destination_traits=GetPixelChannelTraits(destination,channel);
if ((traits == UndefinedPixelTrait) ||
(destination_traits == UndefinedPixelTrait))
continue;
for (j=0; j < 16; j++)
{
alpha[j]=1.0;
- pixels[j]=(MagickRealType) p[j*GetPixelChannels(source)+i];
+ pixels[j]=(double) p[j*GetPixelChannels(source)+i];
}
else
for (j=0; j < 16; j++)
GetPixelChannels(source));
pixels[j]=alpha[j]*p[j*GetPixelChannels(source)+i];
}
- SplineWeights((MagickRealType) (x-x_offset),&cx);
- SplineWeights((MagickRealType) (y-y_offset),&cy);
- gamma=((traits & BlendPixelTrait) ? (MagickRealType) (1.0) :
+ SplineWeights((double) (x-x_offset),&cx);
+ SplineWeights((double) (y-y_offset),&cy);
+ gamma=((traits & BlendPixelTrait) ? (double) (1.0) :
MagickEpsilonReciprocal(cy[0]*(cx[0]*alpha[0]+cx[1]*alpha[1]+cx[2]*
alpha[2]+cx[3]*alpha[3])+cy[1]*(cx[0]*alpha[4]+cx[1]*alpha[5]+cx[2]*
alpha[6]+cx[3]*alpha[7])+cy[2]*(cx[0]*alpha[8]+cx[1]*alpha[9]+cx[2]*
*/
static inline void AlphaBlendPixelInfo(const Image *image,
- const Quantum *pixel,PixelInfo *pixel_info,MagickRealType *alpha)
+ const Quantum *pixel,PixelInfo *pixel_info,double *alpha)
{
- if (image->matte == MagickFalse)
+ if (image->alpha_trait != BlendPixelTrait)
{
*alpha=1.0;
- pixel_info->red=(MagickRealType) GetPixelRed(image,pixel);
- pixel_info->green=(MagickRealType) GetPixelGreen(image,pixel);
- pixel_info->blue=(MagickRealType) GetPixelBlue(image,pixel);
+ pixel_info->red=(double) GetPixelRed(image,pixel);
+ pixel_info->green=(double) GetPixelGreen(image,pixel);
+ pixel_info->blue=(double) GetPixelBlue(image,pixel);
pixel_info->black=0.0;
if (image->colorspace == CMYKColorspace)
- pixel_info->black=(MagickRealType) GetPixelBlack(image,pixel);
- pixel_info->alpha=(MagickRealType) GetPixelAlpha(image,pixel);
+ pixel_info->black=(double) GetPixelBlack(image,pixel);
+ pixel_info->alpha=(double) GetPixelAlpha(image,pixel);
return;
}
*alpha=QuantumScale*GetPixelAlpha(image,pixel);
pixel_info->black=0.0;
if (image->colorspace == CMYKColorspace)
pixel_info->black=(*alpha*GetPixelBlack(image,pixel));
- pixel_info->alpha=(MagickRealType) GetPixelAlpha(image,pixel);
+ pixel_info->alpha=(double) GetPixelAlpha(image,pixel);
}
MagickExport MagickBooleanType InterpolatePixelInfo(const Image *image,
MagickBooleanType
status;
- MagickRealType
+ double
alpha[16],
gamma;
}
for (i=0; i < 4L; i++)
AlphaBlendPixelInfo(image,p+i*GetPixelChannels(image),pixels+i,alpha+i);
- gamma=1.0; /* number of pixels blended together */
+ gamma=1.0; /* number of pixels blended together (its variable) */
for (i=0; i <= 1L; i++) {
- if ( y-y_offset >= 0.75 ) {
+ if ( y-y_offset >= 0.75 ) { /* take right pixels */
alpha[i] = alpha[i+2];
pixels[i] = pixels[i+2];
}
else if ( y-y_offset > 0.25 ) {
- gamma = 2.0; /* each y pixels have been blended */
+ gamma = 2.0; /* blend both pixels in row */
alpha[i] += alpha[i+2]; /* add up alpha weights */
pixels[i].red += pixels[i+2].red;
pixels[i].green += pixels[i+2].green;
pixels[0] = pixels[1];
}
else if ( x-x_offset > 0.25 ) {
- gamma *= 2.0; /* double number of pixels blended */
- alpha[0] += alpha[1]; /* add up alpha weights */
+ gamma *= 2.0; /* blend both rows */
+ alpha[0] += alpha[1]; /* add up alpha weights */
pixels[0].red += pixels[1].red;
pixels[0].green += pixels[1].green;
pixels[0].blue += pixels[1].blue;
}
case CatromInterpolatePixel:
{
- MagickRealType
+ double
cx[4],
cy[4];
}
for (i=0; i < 16L; i++)
AlphaBlendPixelInfo(image,p+i*GetPixelChannels(image),pixels+i,alpha+i);
- CatromWeights((MagickRealType) (x-x_offset),&cx);
- CatromWeights((MagickRealType) (y-y_offset),&cy);
+ CatromWeights((double) (x-x_offset),&cx);
+ CatromWeights((double) (y-y_offset),&cy);
pixel->red=(cy[0]*(cx[0]*pixels[0].red+cx[1]*
pixels[1].red+cx[2]*pixels[2].red+cx[3]*
pixels[3].red)+cy[1]*(cx[0]*pixels[4].red+cx[1]*
}
case SplineInterpolatePixel:
{
- MagickRealType
+ double
cx[4],
cy[4];
}
for (i=0; i < 16L; i++)
AlphaBlendPixelInfo(image,p+i*GetPixelChannels(image),pixels+i,alpha+i);
- SplineWeights((MagickRealType) (x-x_offset),&cx);
- SplineWeights((MagickRealType) (y-y_offset),&cy);
+ SplineWeights((double) (x-x_offset),&cx);
+ SplineWeights((double) (y-y_offset),&cy);
pixel->red=(cy[0]*(cx[0]*pixels[0].red+cx[1]*
pixels[1].red+cx[2]*pixels[2].red+cx[3]*
pixels[3].red)+cy[1]*(cx[0]*pixels[4].red+cx[1]*
MagickExport MagickBooleanType IsFuzzyEquivalencePixel(const Image *source,
const Quantum *p,const Image *destination,const Quantum *q)
{
- MagickRealType
+ double
fuzz,
pixel;
- register MagickRealType
+ register double
distance,
scale;
- fuzz=MagickMax(source->fuzz,(MagickRealType) MagickSQ1_2)*MagickMax(
- destination->fuzz,(MagickRealType) MagickSQ1_2);
+ fuzz=MagickMax(source->fuzz,(double) MagickSQ1_2)*MagickMax(
+ destination->fuzz,(double) MagickSQ1_2);
scale=1.0;
distance=0.0;
- if (source->matte != MagickFalse)
+ if (source->alpha_trait == BlendPixelTrait)
{
/*
Transparencies are involved - set alpha distance
*/
- pixel=GetPixelAlpha(source,p)-(MagickRealType)
+ pixel=GetPixelAlpha(source,p)-(double)
GetPixelAlpha(destination,q);
distance=pixel*pixel;
if (distance > fuzz)
*/
distance*=3.0; /* rescale appropriately */
fuzz*=3.0;
- pixel=GetPixelRed(source,p)-(MagickRealType) GetPixelRed(destination,q);
+ pixel=GetPixelRed(source,p)-(double) GetPixelRed(destination,q);
if ((source->colorspace == HSLColorspace) ||
(source->colorspace == HSBColorspace) ||
(source->colorspace == HWBColorspace))
distance+=scale*pixel*pixel;
if (distance > fuzz)
return(MagickFalse);
- pixel=GetPixelGreen(source,p)-(MagickRealType) GetPixelGreen(destination,q);
+ pixel=GetPixelGreen(source,p)-(double) GetPixelGreen(destination,q);
distance+=scale*pixel*pixel;
if (distance > fuzz)
return(MagickFalse);
- pixel=GetPixelBlue(source,p)-(MagickRealType) GetPixelBlue(destination,q);
+ pixel=GetPixelBlue(source,p)-(double) GetPixelBlue(destination,q);
distance+=scale*pixel*pixel;
if (distance > fuzz)
return(MagickFalse);
MagickExport MagickBooleanType IsFuzzyEquivalencePixelInfo(const PixelInfo *p,
const PixelInfo *q)
{
- MagickRealType
+ double
fuzz,
pixel;
- register MagickRealType
+ register double
scale,
distance;
if ((p->fuzz == 0.0) && (q->fuzz == 0.0))
return(IsPixelInfoEquivalent(p,q));
if (p->fuzz == 0.0)
- fuzz=MagickMax(q->fuzz,(MagickRealType) MagickSQ1_2)*MagickMax(q->fuzz,
- (MagickRealType) MagickSQ1_2);
+ fuzz=MagickMax(q->fuzz,(double) MagickSQ1_2)*MagickMax(q->fuzz,
+ (double) MagickSQ1_2);
else if (q->fuzz == 0.0)
- fuzz=MagickMax(p->fuzz,(MagickRealType) MagickSQ1_2)*MagickMax(p->fuzz,
- (MagickRealType) MagickSQ1_2);
+ fuzz=MagickMax(p->fuzz,(double) MagickSQ1_2)*MagickMax(p->fuzz,
+ (double) MagickSQ1_2);
else
- fuzz=MagickMax(p->fuzz,(MagickRealType) MagickSQ1_2)*MagickMax(q->fuzz,
- (MagickRealType) MagickSQ1_2);
+ fuzz=MagickMax(p->fuzz,(double) MagickSQ1_2)*MagickMax(q->fuzz,
+ (double) MagickSQ1_2);
scale=1.0;
distance=0.0;
- if ((p->matte != MagickFalse) || (q->matte != MagickFalse))
+ if ((p->alpha_trait == BlendPixelTrait) || (q->alpha_trait == BlendPixelTrait))
{
/*
Transparencies are involved - set alpha distance.
*/
- pixel=(p->matte != MagickFalse ? p->alpha : OpaqueAlpha)-
- (q->matte != MagickFalse ? q->alpha : OpaqueAlpha);
+ pixel=(p->alpha_trait == BlendPixelTrait ? p->alpha : OpaqueAlpha)-
+ (q->alpha_trait == BlendPixelTrait ? q->alpha : OpaqueAlpha);
distance=pixel*pixel;
if (distance > fuzz)
return(MagickFalse);
Generate a alpha scaling factor to generate a 4D cone on colorspace.
If one color is transparent, distance has no color component.
*/
- if (p->matte != MagickFalse)
+ if (p->alpha_trait == BlendPixelTrait)
scale=(QuantumScale*p->alpha);
- if (q->matte != MagickFalse)
+ if (q->alpha_trait == BlendPixelTrait)
scale*=(QuantumScale*q->alpha);
if (scale <= MagickEpsilon )
return(MagickTrue);
distance+=pixel*pixel*scale;
if (distance > fuzz)
return(MagickFalse);
- scale*=(MagickRealType) (QuantumScale*(QuantumRange-p->black));
- scale*=(MagickRealType) (QuantumScale*(QuantumRange-q->black));
+ scale*=(double) (QuantumScale*(QuantumRange-p->black));
+ scale*=(double) (QuantumScale*(QuantumRange-q->black));
}
/*
RGB or CMY color cube.
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% SetPixelChannelMapMask() sets the pixel channel map from the specified
+% SetPixelChannelMask() sets the pixel channel map from the specified
% channel mask.
%
-% The format of the SetPixelChannelMapMask method is:
+% The format of the SetPixelChannelMask method is:
%
-% void SetPixelChannelMapMask(Image *image,const ChannelType channel_mask)
+% void SetPixelChannelMask(Image *image,const ChannelType channel_mask)
%
% A description of each parameter follows:
%
% o channel_mask: the channel mask.
%
*/
-MagickExport void SetPixelChannelMapMask(Image *image,
+MagickExport void SetPixelChannelMask(Image *image,
const ChannelType channel_mask)
{
#define GetChannelBit(mask,bit) (((size_t) (mask) >> (size_t) (bit)) & 0x01)
PixelChannel
channel;
- channel=GetPixelChannelMapChannel(image,i);
- SetPixelChannelMapTraits(image,channel,
+ channel=GetPixelChannelChannel(image,i);
+ SetPixelChannelTraits(image,channel,
GetChannelBit(channel_mask,channel) == 0 ? CopyPixelTrait :
- image->matte == MagickFalse || (channel == AlphaPixelChannel) ?
- UpdatePixelTrait : (PixelTrait) (UpdatePixelTrait | BlendPixelTrait));
+ image->alpha_trait != BlendPixelTrait || (channel == AlphaPixelChannel) ?
+ UpdatePixelTrait : (PixelTrait) (UpdatePixelTrait | image->alpha_trait));
}
if (image->storage_class == PseudoClass)
- SetPixelChannelMapTraits(image,IndexPixelChannel,CopyPixelTrait);
+ SetPixelChannelTraits(image,IndexPixelChannel,CopyPixelTrait);
if (image->mask != MagickFalse)
- SetPixelChannelMapTraits(image,MaskPixelChannel,CopyPixelTrait);
+ SetPixelChannelTraits(image,MaskPixelChannel,CopyPixelTrait);
if (image->debug != MagickFalse)
LogPixelChannels(image);
}
% %
% %
% %
-% S e t P i x e l C h a n n e l M a s k %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% SetPixelChannelMask() sets the pixel channel mask from the specified channel
-% mask.
-%
-% The format of the SetPixelChannelMask method is:
-%
-% ChannelType SetPixelChannelMask(Image *image,
-% const ChannelType channel_mask)
-%
-% A description of each parameter follows:
-%
-% o image: the image.
-%
-% o channel_mask: the channel mask.
-%
-*/
-MagickExport ChannelType SetPixelChannelMask(Image *image,
- const ChannelType channel_mask)
-{
- ChannelType
- mask;
-
- mask=image->channel_mask;
- image->channel_mask=channel_mask;
- SetPixelChannelMapMask(image,channel_mask);
- return(mask);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% S e t P i x e l M e t a C h a n n e l s %
% %
% %