]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/distort.c
(no commit message)
[imagemagick] / MagickCore / distort.c
index cc5f8e607987816156c9782a9c9448549030752d..e4202ba4bf85a629cd8ff97ba72f32865730beed 100644 (file)
 %                     MagickCore Image Distortion Methods                     %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                              Anthony Thyssen                                %
 %                                 June 2007                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2014 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  %
@@ -44,6 +44,7 @@
 #include "MagickCore/artifact.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/cache-view.h"
+#include "MagickCore/channel.h"
 #include "MagickCore/colorspace-private.h"
 #include "MagickCore/composite-private.h"
 #include "MagickCore/distort.h"
@@ -2180,7 +2181,7 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method,
           (void) FormatLocaleFile(stderr, "  c%.20g = %+lf\n", (double) i, coeff[i]);
         (void) FormatLocaleFile(stderr, "DePolar Distort, FX Equivelent:\n");
         (void) FormatLocaleFile(stderr, "%s", image_gen);
-        (void) FormatLocaleFile(stderr, "  -fx 'aa=(i+.5)*%lf %+lf;\n", coeff[6], -coeff[4] );
+        (void) FormatLocaleFile(stderr, "  -fx 'aa=(i+.5)*%lf %+lf;\n", coeff[6], +coeff[4] );
         (void) FormatLocaleFile(stderr, "       rr=(j+.5)*%lf %+lf;\n", coeff[7], +coeff[1] );
         (void) FormatLocaleFile(stderr, "       xx=rr*sin(aa) %+lf;\n", coeff[2] );
         (void) FormatLocaleFile(stderr, "       yy=rr*cos(aa) %+lf;\n", coeff[3] );
@@ -2566,7 +2567,7 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method,
           case DePolarDistortion:
           { /* @D Polar to Carteasain  */
             /* ignore all destination virtual offsets */
-            d.x = ((double)i+0.5)*output_scaling*coeff[6]-coeff[4];
+            d.x = ((double)i+0.5)*output_scaling*coeff[6]+coeff[4];
             d.y = ((double)j+0.5)*output_scaling*coeff[7]+coeff[1];
             s.x = d.y*sin(d.x) + coeff[2];
             s.y = d.y*cos(d.x) + coeff[3];
@@ -3182,13 +3183,17 @@ MagickExport Image *SparseColorImage(const Image *image,
           }
           case VoronoiColorInterpolate:
           default:
-          { /* Just use the closest control point you can find! */
+          {
             size_t
               k;
+
             double
-              minimum = MagickHuge;
+              minimum = MagickMaximumValue;
 
-            for(k=0; k<number_arguments; k+=2+number_colors) {
+            /*
+              Just use the closest control point you can find!
+            */
+            for (k=0; k<number_arguments; k+=2+number_colors) {
               double distance =
                   ((double)i-arguments[ k ])*((double)i-arguments[ k ])
                 + ((double)j-arguments[k+1])*((double)j-arguments[k+1]);