]> granicus.if.org Git - imagemagick/blobdiff - magick/deprecate.c
(no commit message)
[imagemagick] / magick / deprecate.c
index 761a447a0c196659d5962c2f75bc7167b198b8d2..52d1f45a2386345afc4cf62f2a3f02d479daf92d 100644 (file)
@@ -17,7 +17,7 @@
 %                                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  %
@@ -62,6 +62,7 @@
 #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"
@@ -72,6 +73,7 @@
 #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"
@@ -81,6 +83,7 @@
 #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"
@@ -166,8 +169,7 @@ MagickExport const PixelPacket *AcquireCacheViewPixels(
 %                                                                             %
 %                                                                             %
 %   A c q u i r e I m a g e P i x e l s                                        %
-%                                                                             %
-%                                                                             %
+%                                                                             % %                                                                             %
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
@@ -182,9 +184,9 @@ MagickExport const PixelPacket *AcquireCacheViewPixels(
 %
 %  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.
 %
@@ -687,7 +689,7 @@ MagickExport void AllocateNextImage(const ImageInfo *image_info,Image *image)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   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                                               %
 %                                                                             %
 %                                                                             %
 %                                                                             %
@@ -730,6 +732,39 @@ MagickExport char *AllocateString(const char *source)
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%     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                                                 %
 %                                                                             %
 %                                                                             %
@@ -1102,13 +1137,13 @@ MagickExport MagickBooleanType ColorFloodfillImage(Image *image,
   while (s > segment_stack)
   {
     register const PixelPacket
-      *__restrict p;
+      *restrict p;
 
     register long
       x;
 
     register PixelPacket
-      *__restrict q;
+      *restrict q;
 
     /*
       Pop segment off stack.
@@ -1222,13 +1257,13 @@ MagickExport MagickBooleanType ColorFloodfillImage(Image *image,
   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.
@@ -1383,7 +1418,7 @@ MagickExport MagickBooleanType DeleteMagickRegistry(const long id)
 */
 MagickExport void DestroyMagickRegistry(void)
 {
-  DestroyRegistryComponent();
+  RegistryComponentTerminus();
 }
 \f
 /*
@@ -1608,6 +1643,10 @@ static double GetSimilarityMetric(const Image *image,const Image *reference,
   const long x_offset,const long y_offset,const double similarity_threshold,
   ExceptionInfo *exception)
 {
+  CacheView
+    *image_view,
+    *reference_view;
+
   long
     y;
 
@@ -1616,10 +1655,6 @@ static double GetSimilarityMetric(const Image *image,const Image *reference,
     normalized_similarity,
     similarity;
 
-  CacheView
-    *image_view,
-    *reference_view;
-
   /*
     Compute the similarity in pixels between two images.
   */
@@ -1706,10 +1741,10 @@ MagickExport Image *ExtractSubimageFromImage(Image *image,
   */
   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++)
   {
@@ -1723,7 +1758,7 @@ MagickExport Image *ExtractSubimageFromImage(Image *image,
     {
       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)
@@ -1881,7 +1916,7 @@ MagickExport void FormatString(char *string,const char *format,...)
     operands;
 
   va_start(operands,format);
-  FormatMagickStringList(string,MaxTextExtent,format,operands);
+  (void) FormatMagickStringList(string,MaxTextExtent,format,operands);
   va_end(operands);
   return;
 }
@@ -2071,7 +2106,7 @@ MagickExport void *GetConfigureBlob(const char *filename,char *path,
         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
@@ -2154,7 +2189,7 @@ MagickExport void *GetConfigureBlob(const char *filename,char *path,
   */
   if ((blob == (void *) NULL) && (IsPathAccessible(path) != MagickFalse))
     blob=FileToBlob(path,~0,length,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
   /*
     Search Windows registry.
   */
@@ -2339,7 +2374,7 @@ MagickExport const ImageAttribute *GetImageAttribute(const Image *image,
       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));
@@ -2982,9 +3017,9 @@ MagickExport void HSLTransform(const double hue,const double saturation,
   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
 /*
@@ -3201,7 +3236,7 @@ MagickExport MagickPixelPacket InterpolatePixelColor(const Image *image,
         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];
@@ -3244,7 +3279,7 @@ MagickExport MagickPixelPacket InterpolatePixelColor(const Image *image,
         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];
@@ -3285,7 +3320,7 @@ MagickExport MagickPixelPacket InterpolatePixelColor(const Image *image,
         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];
@@ -3392,7 +3427,7 @@ MagickExport MagickPixelPacket InterpolatePixelColor(const Image *image,
         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];
@@ -3549,7 +3584,7 @@ MagickExport MagickPixelPacket InterpolatePixelColor(const Image *image,
           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];
@@ -3758,7 +3793,7 @@ MagickExport void LiberateMemory(void **memory)
 MagickExport void LiberateSemaphoreInfo(SemaphoreInfo **semaphore_info)
 {
   (void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.7");
-  RelinquishSemaphoreInfo(*semaphore_info);
+  UnlockSemaphoreInfo(*semaphore_info);
 }
 \f
 /*
@@ -4048,13 +4083,13 @@ MagickExport MagickBooleanType MatteFloodfillImage(Image *image,
   while (s > segment_stack)
   {
     register const PixelPacket
-      *__restrict p;
+      *restrict p;
 
     register long
       x;
 
     register PixelPacket
-      *__restrict q;
+      *restrict q;
 
     /*
       Pop segment off stack.
@@ -4168,13 +4203,13 @@ MagickExport MagickBooleanType MatteFloodfillImage(Image *image,
   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.
@@ -4204,6 +4239,64 @@ MagickExport MagickBooleanType MatteFloodfillImage(Image *image,
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%     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                                                 %
 %                                                                             %
 %                                                                             %
@@ -4298,7 +4391,7 @@ MagickExport MagickBooleanType OpaqueImage(Image *image,
           x;
 
         register PixelPacket
-          *__restrict q;
+          *restrict q;
 
         q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
         if (q == (PixelPacket *) NULL)
@@ -4335,7 +4428,7 @@ MagickExport MagickBooleanType OpaqueImage(Image *image,
               x;
 
             register PixelPacket
-              *__restrict q;
+              *restrict q;
 
             q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
             if (q == (PixelPacket *) NULL)
@@ -4972,10 +5065,10 @@ MagickExport unsigned int RandomChannelThresholdImage(Image *image,const char
 
     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)
@@ -5106,6 +5199,60 @@ MagickExport void ReacquireMemory(void **memory,const size_t size)
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%     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                     %
 %                                                                             %
 %                                                                             %
@@ -5292,13 +5439,13 @@ MagickExport void SetImage(Image *image,const Quantum opacity)
       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)
@@ -5322,7 +5469,7 @@ MagickExport void SetImage(Image *image,const Quantum opacity)
       x;
 
     register PixelPacket
-      *__restrict q;
+      *restrict q;
 
     q=QueueAuthenticPixels(image,0,y,image->columns,1,&image->exception);
     if (q == (PixelPacket *) NULL)
@@ -5920,13 +6067,13 @@ MagickExport unsigned int ThresholdImage(Image *image,const double threshold)
   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)
@@ -6036,13 +6183,13 @@ MagickExport unsigned int ThresholdImageChannel(Image *image,
   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)
@@ -6294,7 +6441,7 @@ MagickExport MagickBooleanType TransparentImage(Image *image,
       x;
 
     register PixelPacket
-      *__restrict q;
+      *restrict q;
 
     q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
     if (q == (PixelPacket *) NULL)