MagickCore::Image* newImage =
SpreadImage( image(),
amount_,
+ image()->interpolate,
&exceptionInfo );
replaceImage( newImage );
throwException( exceptionInfo );
WaveImage( image(),
amplitude_,
wavelength_,
+ image()->interpolate,
&exceptionInfo);
replaceImage( newImage );
throwException( exceptionInfo );
char
c;
- LongPixelPacket
+ PixelLongPacket
pixel;
QuantumAny
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
wave_image=WaveImage(*image,geometry_info.rho,geometry_info.sigma,
- exception);
+ (*image)->interpolate,exception);
if (wave_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
case SpreadPreview:
{
- preview_image=SpreadImage(thumbnail,radius,exception);
+ preview_image=SpreadImage(thumbnail,radius,thumbnail->interpolate,
+ exception);
(void) FormatLocaleString(label,MaxTextExtent,"spread %g",
radius+0.5);
break;
case WavePreview:
{
degrees+=5.0f;
- preview_image=WaveImage(thumbnail,0.5*degrees,2.0*degrees,exception);
+ preview_image=WaveImage(thumbnail,0.5*degrees,2.0*degrees,
+ image->interpolate,exception);
(void) FormatLocaleString(label,MaxTextExtent,"wave %gx%g",
0.5*degrees,2.0*degrees);
break;
% The format of the SpreadImage method is:
%
% Image *SpreadImage(const Image *image,const double radius,
-% ExceptionInfo *exception)
+% const PixelInterpolateMethod method,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image.
%
-% o radius: Choose a random pixel in a neighborhood of this extent.
+% o radius: choose a random pixel in a neighborhood of this extent.
+%
+% o method: the pixel interpolation method.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *SpreadImage(const Image *image,const double radius,
- ExceptionInfo *exception)
+ const PixelInterpolateMethod method,ExceptionInfo *exception)
{
#define SpreadImageTag "Spread/Image"
PointInfo
point;
- register ssize_t
- i;
-
point.x=GetPseudoRandomValue(random_info[id]);
point.y=GetPseudoRandomValue(random_info[id]);
- for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
- {
- MagickRealType
- pixel;
-
- PixelChannel
- channel;
-
- PixelTrait
- spread_traits,
- traits;
-
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
- spread_traits=GetPixelChannelMapTraits(spread_image,channel);
- if ((traits == UndefinedPixelTrait) ||
- (spread_traits == UndefinedPixelTrait))
- continue;
- if ((spread_traits & CopyPixelTrait) != 0)
- {
- q[channel]=p[i];
- continue;
- }
- status=InterpolatePixelChannel(image,image_view,(PixelChannel) i,
- MeshInterpolatePixel,(double) x+width*point.x-0.5,(double) y+width*
- point.y-0.5,&pixel,exception);
- q[channel]=ClampToQuantum(pixel);
- }
+ status=InterpolatePixelChannels(image,image_view,spread_image,method,
+ (double) x+width*point.x-0.5,(double) y+width*point.y-0.5,q,exception);
q+=GetPixelChannels(spread_image);
}
if (SyncCacheViewAuthenticPixels(spread_view,exception) == MagickFalse)
ExceptionInfo *),
*SharpenImage(const Image *,const double,const double,const double,
ExceptionInfo *),
- *SpreadImage(const Image *,const double,ExceptionInfo *),
+ *SpreadImage(const Image *,const double,const PixelInterpolateMethod,
+ ExceptionInfo *),
*StatisticImage(const Image *,const StatisticType,const size_t,const size_t,
ExceptionInfo *),
*UnsharpMaskImage(const Image *,const double,const double,const double,
% The format of the ClutImage method is:
%
% MagickBooleanType ClutImage(Image *image,Image *clut_image,
-% ExceptionInfo *exception)
+% const PixelInterpolateMethod method,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o clut_image: the color lookup table image for replacement color values.
%
-% o channel: the channel.
+% o method: the pixel interpolation method.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport MagickBooleanType ClutImage(Image *image,const Image *clut_image,
- ExceptionInfo *exception)
+ const PixelInterpolateMethod method,ExceptionInfo *exception)
{
#define ClutImageTag "Clut/Image"
for (i=0; i < (ssize_t) GetPixelChannels(clut_image); i++)
(void) InterpolatePixelChannel(clut_image,clut_view,(PixelChannel) i,
- UndefinedInterpolatePixel,QuantumScale*x*(clut_image->columns-adjust),
- QuantumScale*x*(clut_image->rows-adjust),clut_map+x*
- GetPixelChannels(clut_image)+i,exception);
+ method,QuantumScale*x*(clut_image->columns-adjust),QuantumScale*x*
+ (clut_image->rows-adjust),clut_map+x*GetPixelChannels(clut_image)+i,
+ exception);
}
clut_view=DestroyCacheView(clut_view);
image_view=AcquireCacheView(image);
AutoGammaImage(Image *,ExceptionInfo *),
AutoLevelImage(Image *,ExceptionInfo *),
BrightnessContrastImage(Image *,const double,const double,ExceptionInfo *),
- ClutImage(Image *,const Image *,ExceptionInfo *),
+ ClutImage(Image *,const Image *,const PixelInterpolateMethod,ExceptionInfo *),
ColorDecisionListImage(Image *,const char *,ExceptionInfo *),
ContrastImage(Image *,const MagickBooleanType,ExceptionInfo *),
ContrastStretchImage(Image *,const double,const double,ExceptionInfo *),
{
typedef struct _ChannelStatistics
{
- DoublePixelPacket
+ PixelDoublePacket
direction[4]; /* horizontal, vertical, left and right diagonals */
} ChannelStatistics;
sum_squares,
variance;
- LongPixelPacket
+ PixelLongPacket
gray,
*grays;
/*
Form grays.
*/
- grays=(LongPixelPacket *) AcquireQuantumMemory(MaxMap+1UL,sizeof(*grays));
- if (grays == (LongPixelPacket *) NULL)
+ grays=(PixelLongPacket *) AcquireQuantumMemory(MaxMap+1UL,sizeof(*grays));
+ if (grays == (PixelLongPacket *) NULL)
{
channel_features=(ChannelFeatures *) RelinquishMagickMemory(
channel_features);
image_view=DestroyCacheView(image_view);
if (status == MagickFalse)
{
- grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+ grays=(PixelLongPacket *) RelinquishMagickMemory(grays);
channel_features=(ChannelFeatures *) RelinquishMagickMemory(
channel_features);
return(channel_features);
cooccurrence=(ChannelStatistics **) RelinquishMagickMemory(
cooccurrence);
}
- grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+ grays=(PixelLongPacket *) RelinquishMagickMemory(grays);
channel_features=(ChannelFeatures *) RelinquishMagickMemory(
channel_features);
(void) ThrowMagickException(exception,GetMagickModule(),
density_y=(ChannelStatistics *) RelinquishMagickMemory(density_y);
density_xy=(ChannelStatistics *) RelinquishMagickMemory(density_xy);
density_x=(ChannelStatistics *) RelinquishMagickMemory(density_x);
- grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+ grays=(PixelLongPacket *) RelinquishMagickMemory(grays);
channel_features=(ChannelFeatures *) RelinquishMagickMemory(
channel_features);
(void) ThrowMagickException(exception,GetMagickModule(),
p+=GetPixelChannels(image);
}
}
- grays=(LongPixelPacket *) RelinquishMagickMemory(grays);
+ grays=(PixelLongPacket *) RelinquishMagickMemory(grays);
image_view=DestroyCacheView(image_view);
if (status == MagickFalse)
{
% The format of the AnnotateImage method is:
%
% Image *PolaroidImage(const Image *image,const DrawInfo *draw_info,
-% const double angle,ExceptionInfo exception)
+% const double angle,const PixelInterpolateMethod method,
+% ExceptionInfo exception)
%
% A description of each parameter follows:
%
%
% o angle: Apply the effect along this angle.
%
+% o method: the pixel interpolation method.
+%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *PolaroidImage(const Image *image,const DrawInfo *draw_info,
- const double angle,ExceptionInfo *exception)
+ const double angle,const PixelInterpolateMethod method,
+ ExceptionInfo *exception)
{
const char
*value;
return((Image *) NULL);
picture_image=rotate_image;
bend_image=WaveImage(picture_image,0.01*picture_image->rows,2.0*
- picture_image->columns,exception);
+ picture_image->columns,method,exception);
picture_image=DestroyImage(picture_image);
if (bend_image == (Image *) NULL)
return((Image *) NULL);
% The format of the WaveImage method is:
%
% Image *WaveImage(const Image *image,const double amplitude,
-% const double wave_length,ExceptionInfo *exception)
+% const double wave_length,const PixelInterpolateMethod method,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o amplitude, wave_length: Define the amplitude and wave length of the
% sine wave.
%
+% o interpolate: the pixel interpolation method.
+%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *WaveImage(const Image *image,const double amplitude,
- const double wave_length,ExceptionInfo *exception)
+ const double wave_length,const PixelInterpolateMethod method,
+ ExceptionInfo *exception)
{
#define WaveImageTag "Wave/Image"
}
for (x=0; x < (ssize_t) wave_image->columns; x++)
{
- register ssize_t
- i;
-
- for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
- {
- double
- pixel;
-
- PixelChannel
- channel;
-
- PixelTrait
- wave_traits,
- traits;
-
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
- wave_traits=GetPixelChannelMapTraits(wave_image,channel);
- if ((traits == UndefinedPixelTrait) ||
- (wave_traits == UndefinedPixelTrait))
- continue;
- status=InterpolatePixelChannel(image,image_view,(PixelChannel) i,
- MeshInterpolatePixel,(double) x,(double) (y-sine_map[x]),&pixel,
- exception);
- q[channel]=ClampToQuantum(pixel);
- }
+ status=InterpolatePixelChannels(image,image_view,wave_image,method,
+ (double) x,(double) (y-sine_map[x]),q,exception);
q+=GetPixelChannels(wave_image);
}
if (SyncCacheViewAuthenticPixels(wave_view,exception) == MagickFalse)
*FxImage(const Image *,const char *,ExceptionInfo *),
*ImplodeImage(const Image *,const double,ExceptionInfo *),
*MorphImages(const Image *,const size_t,ExceptionInfo *),
- *PolaroidImage(const Image *,const DrawInfo *,const double,ExceptionInfo *),
+ *PolaroidImage(const Image *,const DrawInfo *,const double,
+ const PixelInterpolateMethod,ExceptionInfo *),
*SepiaToneImage(const Image *,const double,ExceptionInfo *),
*ShadowImage(const Image *,const double,const double,const ssize_t,
const ssize_t,ExceptionInfo *),
*TintImage(const Image *,const char *,const PixelPacket,ExceptionInfo *),
*VignetteImage(const Image *,const double,const double,const ssize_t,
const ssize_t,ExceptionInfo *),
- *WaveImage(const Image *,const double,const double,ExceptionInfo *);
+ *WaveImage(const Image *,const double,const double,
+ const PixelInterpolateMethod,ExceptionInfo *);
extern MagickExport MagickBooleanType
PlasmaImage(Image *,const SegmentInfo *,size_t,size_t,ExceptionInfo *),
MagickFalse,option);
option=GetImageOption(image_info,"interpolate");
if (option != (const char *) NULL)
- image->interpolate=(InterpolatePixelMethod) ParseCommandOption(
+ image->interpolate=(PixelInterpolateMethod) ParseCommandOption(
MagickInterpolateOptions,MagickFalse,option);
option=GetImageOption(image_info,"loop");
if (option != (const char *) NULL)
ssize_t
start_loop;
- InterpolatePixelMethod
+ PixelInterpolateMethod
interpolate; /* Interpolation of color for between pixel lookups */
MagickBooleanType
/* #undef AUTOTRACE_DELEGATE */
/* Define if coders and filters are to be built as modules. */
-/* #undef BUILD_MODULES */
+#ifndef MAGICKCORE_BUILD_MODULES
+#define MAGICKCORE_BUILD_MODULES 1
+#endif
/* Define if you have the bzip2 library */
#ifndef MAGICKCORE_BZLIB_DELEGATE
#endif
/* Define if you have FFTW library */
-/* #undef FFTW_DELEGATE */
+#ifndef MAGICKCORE_FFTW_DELEGATE
+#define MAGICKCORE_FFTW_DELEGATE 1
+#endif
/* Location of filter modules */
#ifndef MAGICKCORE_FILTER_PATH
#endif
/* Define if you have the <lcms2.h> header file. */
-#ifndef MAGICKCORE_HAVE_LCMS2_H
-#define MAGICKCORE_HAVE_LCMS2_H 1
-#endif
+/* #undef HAVE_LCMS2_H */
/* Define if you have the <lcms2/lcms2.h> header file. */
/* #undef HAVE_LCMS2_LCMS2_H */
/* Define if you have the <lcms.h> header file. */
-/* #undef HAVE_LCMS_H */
+#ifndef MAGICKCORE_HAVE_LCMS_H
+#define MAGICKCORE_HAVE_LCMS_H 1
+#endif
/* Define if you have the <lcms/lcms.h> header file. */
/* #undef HAVE_LCMS_LCMS_H */
#endif
/* Define if you have JBIG library */
-/* #undef JBIG_DELEGATE */
+#ifndef MAGICKCORE_JBIG_DELEGATE
+#define MAGICKCORE_JBIG_DELEGATE 1
+#endif
/* Define if you have JPEG version 2 "Jasper" library */
#ifndef MAGICKCORE_JP2_DELEGATE
#endif
/* Define if you have LQR library */
-/* #undef LQR_DELEGATE */
+#ifndef MAGICKCORE_LQR_DELEGATE
+#define MAGICKCORE_LQR_DELEGATE 1
+#endif
/* Define if using libltdl to support dynamically loadable modules */
#ifndef MAGICKCORE_LTDL_DELEGATE
/* Define to the system default library search path. */
#ifndef MAGICKCORE_LT_DLSEARCH_PATH
-#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/atlas:/usr/lib/llvm:/usr/lib64/llvm:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/tcl8.5/tclx8.4:/usr/lib64/tcl8.5:/usr/lib/wine/:/usr/lib64/wine/:/usr/lib64/xulrunner-2"
+#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/R/lib:/usr/lib64/atlas:/opt/modules/pkg/intel/f77/10.0.025/lib:/usr/lib64/llvm:/usr/local/lib:/usr/lib64/mysql:/usr/lib64/nvidia:/usr/lib64/qt-3.3/lib:/usr/lib64/xulrunner-2"
#endif
/* The archive extension */
/* #undef NO_MINUS_C_MINUS_O */
/* Define if you have OPENEXR library */
-/* #undef OPENEXR_DELEGATE */
+#ifndef MAGICKCORE_OPENEXR_DELEGATE
+#define MAGICKCORE_OPENEXR_DELEGATE 1
+#endif
/* Define to the address where bug reports for this package should be sent. */
#ifndef MAGICKCORE_PACKAGE_BUGREPORT
#endif
/* Define if you have RSVG library */
-/* #undef RSVG_DELEGATE */
+#ifndef MAGICKCORE_RSVG_DELEGATE
+#define MAGICKCORE_RSVG_DELEGATE 1
+#endif
/* Define to the type of arg 1 for `select'. */
#ifndef MAGICKCORE_SELECT_TYPE_ARG1
/* Define if you have WEBP library */
-/* #undef WEBP_DELEGATE */
+#ifndef MAGICKCORE_WEBP_DELEGATE
+#define MAGICKCORE_WEBP_DELEGATE 1
+#endif
/* Define to use the Windows GDI32 library */
/* #undef WINGDI32_DELEGATE */
/* #undef WITH_DMALLOC */
/* Define if you have WMF library */
-/* #undef WMF_DELEGATE */
+#ifndef MAGICKCORE_WMF_DELEGATE
+#define MAGICKCORE_WMF_DELEGATE 1
+#endif
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
%
% MagickBooleanType InterpolatePixelChannel(const Image *image,
% const CacheView *image_view,const PixelChannel channel,
-% const InterpolatePixelMethod method,const double x,const double y,
+% const PixelInterpolateMethod method,const double x,const double y,
% double *pixel,ExceptionInfo *exception)
%
% A description of each parameter follows:
MagickExport MagickBooleanType InterpolatePixelChannel(const Image *image,
const CacheView *image_view,const PixelChannel channel,
- const InterpolatePixelMethod method,const double x,const double y,
+ const PixelInterpolateMethod method,const double x,const double y,
double *pixel,ExceptionInfo *exception)
{
MagickBooleanType
% %
% %
% %
+% I n t e r p o l a t e P i x e l C h a n n e l s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% InterpolatePixelChannels() applies a pixel interpolation method between a
+% floating point coordinate and the pixels surrounding that coordinate. No
+% pixel area resampling, or scaling of the result is performed.
+%
+% The format of the InterpolatePixelChannels method is:
+%
+% MagickBooleanType InterpolatePixelChannels(const Image *source,
+% const CacheView *source_view,const Image *destination,
+% const PixelInterpolateMethod method,const double x,const double y,
+% Quantum *pixel,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o source: the source.
+%
+% o source_view: the source view.
+%
+% o destination: the destination image.
+%
+% o method: the pixel color interpolation method.
+%
+% o x,y: A double representing the current (x,y) position of the pixel.
+%
+% o pixel: return the interpolated pixel here.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport MagickBooleanType InterpolatePixelChannels(const Image *source,
+ const CacheView *source_view,const Image *destination,
+ const PixelInterpolateMethod method,const double x,const double y,
+ Quantum *pixel,ExceptionInfo *exception)
+{
+ MagickBooleanType
+ status;
+
+ MagickRealType
+ alpha[16],
+ gamma,
+ pixels[16];
+
+ PixelChannel
+ channel;
+
+ PixelTrait
+ destination_traits,
+ traits;
+
+ register const Quantum
+ *p;
+
+ register ssize_t
+ i;
+
+ ssize_t
+ x_offset,
+ y_offset;
+
+ assert(source != (Image *) NULL);
+ assert(source != (Image *) NULL);
+ assert(source->signature == MagickSignature);
+ assert(source_view != (CacheView *) NULL);
+ status=MagickTrue;
+ x_offset=(ssize_t) floor(x);
+ y_offset=(ssize_t) floor(y);
+ switch (method == UndefinedInterpolatePixel ? source->interpolate : method)
+ {
+ case AverageInterpolatePixel:
+ {
+ p=GetCacheViewVirtualPixels(source_view,x_offset-1,y_offset-1,4,4,
+ exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+ {
+ double
+ sum;
+
+ register ssize_t
+ j;
+
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ for (j=0; j < 16; j++)
+ pixels[j]=(MagickRealType) p[j*GetPixelChannels(source)+i];
+ if ((traits & BlendPixelTrait) == 0)
+ {
+ for (j=0; j < 16; j++)
+ pixel[channel]+=0.0625*pixels[j];
+ continue;
+ }
+ sum=0.0;
+ for (j=0; j < 16; j++)
+ {
+ alpha[j]=QuantumScale*GetPixelAlpha(source,p+j*
+ GetPixelChannels(source));
+ pixels[j]*=alpha[j];
+ gamma=1.0/(fabs((double) alpha[j]) <= MagickEpsilon ? 1.0 : alpha[j]);
+ sum+=gamma*0.0625*pixels[j];
+ }
+ pixel[channel]=ClampToQuantum(sum);
+ }
+ break;
+ }
+ case BicubicInterpolatePixel:
+ {
+ MagickRealType
+ u[4],
+ v[4];
+
+ PointInfo
+ delta;
+
+ p=GetCacheViewVirtualPixels(source_view,x_offset-1,y_offset-1,4,4,
+ exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+ {
+ register ssize_t
+ j;
+
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ if ((traits & BlendPixelTrait) == 0)
+ for (j=0; j < 16; j++)
+ {
+ alpha[j]=1.0;
+ pixels[j]=(MagickRealType) p[j*GetPixelChannels(source)+i];
+ }
+ else
+ for (j=0; j < 16; j++)
+ {
+ alpha[j]=QuantumScale*GetPixelAlpha(source,p+j*
+ GetPixelChannels(source));
+ pixels[j]=alpha[j]*p[j*GetPixelChannels(source)+i];
+ }
+ delta.x=x-x_offset;
+ delta.y=y-y_offset;
+ for (j=0; j < 4; j++)
+ {
+ u[0]=(pixels[4*j+3]-pixels[4*j+2])-(pixels[4*j+0]-pixels[4*j+1]);
+ u[1]=(pixels[4*j+0]-pixels[4*j+1])-u[0];
+ u[2]=pixels[4*j+2]-pixels[4*j+0];
+ u[3]=pixels[4*j+1];
+ v[j]=(delta.x*delta.x*delta.x*u[0])+(delta.x*delta.x*u[1])+(delta.x*
+ u[2])+u[3];
+ }
+ u[0]=(v[3]-v[2])-(v[0]-v[1]);
+ u[1]=(v[0]-v[1])-u[0];
+ u[2]=v[2]-v[0];
+ u[3]=v[1];
+ pixel[channel]=ClampToQuantum((delta.y*delta.y*delta.y*u[0])+(delta.y*
+ delta.y*u[1])+(delta.y*u[2])+u[3]);
+ }
+ break;
+ }
+ case BilinearInterpolatePixel:
+ default:
+ {
+ 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++)
+ {
+ PointInfo
+ delta,
+ epsilon;
+
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ delta.x=x-x_offset;
+ delta.y=y-y_offset;
+ epsilon.x=1.0-delta.x;
+ epsilon.y=1.0-delta.y;
+ pixels[0]=(MagickRealType) p[0*GetPixelChannels(source)+i];
+ pixels[1]=(MagickRealType) p[1*GetPixelChannels(source)+i];
+ pixels[2]=(MagickRealType) p[2*GetPixelChannels(source)+i];
+ pixels[3]=(MagickRealType) p[3*GetPixelChannels(source)+i];
+ if ((traits & BlendPixelTrait) == 0)
+ {
+ gamma=((epsilon.y*(epsilon.x+delta.x)+delta.y*(epsilon.x+delta.x)));
+ gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+ pixel[channel]=ClampToQuantum(gamma*(epsilon.y*(epsilon.x*pixels[0]+
+ delta.x*pixels[1])+delta.y*(epsilon.x*pixels[2]+delta.x*
+ pixels[3])));
+ continue;
+ }
+ alpha[0]=QuantumScale*GetPixelAlpha(source,p+0*
+ GetPixelChannels(source));
+ alpha[1]=QuantumScale*GetPixelAlpha(source,p+1*
+ GetPixelChannels(source));
+ alpha[2]=QuantumScale*GetPixelAlpha(source,p+2*
+ GetPixelChannels(source));
+ alpha[3]=QuantumScale*GetPixelAlpha(source,p+3*
+ GetPixelChannels(source));
+ pixels[0]*=alpha[0];
+ pixels[1]*=alpha[1];
+ pixels[2]*=alpha[2];
+ pixels[3]*=alpha[3];
+ gamma=((epsilon.y*(epsilon.x*alpha[0]+delta.x*alpha[1])+delta.y*
+ (epsilon.x*alpha[2]+delta.x*alpha[3])));
+ gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+ pixel[channel]=ClampToQuantum(gamma*(epsilon.y*(epsilon.x*pixels[0]+
+ delta.x*pixels[1])+delta.y*(epsilon.x*pixels[2]+delta.x*pixels[3])));
+ }
+ break;
+ }
+ case FilterInterpolatePixel:
+ {
+ for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+ {
+ CacheView
+ *filter_view;
+
+ Image
+ *excerpt_source,
+ *filter_source;
+
+ RectangleInfo
+ geometry;
+
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ geometry.width=4L;
+ geometry.height=4L;
+ geometry.x=x_offset-1;
+ geometry.y=y_offset-1;
+ excerpt_source=ExcerptImage(source,&geometry,exception);
+ if (excerpt_source == (Image *) NULL)
+ {
+ status=MagickFalse;
+ continue;
+ }
+ filter_source=ResizeImage(excerpt_source,1,1,source->filter,
+ source->blur,exception);
+ excerpt_source=DestroyImage(excerpt_source);
+ if (filter_source == (Image *) NULL)
+ continue;
+ filter_view=AcquireCacheView(filter_source);
+ p=GetCacheViewVirtualPixels(filter_view,0,0,1,1,exception);
+ if (p == (const Quantum *) NULL)
+ status=MagickFalse;
+ else
+ pixel[channel]=p[i];
+ filter_view=DestroyCacheView(filter_view);
+ filter_source=DestroyImage(filter_source);
+ }
+ break;
+ }
+ case IntegerInterpolatePixel:
+ {
+ p=GetCacheViewVirtualPixels(source_view,x_offset,y_offset,1,1,exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+ {
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ pixel[channel]=p[i];
+ }
+ break;
+ }
+ case NearestNeighborInterpolatePixel:
+ {
+ p=GetCacheViewVirtualPixels(source_view,NearestNeighbor(x),
+ NearestNeighbor(y),1,1,exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+ {
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ pixel[channel]=p[i];
+ }
+ break;
+ }
+ case MeshInterpolatePixel:
+ {
+ 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++)
+ {
+ PointInfo
+ delta,
+ luminance;
+
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ pixels[0]=(MagickRealType) p[0*GetPixelChannels(source)+i];
+ pixels[1]=(MagickRealType) p[1*GetPixelChannels(source)+i];
+ pixels[2]=(MagickRealType) p[2*GetPixelChannels(source)+i];
+ pixels[3]=(MagickRealType) p[3*GetPixelChannels(source)+i];
+ if ((traits & BlendPixelTrait) == 0)
+ {
+ alpha[0]=1.0;
+ alpha[1]=1.0;
+ alpha[2]=1.0;
+ alpha[3]=1.0;
+ }
+ else
+ {
+ alpha[0]=QuantumScale*GetPixelAlpha(source,p+0*
+ GetPixelChannels(source));
+ alpha[1]=QuantumScale*GetPixelAlpha(source,p+1*
+ GetPixelChannels(source));
+ alpha[2]=QuantumScale*GetPixelAlpha(source,p+2*
+ GetPixelChannels(source));
+ alpha[3]=QuantumScale*GetPixelAlpha(source,p+3*
+ GetPixelChannels(source));
+ }
+ delta.x=x-x_offset;
+ delta.y=y-y_offset;
+ luminance.x=GetPixelLuminance(source,p)-(double)
+ GetPixelLuminance(source,p+3*GetPixelChannels(source));
+ luminance.y=GetPixelLuminance(source,p+1*GetPixelChannels(source))-
+ (double) GetPixelLuminance(source,p+2*GetPixelChannels(source));
+ if (fabs(luminance.x) < fabs(luminance.y))
+ {
+ /*
+ Diagonal 0-3 NW-SE.
+ */
+ if (delta.x <= delta.y)
+ {
+ /*
+ Bottom-left triangle (pixel: 2, diagonal: 0-3).
+ */
+ delta.y=1.0-delta.y;
+ gamma=MeshInterpolate(&delta,alpha[2],alpha[3],alpha[0]);
+ gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+ pixel[channel]=ClampToQuantum(gamma*MeshInterpolate(&delta,
+ pixels[2],pixels[3],pixels[0]));
+ }
+ else
+ {
+ /*
+ Top-right triangle (pixel: 1, diagonal: 0-3).
+ */
+ delta.x=1.0-delta.x;
+ gamma=MeshInterpolate(&delta,alpha[1],alpha[0],alpha[3]);
+ gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+ pixel[channel]=ClampToQuantum(gamma*MeshInterpolate(&delta,
+ pixels[1],pixels[0],pixels[3]));
+ }
+ }
+ else
+ {
+ /*
+ Diagonal 1-2 NE-SW.
+ */
+ if (delta.x <= (1.0-delta.y))
+ {
+ /*
+ Top-left triangle (pixel: 0, diagonal: 1-2).
+ */
+ gamma=MeshInterpolate(&delta,alpha[0],alpha[1],alpha[2]);
+ gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+ pixel[channel]=ClampToQuantum(gamma*MeshInterpolate(&delta,
+ pixels[0],pixels[1],pixels[2]));
+ }
+ else
+ {
+ /*
+ Bottom-right triangle (pixel: 3, diagonal: 1-2).
+ */
+ delta.x=1.0-delta.x;
+ delta.y=1.0-delta.y;
+ gamma=MeshInterpolate(&delta,alpha[3],alpha[2],alpha[1]);
+ gamma=1.0/(fabs((double) gamma) <= MagickEpsilon ? 1.0 : gamma);
+ pixel[channel]=ClampToQuantum(gamma*MeshInterpolate(&delta,
+ pixels[3],pixels[2],pixels[1]));
+ }
+ }
+ }
+ break;
+ }
+ case SplineInterpolatePixel:
+ {
+ p=GetCacheViewVirtualPixels(source_view,x_offset-1,y_offset-1,4,4,
+ exception);
+ if (p == (const Quantum *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ for (i=0; i < (ssize_t) GetPixelChannels(source); i++)
+ {
+ double
+ sum;
+
+ MagickRealType
+ dx,
+ dy;
+
+ PointInfo
+ delta;
+
+ register ssize_t
+ j;
+
+ ssize_t
+ k,
+ n;
+
+ traits=GetPixelChannelMapTraits(source,(PixelChannel) i);
+ channel=GetPixelChannelMapChannel(source,(PixelChannel) i);
+ destination_traits=GetPixelChannelMapTraits(destination,channel);
+ if ((traits == UndefinedPixelTrait) ||
+ (destination_traits == UndefinedPixelTrait))
+ continue;
+ if ((traits & BlendPixelTrait) == 0)
+ for (j=0; j < 16; j++)
+ {
+ alpha[j]=1.0;
+ pixels[j]=(MagickRealType) p[j*GetPixelChannels(source)+i];
+ }
+ else
+ for (j=0; j < 16; j++)
+ {
+ alpha[j]=QuantumScale*GetPixelAlpha(source,p+j*
+ GetPixelChannels(source));
+ pixels[j]=alpha[j]*p[j*GetPixelChannels(source)+i];
+ }
+ delta.x=x-x_offset;
+ delta.y=y-y_offset;
+ sum=0.0;
+ n=0;
+ for (j=(-1); j < 3L; j++)
+ {
+ dy=CubicWeightingFunction((MagickRealType) j-delta.y);
+ for (k=(-1); k < 3L; k++)
+ {
+ dx=CubicWeightingFunction(delta.x-(MagickRealType) k);
+ gamma=1.0/(fabs((double) alpha[n]) <= MagickEpsilon ? 1.0 :
+ alpha[n]);
+ sum+=gamma*dx*dy*pixels[n];
+ n++;
+ }
+ }
+ pixel[channel]=ClampToQuantum(sum);
+ }
+ break;
+ }
+ }
+ return(status);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% I n t e r p o l a t e P i x e l I n f o %
% %
% %
% The format of the InterpolatePixelInfo method is:
%
% MagickBooleanType InterpolatePixelInfo(const Image *image,
-% const CacheView *image_view,const InterpolatePixelMethod method,
+% const CacheView *image_view,const PixelInterpolateMethod method,
% const double x,const double y,PixelInfo *pixel,
% ExceptionInfo *exception)
%
}
MagickExport MagickBooleanType InterpolatePixelInfo(const Image *image,
- const CacheView *image_view,const InterpolatePixelMethod method,
+ const CacheView *image_view,const PixelInterpolateMethod method,
const double x,const double y,PixelInfo *pixel,ExceptionInfo *exception)
{
MagickBooleanType
MeshInterpolatePixel,
NearestNeighborInterpolatePixel,
SplineInterpolatePixel
-} InterpolatePixelMethod;
+} PixelInterpolateMethod;
typedef enum
{
BlendPixelTrait = 0x000004
} PixelTrait;
-typedef struct _DoublePixelPacket
-{
- double
- red,
- green,
- blue,
- alpha,
- black;
-} DoublePixelPacket;
-
-typedef struct _LongPixelPacket
-{
- unsigned int
- red,
- green,
- blue,
- alpha,
- black;
-} LongPixelPacket;
-
typedef struct _PixelChannelMap
{
PixelChannel
traits;
} PixelChannelMap;
+typedef struct _PixelDoublePacket
+{
+ double
+ red,
+ green,
+ blue,
+ alpha,
+ black;
+} PixelDoublePacket;
+
typedef struct _PixelInfo
{
ClassType
index;
} PixelInfo;
+typedef struct _PixelLongPacket
+{
+ unsigned int
+ red,
+ green,
+ blue,
+ alpha,
+ black;
+} PixelLongPacket;
+
typedef struct _PixelPacket
{
Quantum
ImportImagePixels(Image *,const ssize_t,const ssize_t,const size_t,
const size_t,const char *,const StorageType,const void *,ExceptionInfo *),
InterpolatePixelChannel(const Image *,const CacheView_ *,
- const PixelChannel,const InterpolatePixelMethod,const double,const double,
+ const PixelChannel,const PixelInterpolateMethod,const double,const double,
double *,ExceptionInfo *),
+ InterpolatePixelChannels(const Image *,const CacheView_ *,const Image *,
+ const PixelInterpolateMethod,const double,const double,Quantum *,
+ ExceptionInfo *),
InterpolatePixelInfo(const Image *,const CacheView_ *,
- const InterpolatePixelMethod,const double,const double,PixelInfo *,
+ const PixelInterpolateMethod,const double,const double,PixelInfo *,
ExceptionInfo *),
IsFuzzyEquivalencePixel(const Image *,const Quantum *,
const Quantum *),
value);
if (interpolate < 0)
break;
- image->interpolate=(InterpolatePixelMethod) interpolate;
+ image->interpolate=(PixelInterpolateMethod) interpolate;
break;
}
status=AddValueToSplayTree((SplayTreeInfo *) image->properties,
ssize_t
image_area;
- InterpolatePixelMethod
+ PixelInterpolateMethod
interpolate;
VirtualPixelMethod
%
*/
MagickExport MagickBooleanType SetResampleFilterInterpolateMethod(
- ResampleFilter *resample_filter,const InterpolatePixelMethod method)
+ ResampleFilter *resample_filter,const PixelInterpolateMethod method)
{
assert(resample_filter != (ResampleFilter *) NULL);
assert(resample_filter->signature == MagickSignature);
ResamplePixelColor(ResampleFilter *,const double,const double,
PixelInfo *),
SetResampleFilterInterpolateMethod(ResampleFilter *,
- const InterpolatePixelMethod),
+ const PixelInterpolateMethod),
SetResampleFilterVirtualPixelMethod(ResampleFilter *,
const VirtualPixelMethod);
% The format of the AdaptiveResizeImage method is:
%
% Image *AdaptiveResizeImage(const Image *image,const size_t columns,
-% const size_t rows,ExceptionInfo *exception)
+% const size_t rows,const PixelInterpolateMethod method,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o rows: the number of rows in the resized image.
%
+% o method: the pixel interpolation method.
+%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport Image *AdaptiveResizeImage(const Image *image,
- const size_t columns,const size_t rows,ExceptionInfo *exception)
+ const size_t columns,const size_t rows,const PixelInterpolateMethod method,
+ ExceptionInfo *exception)
{
#define AdaptiveResizeImageTag "Resize/Image"
offset.y=((MagickRealType) (y+0.5)*image->rows/resize_image->rows);
for (x=0; x < (ssize_t) resize_image->columns; x++)
{
- register ssize_t
- i;
-
offset.x=((MagickRealType) (x+0.5)*image->columns/resize_image->columns);
- for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
- {
- double
- pixel;
-
- PixelChannel
- channel;
-
- PixelTrait
- resize_traits,
- traits;
-
- traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
- channel=GetPixelChannelMapChannel(image,(PixelChannel) i);
- resize_traits=GetPixelChannelMapTraits(resize_image,channel);
- if ((traits == UndefinedPixelTrait) ||
- (resize_traits == UndefinedPixelTrait))
- continue;
- status=InterpolatePixelChannel(image,image_view,(PixelChannel) i,
- MeshInterpolatePixel,offset.x-0.5,offset.y-0.5,&pixel,exception);
- q[channel]=ClampToQuantum(pixel);
- }
+ status=InterpolatePixelChannels(image,image_view,resize_image,
+ method,offset.x-0.5,offset.y-0.5,q,exception);
q+=GetPixelChannels(resize_image);
}
if (SyncCacheViewAuthenticPixels(resize_view,exception) == MagickFalse)
#endif
extern MagickExport Image
- *AdaptiveResizeImage(const Image *,const size_t,const size_t,ExceptionInfo *),
+ *AdaptiveResizeImage(const Image *,const size_t,const size_t,
+ const PixelInterpolateMethod,ExceptionInfo *),
*LiquidRescaleImage(const Image *,const size_t,const size_t,const double,
const double,ExceptionInfo *),
*MagnifyImage(const Image *,ExceptionInfo *),
CacheView
*image_view;
- LongPixelPacket
+ PixelLongPacket
levels;
MagickBooleanType
/* Parse level values as a geometry */
/* This difficult!
* How to map GeometryInfo structure elements into
- * LongPixelPacket structure elements, but according to channel?
+ * PixelLongPacket structure elements, but according to channel?
* Note the channels list may skip elements!!!!
* EG -channel BA -ordered-dither map,2,3
* will need to map g.rho -> l.blue, and g.sigma -> l.alpha
*/
#define MagickPackageName "ImageMagick"
#define MagickCopyright "Copyright (C) 1999-2011 ImageMagick Studio LLC"
-#define MagickSVNRevision "5245"
+#define MagickSVNRevision "exported"
#define MagickLibVersion 0x700
#define MagickLibVersionText "7.0.0"
#define MagickLibVersionNumber 7,0,0
#define MagickLibAddendum "-0"
#define MagickLibInterface 7
#define MagickLibMinInterface 7
-#define MagickReleaseDate "2011-09-10"
+#define MagickReleaseDate "2011-09-11"
#define MagickChangeDate "20110801"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
#if defined(MAGICKCORE_OPENMP_SUPPORT)
% triangulation.
%
% MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
-% const size_t columns,const size_t rows)
+% const size_t columns,const size_t rows,
+% const PixelInterpolateMethod method)
%
% A description of each parameter follows:
%
%
% o rows: the number of rows in the scaled image.
%
+% o interpolate: the pixel interpolation method.
+%
*/
WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
- const size_t columns,const size_t rows)
+ const size_t columns,const size_t rows,const PixelInterpolateMethod method)
{
Image
*resize_image;
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
+ resize_image=AdaptiveResizeImage(wand->images,columns,rows,method,
+ wand->exception);
if (resize_image == (Image *) NULL)
return(MagickFalse);
ReplaceImageInList(&wand->images,resize_image);
% The format of the MagickClutImage method is:
%
% MagickBooleanType MagickClutImage(MagickWand *wand,
-% const MagickWand *clut_wand)
+% const MagickWand *clut_wand,const PixelInterpolateMethod method)
%
% A description of each parameter follows:
%
%
% o clut_image: the clut image.
%
+% o method: the pixel interpolation method.
+%
*/
WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
- const MagickWand *clut_wand)
+ const MagickWand *clut_wand,const PixelInterpolateMethod method)
{
MagickBooleanType
status;
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- status=ClutImage(wand->images,clut_wand->images,&wand->images->exception);
+ status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
return(status);
}
\f
%
% The format of the MagickGetImageInterpolateMethod method is:
%
-% InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
+% PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
+% MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
*/
-WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
+WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
MagickWand *wand)
{
assert(wand != (MagickWand *) NULL);
% The format of the MagickPolaroidImage method is:
%
% MagickBooleanType MagickPolaroidImage(MagickWand *wand,
-% const DrawingWand *drawing_wand,const double angle)
+% const DrawingWand *drawing_wand,const double angle,
+% const PixelInterpolateMethod method)
%
% A description of each parameter follows:
%
%
% o angle: Apply the effect along this angle.
%
+% o method: the pixel interpolation method.
+%
*/
WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
- const DrawingWand *drawing_wand,const double angle)
+ const DrawingWand *drawing_wand,const double angle,
+ const PixelInterpolateMethod method)
{
DrawInfo
*draw_info;
draw_info=PeekDrawingWand(drawing_wand);
if (draw_info == (DrawInfo *) NULL)
return(MagickFalse);
- polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
+ polaroid_image=PolaroidImage(wand->images,draw_info,angle,method,
+ wand->exception);
if (polaroid_image == (Image *) NULL)
return(MagickFalse);
ReplaceImageInList(&wand->images,polaroid_image);
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
+% MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
%
-% The format of the MagickSetImageInterpolateMethod method is:
+% The format of the MagickSetImagePixelInterpolateMethod method is:
%
-% MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
-% const InterpolatePixelMethod method)
+% MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
+% const PixelInterpolateMethod method)
%
% A description of each parameter follows:
%
% Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
%
*/
-WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
- const InterpolatePixelMethod method)
+WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
+ const PixelInterpolateMethod method)
{
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
%
% The format of the MagickSpreadImage method is:
%
-% MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
+% MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
+% const PixelInterpolateMethod method)
%
% A description of each parameter follows:
%
%
% o radius: Choose a random pixel in a neighborhood of this extent.
%
+% o method: the pixel interpolation method.
+%
*/
WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
- const double radius)
+ const double radius,const PixelInterpolateMethod method)
{
Image
*spread_image;
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- spread_image=SpreadImage(wand->images,radius,wand->exception);
+ spread_image=SpreadImage(wand->images,radius,method,wand->exception);
if (spread_image == (Image *) NULL)
return(MagickFalse);
ReplaceImageInList(&wand->images,spread_image);
%
% The format of the MagickWaveImage method is:
%
-% MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
-% const double wave_length)
+% MagickBooleanType MagickWaveImage(MagickWand *wand,
+% const double amplitude,const double wave_length,
+% const PixelInterpolateMethod method)
%
% A description of each parameter follows:
%
% o amplitude, wave_length: Define the amplitude and wave length of the
% sine wave.
%
+% o method: the pixel interpolation method.
+%
*/
WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
- const double amplitude,const double wave_length)
+ const double amplitude,const double wave_length,
+ const PixelInterpolateMethod method)
{
Image
*wave_image;
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
+ wave_image=WaveImage(wand->images,amplitude,wave_length,method,
+ wand->exception);
if (wave_image == (Image *) NULL)
return(MagickFalse);
ReplaceImageInList(&wand->images,wave_image);
extern WandExport InterlaceType
MagickGetImageInterlaceScheme(MagickWand *);
-extern WandExport InterpolatePixelMethod
- MagickGetImageInterpolateMethod(MagickWand *);
+extern WandExport PixelInterpolateMethod
+ MagickGetImagePixelInterpolateMethod(MagickWand *);
extern WandExport MagickBooleanType
MagickAdaptiveBlurImage(MagickWand *,const double,const double,const double),
- MagickAdaptiveResizeImage(MagickWand *,const size_t,const size_t),
+ MagickAdaptiveResizeImage(MagickWand *,const size_t,const size_t,
+ const PixelInterpolateMethod),
MagickAdaptiveSharpenImage(MagickWand *,const double,const double,
const double),
MagickAdaptiveThresholdImage(MagickWand *,const size_t,const size_t,
MagickClampImage(MagickWand *),
MagickClipImage(MagickWand *),
MagickClipImagePath(MagickWand *,const char *,const MagickBooleanType),
- MagickClutImage(MagickWand *,const MagickWand *),
+ MagickClutImage(MagickWand *,const MagickWand *,const PixelInterpolateMethod),
MagickColorDecisionListImage(MagickWand *,const char *),
MagickColorizeImage(MagickWand *,const PixelWand *,const PixelWand *),
MagickColorMatrixImage(MagickWand *,const KernelInfo *),
MagickPingImage(MagickWand *,const char *),
MagickPingImageBlob(MagickWand *,const void *,const size_t),
MagickPingImageFile(MagickWand *,FILE *),
- MagickPolaroidImage(MagickWand *,const DrawingWand *,const double),
+ MagickPolaroidImage(MagickWand *,const DrawingWand *,const double,
+ const PixelInterpolateMethod),
MagickPosterizeImage(MagickWand *,const size_t,const MagickBooleanType),
MagickPreviousImage(MagickWand *),
MagickQuantizeImage(MagickWand *,const size_t,const ColorspaceType,
MagickSetImageGravity(MagickWand *,const GravityType),
MagickSetImageGreenPrimary(MagickWand *,const double,const double),
MagickSetImageInterlaceScheme(MagickWand *,const InterlaceType),
- MagickSetImageInterpolateMethod(MagickWand *,const InterpolatePixelMethod),
+ MagickSetImagePixelInterpolateMethod(MagickWand *,const PixelInterpolateMethod),
MagickSetImageIterations(MagickWand *,const size_t),
MagickSetImageMatte(MagickWand *,const MagickBooleanType),
MagickSetImageMatteColor(MagickWand *,const PixelWand *),
const double *),
MagickSpliceImage(MagickWand *,const size_t,const size_t,const ssize_t,
const ssize_t),
- MagickSpreadImage(MagickWand *,const double),
+ MagickSpreadImage(MagickWand *,const double,const PixelInterpolateMethod),
MagickStatisticImage(MagickWand *,const StatisticType,const size_t,
const size_t),
MagickStripImage(MagickWand *),
const double),
MagickVignetteImage(MagickWand *,const double,const double,const ssize_t,
const ssize_t),
- MagickWaveImage(MagickWand *,const double,const double),
+ MagickWaveImage(MagickWand *,const double,const double,
+ const PixelInterpolateMethod),
MagickWhiteThresholdImage(MagickWand *,const PixelWand *),
MagickWriteImage(MagickWand *,const char *),
MagickWriteImageFile(MagickWand *,FILE *),
%
% The format of the MagickGetInterpolateMethod method is:
%
-% InterpolatePixelMethod MagickGetInterpolateMethod(MagickWand *wand)
+% PixelInterpolateMethod MagickGetInterpolateMethod(MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
*/
-WandExport InterpolatePixelMethod MagickGetInterpolateMethod(MagickWand *wand)
+WandExport PixelInterpolateMethod MagickGetInterpolateMethod(MagickWand *wand)
{
const char
*option;
- InterpolatePixelMethod
+ PixelInterpolateMethod
method;
assert(wand != (MagickWand *) NULL);
option=GetImageOption(wand->image_info,"interpolate");
if (option == (const char *) NULL)
return(UndefinedInterpolatePixel);
- method=(InterpolatePixelMethod) ParseCommandOption(MagickInterpolateOptions,
+ method=(PixelInterpolateMethod) ParseCommandOption(MagickInterpolateOptions,
MagickFalse,option);
return(method);
}
%
*/
WandExport MagickBooleanType MagickSetInterpolateMethod(MagickWand *wand,
- const InterpolatePixelMethod method)
+ const PixelInterpolateMethod method)
{
MagickBooleanType
status;
extern WandExport InterlaceType
MagickGetInterlaceScheme(MagickWand *);
-extern WandExport InterpolatePixelMethod
+extern WandExport PixelInterpolateMethod
MagickGetInterpolateMethod(MagickWand *);
extern WandExport OrientationType
MagickSetImageProfile(MagickWand *,const char *,const void *,const size_t),
MagickSetImageProperty(MagickWand *,const char *,const char *),
MagickSetInterlaceScheme(MagickWand *,const InterlaceType),
- MagickSetInterpolateMethod(MagickWand *,const InterpolatePixelMethod),
+ MagickSetInterpolateMethod(MagickWand *,const PixelInterpolateMethod),
MagickSetOption(MagickWand *,const char *,const char *),
MagickSetOrientation(MagickWand *,const OrientationType),
MagickSetPage(MagickWand *,const size_t,const size_t,const ssize_t,
(void) SyncImageSettings(mogrify_info,*image);
(void) ParseRegionGeometry(*image,argv[i+1],&geometry,exception);
mogrify_image=AdaptiveResizeImage(*image,geometry.width,
- geometry.height,exception);
+ geometry.height,(*image)->interpolate,exception);
break;
}
if (LocaleCompare("adaptive-sharpen",option+1) == 0)
flags=ParseGeometry(argv[i+1],&geometry_info);
angle=geometry_info.rho;
}
- mogrify_image=PolaroidImage(*image,draw_info,angle,exception);
+ mogrify_image=PolaroidImage(*image,draw_info,angle,
+ (*image)->interpolate,exception);
break;
}
if (LocaleCompare("posterize",option+1) == 0)
*/
(void) SyncImageSettings(mogrify_info,*image);
(void) ParseGeometry(argv[i+1],&geometry_info);
- mogrify_image=SpreadImage(*image,geometry_info.rho,exception);
+ mogrify_image=SpreadImage(*image,geometry_info.rho,
+ (*image)->interpolate,exception);
break;
}
if (LocaleCompare("statistic",option+1) == 0)
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
mogrify_image=WaveImage(*image,geometry_info.rho,
- geometry_info.sigma,exception);
+ geometry_info.sigma,(*image)->interpolate,exception);
break;
}
if (LocaleCompare("weight",option+1) == 0)
status=MagickFalse;
break;
}
- (void) ClutImage(image,clut_image,exception);
+ (void) ClutImage(image,clut_image,image->interpolate,exception);
clut_image=DestroyImage(clut_image);
*images=DestroyImageList(*images);
*images=image;
{ "Shear", { {"geometry", StringReference}, {"x", RealReference},
{"y", RealReference}, { "fill", StringReference},
{"color", StringReference} } },
- { "Spread", { {"radius", RealReference} } },
+ { "Spread", { {"radius", RealReference},
+ {"interpolate", MagickInterpolateOptions} } },
{ "Swirl", { {"degrees", RealReference},
{"interpolate", MagickInterpolateOptions} } },
{ "Resize", { {"geometry", StringReference}, {"width", IntegerReference},
{ "AdaptiveResize", { {"geometry", StringReference},
{"width", IntegerReference}, {"height", IntegerReference},
{"filter", MagickFilterOptions}, {"support", StringReference },
- {"blur", RealReference } } },
+ {"blur", RealReference }, {"interpolate", MagickInterpolateOptions} } },
{ "ClipMask", { {"mask", ImageReference} } },
{ "LinearStretch", { {"levels", StringReference},
{"black-point", RealReference},{"white-point", RealReference} } },
{"font", StringReference}, {"stroke", StringReference},
{"fill", StringReference}, {"strokewidth", RealReference},
{"pointsize", RealReference}, {"gravity", MagickGravityOptions},
- {"background", StringReference} } },
+ {"background", StringReference},
+ {"interpolate", MagickInterpolateOptions} } },
{ "FloodfillPaint", { {"geometry", StringReference},
{"x", IntegerReference}, {"y", IntegerReference},
{"fill", StringReference}, {"bordercolor", StringReference},
{"virtual-pixel", MagickVirtualPixelOptions},
{"best-fit", MagickBooleanOptions} } },
{ "Clut", { {"image", ImageReference},
+ {"interpolate", MagickInterpolateOptions},
{"channel", MagickChannelOptions} } },
{ "LiquidRescale", { {"geometry", StringReference},
{"width", IntegerReference}, {"height", IntegerReference},
if (attribute_flag[0] == 0)
argument_list[0].real_reference=0.5;
if (attribute_flag[1] != 0)
- image->interpolate=(InterpolatePixelMethod)
+ image->interpolate=(PixelInterpolateMethod)
argument_list[1].integer_reference;
image=ImplodeImage(image,argument_list[0].real_reference,
exception);
}
case 29: /* Spread */
{
+ PixelInterpolateMethod
+ method;
+
if (attribute_flag[0] == 0)
argument_list[0].real_reference=1.0;
- image=SpreadImage(image,argument_list[0].real_reference,exception);
+ method=UndefinedInterpolatePixel;
+ if (attribute_flag[1] != 0)
+ method=(PixelInterpolateMethod) argument_list[1].integer_reference;
+ image=SpreadImage(image,argument_list[0].real_reference,method,
+ exception);
break;
}
case 30: /* Swirl */
if (attribute_flag[0] == 0)
argument_list[0].real_reference=50.0;
if (attribute_flag[1] != 0)
- image->interpolate=(InterpolatePixelMethod)
+ image->interpolate=(PixelInterpolateMethod)
argument_list[1].integer_reference;
image=SwirlImage(image,argument_list[0].real_reference,exception);
break;
QueryColorDatabase(argument_list[9].string_reference,
&composite_image->background_color,exception);
if (attribute_flag[12] != 0) /* "interpolate=>" */
- image->interpolate=(InterpolatePixelMethod)
+ image->interpolate=(PixelInterpolateMethod)
argument_list[12].integer_reference;
if (attribute_flag[13] != 0) /* "args=>" */
(void) SetImageArtifact(composite_image,"compose:args",
}
}
if (attribute_flag[23] != 0)
- image->interpolate=(InterpolatePixelMethod)
+ image->interpolate=(PixelInterpolateMethod)
argument_list[23].integer_reference;
if ((attribute_flag[24] != 0) &&
(draw_info->fill_pattern != (Image *) NULL))
}
case 60: /* Wave */
{
+ PixelInterpolateMethod
+ method;
+
if (attribute_flag[0] != 0)
{
flags=ParseGeometry(argument_list[0].string_reference,
geometry_info.rho=argument_list[1].real_reference;
if (attribute_flag[2] != 0)
geometry_info.sigma=argument_list[2].real_reference;
+ method=UndefinedInterpolatePixel;
if (attribute_flag[3] != 0)
- image->interpolate=(InterpolatePixelMethod)
- argument_list[3].integer_reference;
+ method=(PixelInterpolateMethod) argument_list[3].integer_reference;
image=WaveImage(image,geometry_info.rho,geometry_info.sigma,
- exception);
+ method,exception);
break;
}
case 61: /* Separate */
current.rx*affine.tx+current.sy*affine.ty+current.ty;
}
if (attribute_flag[6] != 0)
- image->interpolate=(InterpolatePixelMethod)
+ image->interpolate=(PixelInterpolateMethod)
argument_list[6].integer_reference;
if (attribute_flag[7] != 0)
QueryColorDatabase(argument_list[7].string_reference,
}
case 105: /* AdaptiveResize */
{
+ PixelInterpolateMethod
+ method;
+
if (attribute_flag[0] != 0)
flags=ParseRegionGeometry(image,argument_list[0].string_reference,
&geometry,exception);
argument_list[4].string_reference);
if (attribute_flag[5] != 0)
image->blur=argument_list[5].real_reference;
+ method=UndefinedInterpolatePixel;
+ if (attribute_flag[6] != 0)
+ method=(PixelInterpolateMethod) argument_list[6].integer_reference;
image=AdaptiveResizeImage(image,geometry.width,geometry.height,
- exception);
+ method,exception);
break;
}
case 106: /* ClipMask */
double
angle;
+ PixelInterpolateMethod
+ method;
+
draw_info=CloneDrawInfo(info ? info->image_info : (ImageInfo *) NULL,
(DrawInfo *) NULL);
if (attribute_flag[0] != 0)
if (attribute_flag[8] != 0)
(void) QueryColorDatabase(argument_list[8].string_reference,
&image->background_color,exception);
- image=PolaroidImage(image,draw_info,angle,exception);
+ method=UndefinedInterpolatePixel;
+ if (attribute_flag[9] != 0)
+ method=(PixelInterpolateMethod) argument_list[9].integer_reference;
+ image=PolaroidImage(image,draw_info,angle,method,exception);
draw_info=DestroyDrawInfo(draw_info);
break;
}
}
case 113: /* Clut */
{
+ PixelInterpolateMethod
+ method;
+
if (attribute_flag[0] == 0)
{
ThrowPerlException(exception,OptionError,"ClutImageRequired",
PackageName);
goto PerlException;
}
+ method=UndefinedInterpolatePixel;
if (attribute_flag[1] != 0)
- channel=(ChannelType) argument_list[1].integer_reference;
+ method=(PixelInterpolateMethod) argument_list[1].integer_reference;
+ if (attribute_flag[2] != 0)
+ channel=(ChannelType) argument_list[2].integer_reference;
channel_mask=SetPixelChannelMask(image,channel);
- (void) ClutImage(image,argument_list[0].image_reference,exception);
+ (void) ClutImage(image,argument_list[0].image_reference,method,
+ exception);
(void) SetPixelChannelMask(image,channel_mask);
break;
}
count=ReadBlob(image,2,magick);
do
{
- LongPixelPacket
+ PixelLongPacket
shift;
PixelPacket
int
byte;
- LongPixelPacket
+ PixelLongPacket
pixel;
/*
}
}
spread_image=SpreadImage(msl_info->image[n],geometry_info.rho,
- &msl_info->image[n]->exception);
+ msl_info->image[n]->interpolate,&msl_info->image[n]->exception);
if (spread_image == (Image *) NULL)
break;
msl_info->image[n]=DestroyImage(msl_info->image[n]);
double
file_gamma;
- LongPixelPacket
+ PixelLongPacket
transparent_color;
MagickBooleanType
y,
y_offset;
- LongPixelPacket
+ PixelLongPacket
pixel;
MagickBooleanType