% October 2002 %
% %
% %
-% Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
#include "magick/enhance.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
+#include "magick/fx.h"
#include "magick/geometry.h"
#include "magick/identify.h"
#include "magick/image.h"
#include "magick/magick.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
+#include "magick/morphology.h"
#include "magick/paint.h"
#include "magick/pixel.h"
#include "magick/pixel-private.h"
#include "magick/semaphore.h"
#include "magick/segment.h"
#include "magick/splay-tree.h"
+#include "magick/statistic.h"
#include "magick/string_.h"
#include "magick/threshold.h"
#include "magick/transform.h"
% %
% %
% A c q u i r e I m a g e P i x e l s %
-% %
-% %
+% % % %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Pixels accessed via the returned pointer represent a simple array of type
% PixelPacket. If the image type is CMYK or the storage class is PseudoClass,
-% call GetAuthenticIndexQueue() after invoking GetAuthenticPixels() to access the
-% black color component or to obtain the colormap indexes (of type IndexPacket)
-% corresponding to the region.
+% call GetAuthenticIndexQueue() after invoking GetAuthenticPixels() to access
+% the black color component or to obtain the colormap indexes (of type
+% IndexPacket) corresponding to the region.
%
% If you plan to modify the pixels, use GetAuthenticPixels() instead.
%
% %
% %
% %
-% A c q u i r e S t r i n g %
+% A l l o c a t e S t r i n g %
% %
% %
% %
% %
% %
% %
+% A v e r a g e I m a g e s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% AverageImages() takes a set of images and averages them together. Each
+% image in the set must have the same width and height. AverageImages()
+% returns a single image with each corresponding pixel component of each
+% image averaged. On failure, a NULL image is returned and exception
+% describes the reason for the failure.
+%
+% The format of the AverageImages method is:
+%
+% Image *AverageImages(Image *images,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image sequence.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *AverageImages(const Image *images,ExceptionInfo *exception)
+{
+ return(EvaluateImages(images,MeanEvaluateOperator,exception));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% C h a n n e l I m a g e %
% %
% %
while (s > segment_stack)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
register long
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Pop segment off stack.
for (y=0; y < (long) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
register long
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Tile fill color onto floodplane.
*/
MagickExport void DestroyMagickRegistry(void)
{
- DestroyRegistryComponent();
+ RegistryComponentTerminus();
}
\f
/*
const long x_offset,const long y_offset,const double similarity_threshold,
ExceptionInfo *exception)
{
+ CacheView
+ *image_view,
+ *reference_view;
+
long
y;
normalized_similarity,
similarity;
- CacheView
- *image_view,
- *reference_view;
-
/*
Compute the similarity in pixels between two images.
*/
*/
if ((reference->columns > image->columns) || (reference->rows > image->rows))
return((Image *) NULL);
- similarity_threshold=image->columns*image->rows;
+ similarity_threshold=(double) image->columns*image->rows;
SetGeometry(reference,&offset);
-#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
- #pragma omp parallel for
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(dynamic,4)
#endif
for (y=0; y < (long) (image->rows-reference->rows); y++)
{
{
similarity=GetSimilarityMetric(image,reference,x,y,similarity_threshold,
exception);
-#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_ExtractSubimageFromImage)
#endif
if (similarity < similarity_threshold)
operands;
va_start(operands,format);
- FormatMagickStringList(string,MaxTextExtent,format,operands);
+ (void) FormatMagickStringList(string,MaxTextExtent,format,operands);
va_end(operands);
return;
}
blob=FileToBlob(path,~0,length,exception);
}
#endif
-#if defined(__WINDOWS__) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
if (blob == (void *) NULL)
{
char
*/
if ((blob == (void *) NULL) && (IsPathAccessible(path) != MagickFalse))
blob=FileToBlob(path,~0,length,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
/*
Search Windows registry.
*/
if (attribute != (const ImageAttribute *) NULL)
return(attribute);
}
- attribute=(ImageAttribute *) AcquireMagickMemory(sizeof(*attribute));
+ attribute=(ImageAttribute *) AcquireAlignedMemory(1,sizeof(*attribute));
if (attribute == (ImageAttribute *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(attribute,0,sizeof(*attribute));
r=HueToRGB(m1,m2,hue+1.0/3.0);
g=HueToRGB(m1,m2,hue);
b=HueToRGB(m1,m2,hue-1.0/3.0);
- *red=RoundToQuantum((MagickRealType) QuantumRange*r);
- *green=RoundToQuantum((MagickRealType) QuantumRange*g);
- *blue=RoundToQuantum((MagickRealType) QuantumRange*b);
+ *red=ClampToQuantum((MagickRealType) QuantumRange*r);
+ *green=ClampToQuantum((MagickRealType) QuantumRange*g);
+ *blue=ClampToQuantum((MagickRealType) QuantumRange*b);
}
\f
/*
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
alpha[n]=1.0;
if (image->matte != MagickFalse)
{
- alpha[n]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[n]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[n].red*=alpha[n];
pixels[n].green*=alpha[n];
pixels[n].blue*=alpha[n];
MagickExport void LiberateSemaphoreInfo(SemaphoreInfo **semaphore_info)
{
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.7");
- RelinquishSemaphoreInfo(*semaphore_info);
+ UnlockSemaphoreInfo(*semaphore_info);
}
\f
/*
while (s > segment_stack)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
register long
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Pop segment off stack.
for (y=0; y < (long) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
register long
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Tile fill color onto floodplane.
% %
% %
% %
+% M a x i m u m I m a g e s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MaximumImages() returns the maximum intensity of an image sequence.
+%
+% The format of the MaxImages method is:
+%
+% Image *MaximumImages(Image *images,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o images: the image sequence.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *MaximumImages(const Image *images,ExceptionInfo *exception)
+{
+ return(EvaluateImages(images,MinEvaluateOperator,exception));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% M i n i m u m I m a g e s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MinimumImages() returns the minimum intensity of an image sequence.
+%
+% The format of the MinimumImages method is:
+%
+% Image *MinimumImages(Image *images,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o images: the image sequence.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *MinimumImages(const Image *images,ExceptionInfo *exception)
+{
+ return(EvaluateImages(images,MinEvaluateOperator,exception));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% M o s a i c I m a g e s %
% %
% %
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
register IndexPacket
index,
- *__restrict indexes;
+ *restrict indexes;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
% %
% %
% %
+% R e c o l o r I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% RecolorImage() apply color transformation to an image. The method permits
+% saturation changes, hue rotation, luminance to alpha, and various other
+% effects. Although variable-sized transformation matrices can be used,
+% typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
+% (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
+% except offsets are in column 6 rather than 5 (in support of CMYKA images)
+% and offsets are normalized (divide Flash offset by 255).
+%
+% The format of the RecolorImage method is:
+%
+% Image *RecolorImage(const Image *image,const unsigned long order,
+% const double *color_matrix,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o order: the number of columns and rows in the recolor matrix.
+%
+% o color_matrix: An array of double representing the recolor matrix.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *RecolorImage(const Image *image,const unsigned long order,
+ const double *color_matrix,ExceptionInfo *exception)
+{
+ KernelInfo
+ *kernel_info;
+
+ Image
+ *recolor_image;
+
+ kernel_info=AcquireKernelInfo((const char *) NULL);
+ kernel_info->width=order;
+ kernel_info->height=order;
+ kernel_info->values=(double *) color_matrix;
+ recolor_image=ColorMatrixImage(image,kernel_info,exception);
+ kernel_info->values=(double *) NULL;
+ kernel_info=DestroyKernelInfo(kernel_info);
+ return(recolor_image);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% R e s e t I m a g e A t t r i b u t e I t e r a t o r %
% %
% %
for (y=0; y < (long) image->rows; y++)
{
register IndexPacket
- *__restrict indexes;
+ *restrict indexes;
register long
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
for (y=0; y < (long) image->rows; y++)
{
register IndexPacket
- *__restrict indexes;
+ *restrict indexes;
register long
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
for (y=0; y < (long) image->rows; y++)
{
register IndexPacket
- *__restrict indexes;
+ *restrict indexes;
register long
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)