]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 20 Jul 2011 14:41:15 +0000 (14:41 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 20 Jul 2011 14:41:15 +0000 (14:41 +0000)
MagickCore/effect.c
MagickCore/enhance.c
MagickCore/magick-config.h
MagickCore/pixel.c
MagickCore/threshold.c

index d7a2eb80c8473ea1f74f6b2514a0275098bea4b0..dd4e08a192fe54eb393ec2d6ec80e50e1c11c2ac 100644 (file)
@@ -1361,7 +1361,7 @@ MagickExport Image *ConvolveImage(const Image *image,
           continue;
         if ((convolve_traits & CopyPixelTrait) != 0)
           {
-            SetPixelChannel(convolve_image,channel,p[center+i],q);
+            q[channel]=p[center+i];
             continue;
           }
         k=kernel_info->values;
@@ -1384,7 +1384,7 @@ MagickExport Image *ConvolveImage(const Image *image,
               }
               pixels+=image->columns*channels;
             }
-            SetPixelChannel(convolve_image,channel,ClampToQuantum(pixel),q);
+            q[channel]=ClampToQuantum(pixel);
             continue;
           }
         /*
index c078ef0f00dde104eb2540b00791fdb12b7ab5ea..aca81cd62e51b93223ca738e4b720c279d72fdba 100644 (file)
@@ -3155,6 +3155,9 @@ MagickExport MagickBooleanType NegateImage(Image *image,
   ssize_t
     y;
 
+  size_t
+    channels;
+
   assert(image != (Image *) NULL);
   assert(image->signature == MagickSignature);
   if (image->debug != MagickFalse)
@@ -3260,6 +3263,7 @@ MagickExport MagickBooleanType NegateImage(Image *image,
   /*
     Negate image.
   */
+  channels=GetPixelChannels(image);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
   #pragma omp parallel for schedule(dynamic,4) shared(progress,status)
 #endif
@@ -3281,18 +3285,19 @@ MagickExport MagickBooleanType NegateImage(Image *image,
       }
     for (x=0; x < (ssize_t) image->columns; x++)
     {
-      if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
-        SetPixelRed(image,QuantumRange-GetPixelRed(image,q),q);
-      if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
-        SetPixelGreen(image,QuantumRange-GetPixelGreen(image,q),q);
-      if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
-        SetPixelBlue(image,QuantumRange-GetPixelBlue(image,q),q);
-      if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
-          (image->colorspace == CMYKColorspace))
-        SetPixelBlack(image,QuantumRange-GetPixelBlack(image,q),q);
-      if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
-        SetPixelAlpha(image,QuantumRange-GetPixelAlpha(image,q),q);
-      q+=GetPixelChannels(image);
+      register ssize_t
+        i;
+
+      for (i=0; i < (ssize_t) channels; i++)
+      {
+        PixelTrait 
+          traits;
+
+        traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
+        if ((traits & UpdatePixelTrait) != 0)
+          q[i]=QuantumRange-q[i];
+      }
+      q+=channels;
     }
     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
       status=MagickFalse;
index 09772a5f860fd090fb0018c7f0dc73bca1bd483b..9002a55f6ee8504fd986a62d36a0ca552edfb250 100644 (file)
@@ -12,7 +12,9 @@
 /* #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 to 1 if you have a working `mmap' system call. */
-/* #undef HAVE_MMAP_FILEIO */
+#ifndef MAGICKCORE_HAVE_MMAP_FILEIO
+#define MAGICKCORE_HAVE_MMAP_FILEIO 1
+#endif
 
 /* Define to 1 if you have the `munmap' function. */
 #ifndef MAGICKCORE_HAVE_MUNMAP
 #endif
 
 /* Define to 1 if the system has the type `_Bool'. */
-/* #undef HAVE__BOOL */
+#ifndef MAGICKCORE_HAVE__BOOL
+#define MAGICKCORE_HAVE__BOOL 1
+#endif
 
 /* Define to 1 if you have the `_exit' function. */
 #ifndef MAGICKCORE_HAVE__EXIT
 #endif
 
 /* Define if using libltdl to support dynamically loadable modules */
-/* #undef LTDL_DELEGATE */
+#ifndef MAGICKCORE_LTDL_DELEGATE
+#define MAGICKCORE_LTDL_DELEGATE 1
+#endif
 
 /* Define if the OS needs help to load dependent libraries for dlopen(). */
 /* #undef LTDL_DLOPEN_DEPLIBS */
index 81f61e3c75bf47addcbbac6538fb3f6f1165ae2c..c842c4aea2b7bc0e52bb6795db2f36bc5dd91ad9 100644 (file)
@@ -4533,22 +4533,16 @@ MagickExport void PushPixelChannelMap(Image *image,
 MagickExport void SetPixelChannelMap(Image *image,
   const ChannelType channel_mask)
 {
+#define IsChannelSet(mask,channel) \
+  ((((size_t) (channel) >> (size_t) (i)) & 0x01) != 0)
+
   register ssize_t
     i;
 
-  for (i=0; i < MaxPixelChannels; i++)
-    SetPixelChannelMapTraits(image,(PixelChannel) i,UndefinedPixelTrait);
+  for (i=0; i < (ssize_t) MaxPixelChannels; i++)
+    SetPixelChannelMapTraits(image,(PixelChannel) i,
+      IsChannelSet(channel_mask,i) ? UpdatePixelTrait : CopyPixelTrait);
   image->sync=(channel_mask & SyncChannels) != 0 ? MagickTrue : MagickFalse;
-  if ((channel_mask & RedChannel) != 0)
-    SetPixelRedTraits(image,UpdatePixelTrait);
-  if ((channel_mask & GreenChannel) != 0)
-    SetPixelGreenTraits(image,UpdatePixelTrait);
-  if ((channel_mask & BlueChannel) != 0)
-    SetPixelBlueTraits(image,UpdatePixelTrait);
-  if ((channel_mask & BlackChannel) != 0)
-    SetPixelBlackTraits(image,UpdatePixelTrait);
-  if ((channel_mask & AlphaChannel) != 0)
-    SetPixelAlphaTraits(image,UpdatePixelTrait);
 }
 \f
 /*
index 8117af9671881a0d97fd5c633d79f5c941b4addf..9f68dccad6270d06c90b7c1e5359ced78ae41257 100644 (file)
@@ -281,8 +281,8 @@ MagickExport Image *AdaptiveThresholdImage(const Image *image,
           pixels+=image->columns*channels;
         }
         mean=pixel/number_pixels+bias;
-        SetPixelChannel(threshold_image,channel,(Quantum) (((MagickRealType)
-          p[center+i] <= mean) ? 0 : QuantumRange),q);
+        q[channel]=(Quantum) (((MagickRealType) p[center+i] <= mean) ? 0 :
+          QuantumRange);
       }
       p+=channels;
       q+=threshold_channels;