]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 22 Sep 2011 00:50:36 +0000 (00:50 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 22 Sep 2011 00:50:36 +0000 (00:50 +0000)
MagickCore/matrix.c
MagickCore/shear.c

index 23aa0ce8afedab0d8142db0aa213b71cfd0745bf..bdb9de68b910329c9606634ac978597786240d25 100644 (file)
@@ -89,7 +89,7 @@ MagickExport double **AcquireMagickMatrix(const size_t number_rows,
 
   matrix=(double **) AcquireQuantumMemory(number_rows,sizeof(*matrix));
   if (matrix == (double **) NULL)
-    return((double **)NULL);
+    return((double **) NULL);
   for (i=0; i < (ssize_t) number_rows; i++)
   {
     matrix[i]=(double *) AcquireQuantumMemory(size,sizeof(*matrix[i]));
@@ -125,8 +125,8 @@ MagickExport double **AcquireMagickMatrix(const size_t number_rows,
 %
 %  The format of the GaussJordanElimination method is:
 %
-%      MagickBooleanType GaussJordanElimination(double **matrix,double **vectors,
-%        const size_t rank,const size_t number_vectors)
+%      MagickBooleanType GaussJordanElimination(double **matrix,
+%        double **vectors,const size_t rank,const size_t number_vectors)
 %
 %  A description of each parameter follows:
 %
@@ -174,7 +174,7 @@ MagickExport double **AcquireMagickMatrix(const size_t number_rows,
 %
 %  You can also use the 'vectors' to generate an inverse of the given 'matrix'
 %  though as a 'column first array' rather than a 'row first array'. For
-%  details see    http://en.wikipedia.org/wiki/Gauss-Jordan_elimination
+%  details see http://en.wikipedia.org/wiki/Gauss-Jordan_elimination.
 %
 */
 MagickPrivate MagickBooleanType GaussJordanElimination(double **matrix,
@@ -311,13 +311,13 @@ MagickPrivate MagickBooleanType GaussJordanElimination(double **matrix,
 %    o vectors: the result vectors to add terms/results to.
 %
 %    o terms: the pre-calculated terms (without the unknown coefficent
-%             weights) that forms the equation being added.
+%      weights) that forms the equation being added.
 %
 %    o results: the result(s) that should be generated from the given terms
-%               weighted by the yet-to-be-solved coefficents.
+%      weighted by the yet-to-be-solved coefficents.
 %
 %    o rank: the rank or size of the dimentions of the square matrix.
-%            Also the length of vectors, and number of terms being added.
+%      Also the length of vectors, and number of terms being added.
 %
 %    o number_vectors: Number of result vectors, and number or results being
 %      added.  Also represents the number of separable systems of equations
@@ -370,7 +370,6 @@ MagickPrivate void LeastSquaresAddTerms(double **matrix,double **vectors,
     for (i=0; i < (ssize_t) number_vectors; i++)
       vectors[i][j]+=results[i]*terms[j];
   }
-  return;
 }
 \f
 /*
@@ -413,4 +412,3 @@ MagickExport double **RelinquishMagickMatrix(double **matrix,
   matrix=(double **) RelinquishMagickMemory(matrix);
   return(matrix);
 }
-
index 9e4b78e18ba67d3ee3eb4d13f966c83b7224b712..d6ca2acbe82562ac7c615f233af01deb9dd68fcc 100644 (file)
@@ -739,9 +739,7 @@ static MagickBooleanType RadonTransform(const Image *image,
     for (x=0; x < (ssize_t) image->columns; x++)
     {
       byte<<=1;
-      if (((MagickRealType) GetPixelRed(image,p) < threshold) ||
-          ((MagickRealType) GetPixelGreen(image,p) < threshold) ||
-          ((MagickRealType) GetPixelBlue(image,p) < threshold))
+      if (GetPixelIntensity(image,p) < threshold)
         byte|=0x01;
       bit++;
       if (bit == 8)
@@ -790,9 +788,7 @@ static MagickBooleanType RadonTransform(const Image *image,
     for (x=0; x < (ssize_t) image->columns; x++)
     {
       byte<<=1;
-      if (((MagickRealType) GetPixelRed(image,p) < threshold) ||
-          ((MagickRealType) GetPixelGreen(image,p) < threshold) ||
-          ((MagickRealType) GetPixelBlue(image,p) < threshold))
+      if (GetPixelIntensity(image,p) < threshold)
         byte|=0x01;
       bit++;
       if (bit == 8)
@@ -859,7 +855,8 @@ static void GetImageBackgroundColor(Image *image,const ssize_t offset,
       background.red+=QuantumScale*GetPixelRed(image,p);
       background.green+=QuantumScale*GetPixelGreen(image,p);
       background.blue+=QuantumScale*GetPixelBlue(image,p);
-      background.alpha+=QuantumScale*GetPixelAlpha(image,p);
+      if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
+        background.alpha+=QuantumScale*GetPixelAlpha(image,p);
       count++;
       p+=GetPixelChannels(image);
     }
@@ -871,8 +868,9 @@ static void GetImageBackgroundColor(Image *image,const ssize_t offset,
     background.green/count);
   image->background_color.blue=ClampToQuantum((MagickRealType) QuantumRange*
     background.blue/count);
-  image->background_color.alpha=ClampToQuantum((MagickRealType) QuantumRange*
-    background.alpha/count);
+  if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
+    image->background_color.alpha=ClampToQuantum((MagickRealType) QuantumRange*
+      background.alpha/count);
 }
 
 MagickExport Image *DeskewImage(const Image *image,const double threshold,
@@ -1081,14 +1079,16 @@ static Image *IntegralRotateImage(const Image *image,size_t rotations,
         Rotate 90 degrees.
       */
       GetPixelCacheTileSize(image,&tile_width,&tile_height);
-      for (tile_y=0; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
+      tile_y=0;
+      for ( ; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
       {
         register ssize_t
           tile_x;
 
         if (status == MagickFalse)
           continue;
-        for (tile_x=0; tile_x < (ssize_t) image->columns; tile_x+=(ssize_t) tile_width)
+        tile_x=0;
+        for ( ; tile_x < (ssize_t) image->columns; tile_x+=(ssize_t) tile_width)
         {
           MagickBooleanType
             sync;
@@ -1291,14 +1291,16 @@ static Image *IntegralRotateImage(const Image *image,size_t rotations,
         Rotate 270 degrees.
       */
       GetPixelCacheTileSize(image,&tile_width,&tile_height);
-      for (tile_y=0; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
+      tile_y=0;
+      for ( ; tile_y < (ssize_t) image->rows; tile_y+=(ssize_t) tile_height)
       {
         register ssize_t
           tile_x;
 
         if (status == MagickFalse)
           continue;
-        for (tile_x=0; tile_x < (ssize_t) image->columns; tile_x+=(ssize_t) tile_width)
+        tile_x=0;
+        for ( ; tile_x < (ssize_t) image->columns; tile_x+=(ssize_t) tile_width)
         {
           MagickBooleanType
             sync;