]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 21 Aug 2011 00:04:26 +0000 (00:04 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 21 Aug 2011 00:04:26 +0000 (00:04 +0000)
23 files changed:
Magick++/lib/Image.cpp
Magick++/lib/Magick++/Include.h
MagickCore/annotate.c
MagickCore/attribute.c
MagickCore/cache.c
MagickCore/display.c
MagickCore/distort.c
MagickCore/draw.c
MagickCore/enhance.c
MagickCore/fx.c
MagickCore/histogram.c
MagickCore/image.c
MagickCore/image.h
MagickCore/magick-config.h
MagickCore/pixel-accessor.h
MagickCore/pixel.c
MagickCore/pixel.h
MagickCore/version.h
MagickWand/composite.c
PerlMagick/Magick.xs
coders/msl.c
coders/png.c
coders/ps3.c

index 5b263427698dfc7c00f4c212e333905f7f4573ca..82ab3d5181b249c4e2dc2f013929c955801a3b9e 100644 (file)
@@ -342,12 +342,12 @@ void Magick::Image::addNoiseChannel( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PushPixelChannelMap( image(), channel_);
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
   MagickCore::Image* newImage =
     AddNoiseImage ( image(),
                            noiseType_,
                            &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -492,10 +492,10 @@ void Magick::Image::blurChannel( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PushPixelChannelMap( image(), channel_ );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
     BlurImage( image(), radius_, sigma_, &exceptionInfo);
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -519,9 +519,9 @@ void Magick::Image::border( const Geometry &geometry_ )
 void Magick::Image::channel ( const ChannelType channel_ )
 {
   modifyImage();
-  PushPixelChannelMap( image(), channel_ );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   SeparateImage ( image() );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   throwImageException();
 }
 
@@ -1137,10 +1137,10 @@ void Magick::Image::fx ( const std::string expression,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PushPixelChannelMap( image(), channel );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel );
   MagickCore::Image* newImage =
     FxImage ( image(), expression.c_str(), &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1194,10 +1194,10 @@ void Magick::Image::gaussianBlurChannel ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PushPixelChannelMap( image(), channel_ );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
     GaussianBlurImage( image(), width_, sigma_, &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1304,10 +1304,10 @@ void Magick::Image::matteFloodfill ( const Color &target_ ,
   target.green=static_cast<PixelPacket>(target_).green;
   target.blue=static_cast<PixelPacket>(target_).blue;
   target.alpha=alpha_;
-  PushPixelChannelMap( image(), AlphaChannel );
+  ChannelType channel_mask = SetPixelChannelMask( image(), AlphaChannel );
   FloodfillPaintImage ( image(), options()->drawInfo(), &target, x_, y_,
     method_ == FloodfillMethod ? MagickFalse : MagickTrue);
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   throwImageException();
 }
 
@@ -1515,9 +1515,9 @@ void Magick::Image::quantumOperator ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PushPixelChannelMap( image(), channel_ );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   EvaluateImage( image(), operator_, rvalue_, &exceptionInfo);
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
@@ -1538,9 +1538,9 @@ void Magick::Image::quantumOperator ( const ssize_t x_,const ssize_t y_,
   geometry.y = y_;
   MagickCore::Image *crop_image = CropImage( image(), &geometry,
     &exceptionInfo );
-  PushPixelChannelMap( image(), channel_);
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
   EvaluateImage( crop_image, operator_, rvalue_, &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   (void) CompositeImage( image(), image()->matte != MagickFalse ?
     OverCompositeOp : CopyCompositeOp, crop_image, geometry.x, geometry.y );
   crop_image = DestroyImageList(crop_image);
@@ -1580,11 +1580,11 @@ void Magick::Image::randomThresholdChannel( const Geometry &thresholds_,
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
   modifyImage();
-  PushPixelChannelMap( image(), channel_);
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_);
   (void) RandomThresholdImage( image(),
                                       static_cast<std::string>(thresholds_).c_str(),
                                       &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   throwImageException();
   (void) DestroyExceptionInfo( &exceptionInfo );
 }
@@ -1897,13 +1897,13 @@ void Magick::Image::sharpenChannel ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PushPixelChannelMap( image(), channel_ );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
     SharpenImage( image(),
                          radius_,
                          sigma_,
                          &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -1968,10 +1968,10 @@ void Magick::Image::sparseColor ( const ChannelType channel,
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
 
-  PushPixelChannelMap( image(), channel );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel );
   MagickCore::Image* newImage = SparseColorImage ( image(), method,
     number_arguments, arguments, &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -2161,7 +2161,7 @@ void Magick::Image::unsharpmaskChannel ( const ChannelType channel_,
 {
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
-  PushPixelChannelMap( image(), channel_ );
+  ChannelType channel_mask = SetPixelChannelMask( image(), channel_ );
   MagickCore::Image* newImage =
     UnsharpMaskImage( image(),
                              radius_,
@@ -2169,7 +2169,7 @@ void Magick::Image::unsharpmaskChannel ( const ChannelType channel_,
                              amount_,
                              threshold_,
                              &exceptionInfo );
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
   replaceImage( newImage );
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
@@ -3601,7 +3601,7 @@ void Magick::Image::statistics ( ImageStatistics *statistics )
   ExceptionInfo exceptionInfo;
   GetExceptionInfo( &exceptionInfo );
 
-  PushPixelChannelMap( image(), RedChannel);
+  ChannelType channel_mask = SetPixelChannelMask( image(), RedChannel);
   (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
   statistics->red.minimum=minimum;
   statistics->red.maximum=maximum;
@@ -3609,9 +3609,9 @@ void Magick::Image::statistics ( ImageStatistics *statistics )
     &statistics->red.standard_deviation,&exceptionInfo);
   (void) GetImageKurtosis( image(),&statistics->red.kurtosis,
     &statistics->red.skewness,&exceptionInfo);
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
 
-  PushPixelChannelMap( image(), GreenChannel);
+  channel_mask = SetPixelChannelMask( image(), GreenChannel);
   (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
   statistics->green.minimum=minimum;
   statistics->green.maximum=maximum;
@@ -3619,9 +3619,9 @@ void Magick::Image::statistics ( ImageStatistics *statistics )
     &statistics->green.standard_deviation,&exceptionInfo);
   (void) GetImageKurtosis( image(),&statistics->green.kurtosis,
     &statistics->green.skewness,&exceptionInfo);
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
 
-  PushPixelChannelMap( image(), GreenChannel);
+  channel_mask = SetPixelChannelMask( image(), GreenChannel);
   (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
   statistics->blue.minimum=minimum;
   statistics->blue.maximum=maximum;
@@ -3629,9 +3629,9 @@ void Magick::Image::statistics ( ImageStatistics *statistics )
     &statistics->blue.standard_deviation,&exceptionInfo);
   (void) GetImageKurtosis( image(),&statistics->blue.kurtosis,
     &statistics->blue.skewness,&exceptionInfo);
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
 
-  PushPixelChannelMap( image(), AlphaChannel);
+  channel_mask = SetPixelChannelMask( image(), AlphaChannel);
   (void) GetImageRange( image(),&minimum,&maximum,&exceptionInfo);
   statistics->alpha.minimum=minimum;
   statistics->alpha.maximum=maximum;
@@ -3639,7 +3639,7 @@ void Magick::Image::statistics ( ImageStatistics *statistics )
     &statistics->alpha.standard_deviation,&exceptionInfo);
   (void) GetImageKurtosis( image(),&statistics->alpha.kurtosis,
     &statistics->alpha.skewness,&exceptionInfo);
-  PopPixelChannelMap( image() );
+  (void) SetPixelChannelMap( image(), channel_mask );
 
   throwException( exceptionInfo );
   (void) DestroyExceptionInfo( &exceptionInfo );
index f5dc84c6e9c8a757ee61d64f20e867ba535df4c2..85ce2114dd80e51aec2565b3e62303f219b86285 100644 (file)
@@ -810,11 +810,9 @@ namespace Magick
   using MagickCore::PixelWand;
   using MagickCore::PointInfo;
   using MagickCore::PopDrawingWand;
-  using MagickCore::PopPixelChannelMap;
   using MagickCore::ProfileImage;
   using MagickCore::ProfileInfo;
   using MagickCore::PushDrawingWand;
-  using MagickCore::PushPixelChannelMap;
   using MagickCore::QuantizeImage;
   using MagickCore::QuantizeInfo;
   using MagickCore::QuantumInfo;
@@ -863,8 +861,9 @@ namespace Magick
   using MagickCore::SetLogEventMask;
   using MagickCore::SetMagickInfo;
   using MagickCore::SetMagickResourceLimit;
-  using MagickCore::SetStringInfoDatum;
   using MagickCore::SetImageVirtualPixelMethod;
+  using MagickCore::SetPixelChannelMask;
+  using MagickCore::SetStringInfoDatum;
   using MagickCore::ShadeImage;
   using MagickCore::SharpenImage;
   using MagickCore::SharpenImage;
index 6452e898275c23ff5549d20bad4670251b9d1f09..4fe8beaf1f0d1dbc1bf42ce2bee0b2fd6af739db 100644 (file)
@@ -1434,13 +1434,15 @@ static MagickBooleanType RenderFreetype(Image *image,const DrawInfo *draw_info,
       origin.x+=direction*face->glyph->advance.x;
     metrics->origin.x=origin.x;
     metrics->origin.y=origin.y;
-    FT_Done_Glyph(last_glyph.image);
+    if (last_glyph.id != 0)
+      FT_Done_Glyph(last_glyph.image);
     last_glyph=glyph;
     code=GetUTFCode(p);
   }
   if (utf8 != (unsigned char *) NULL)
     utf8=(unsigned char *) RelinquishMagickMemory(utf8);
-  FT_Done_Glyph(last_glyph.image);
+  if (last_glyph.id != 0)
+    FT_Done_Glyph(last_glyph.image);
   if ((draw_info->stroke.alpha != TransparentAlpha) ||
       (draw_info->stroke_pattern != (Image *) NULL))
     {
index 2dc14da074cc62f99b9996abbc90f4184c90b4fe..c53016ededf355143f33f9dbfcbc8938cea1c44c 100644 (file)
@@ -605,7 +605,8 @@ MagickExport MagickBooleanType IsImageGray(const Image *image,
           type=UndefinedType;
           break;
         }
-      if ((type == BilevelType) && (IsPixelMonochrome(image,p) == MagickFalse))
+      if ((type == BilevelType) &&
+          (IsPixelMonochrome(image,p) == MagickFalse))
         type=GrayscaleType;
       p+=GetPixelChannels(image);
     }
index 1f40a0331f40a3b4e77c53ef9d00ee4ede194f69..ac76101ea9ef00ffb4d5e3a19560bd571e463dd3 100644 (file)
@@ -3997,7 +3997,6 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode,
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   if ((image->columns == 0) || (image->rows == 0))
     ThrowBinaryException(CacheError,"NoPixelsDefinedInCache",image->filename);
-  StandardPixelChannelMap(image);
   cache_info=(CacheInfo *) image->cache;
   assert(cache_info->signature == MagickSignature);
   source_info=(*cache_info);
@@ -4009,6 +4008,7 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode,
   cache_info->matte=image->matte;
   cache_info->rows=image->rows;
   cache_info->columns=image->columns;
+  InitializePixelChannelMap(image);
   cache_info->number_channels=GetPixelChannels(image);
   cache_info->metacontent_extent=image->metacontent_extent;
   cache_info->mode=mode;
index ece4c11cc2a5687ff64f26a7ac195fee19b0b0ca..77da91668be14009a63c8f379c0af7d0e923c9f6 100644 (file)
@@ -10054,6 +10054,9 @@ static MagickBooleanType XMatteEditImage(Display *display,
           case FloodfillMethod:
           case FillToBorderMethod:
           {
+            ChannelType
+              channel_mask;
+
             DrawInfo
               *draw_info;
 
@@ -10078,11 +10081,11 @@ static MagickBooleanType XMatteEditImage(Display *display,
               (DrawInfo *) NULL);
             draw_info->fill.alpha=ClampToQuantum(InterpretLocaleValue(matte,
               (char **) NULL));
-            PushPixelChannelMap(*image,AlphaChannel); 
+            channel_mask=SetPixelChannelMask(*image,AlphaChannel); 
             (void) FloodfillPaintImage(*image,draw_info,&target,(ssize_t)
               x_offset,(ssize_t) y_offset,method == FloodfillMethod ?
               MagickFalse : MagickTrue);
-            PopPixelChannelMap(*image);
+            (void) SetPixelChannelMap(*image,channel_mask);
             draw_info=DestroyDrawInfo(draw_info);
             break;
           }
index 816d9e8520e5244d604319385a4b62545bf231f8..5465cb62184fab6d15ef21ef00a6a095e80523a7 100644 (file)
@@ -1459,18 +1459,22 @@ MagickExport Image *DistortResizeImage(const Image *image,
     }
   else
     {
+      ChannelType
+        channel_mask;
+
+      Image
+        *resize_alpha;
+
       /*
         Image has transparency so handle colors and alpha separatly.
         Basically we need to separate Virtual-Pixel alpha in the resized
         image, so only the actual original images alpha channel is used.
-      */
-      Image
-        *resize_alpha;
 
-      /* distort alpha channel separately */
-      PushPixelChannelMap(tmp_image,AlphaChannel);
+        distort alpha channel separately
+      */
+      channel_mask=SetPixelChannelMask(tmp_image,AlphaChannel);
       (void) SeparateImage(tmp_image);
-      PopPixelChannelMap(tmp_image);
+      SetPixelChannelMap(tmp_image,channel_mask);
       (void) SetImageAlphaChannel(tmp_image,OpaqueAlphaChannel,exception);
       resize_alpha=DistortImage(tmp_image,AffineDistortion,12,distort_args,
         MagickTrue,exception),
index 366c2a3b92f3d75c05c0674ec4aef510101615ad..0e21687d1ec50ec793ab28e07e272f104a6e3146 100644 (file)
@@ -4349,6 +4349,9 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
         case FloodfillMethod:
         case FillToBorderMethod:
         {
+          ChannelType
+            channel_mask;
+
           PixelInfo
             target;
 
@@ -4359,11 +4362,11 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
               target.green=(MagickRealType) draw_info->border_color.green;
               target.blue=(MagickRealType) draw_info->border_color.blue;
             }
-          PushPixelChannelMap(image,AlphaChannel);
+          channel_mask=SetPixelChannelMask(image,AlphaChannel);
           (void) FloodfillPaintImage(image,draw_info,&target,x,y,
             primitive_info->method == FloodfillMethod ? MagickFalse :
             MagickTrue);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case ResetMethod:
index 5a052063fee70c905dc1909583a1b22cc6d173b0..ff1457460cafa9b57158febf3001d4e08878552b 100644 (file)
@@ -129,17 +129,20 @@ MagickExport MagickBooleanType AutoGammaImage(Image *image,
   status=MagickTrue;
   for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
   {
+    ChannelType
+      channel_mask;
+
     PixelTrait
       traits;
 
     traits=GetPixelChannelMapTraits(image,(PixelChannel) i);
     if ((traits & UpdatePixelTrait) == 0)
       continue;
-    PushPixelChannelMap(image,(ChannelType) i);
+    channel_mask=SetPixelChannelMask(image,(ChannelType) i);
     status=GetImageMean(image,&mean,&sans,exception);
     gamma=log(mean*QuantumScale)/log_mean;
     status&=LevelImage(image,0.0,(double) QuantumRange,gamma,exception);
-    PopPixelChannelMap(image);
+    (void) SetPixelChannelMask(image,channel_mask);
     if (status == MagickFalse)
       break;
   }
@@ -2561,6 +2564,9 @@ MagickExport MagickBooleanType LevelImageColors(Image *image,
   const PixelInfo *black_color,const PixelInfo *white_color,
   const MagickBooleanType invert)
 {
+  ChannelType
+    channel_mask;
+
   MagickStatusType
     status;
 
@@ -2576,78 +2582,78 @@ MagickExport MagickBooleanType LevelImageColors(Image *image,
     {
       if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
         {
-          PushPixelChannelMap(image,RedChannel);
+          channel_mask=SetPixelChannelMask(image,RedChannel);
           status|=LevelImage(image,black_color->red,white_color->red,1.0,
             &image->exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
         {
-          PushPixelChannelMap(image,GreenChannel);
+          channel_mask=SetPixelChannelMask(image,GreenChannel);
           status|=LevelImage(image,black_color->green,white_color->green,1.0,
             &image->exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
         {
-          PushPixelChannelMap(image,BlueChannel);
+          channel_mask=SetPixelChannelMask(image,BlueChannel);
           status|=LevelImage(image,black_color->blue,white_color->blue,1.0,
             &image->exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
           (image->colorspace == CMYKColorspace))
         {
-          PushPixelChannelMap(image,BlackChannel);
+          channel_mask=SetPixelChannelMask(image,BlackChannel);
           status|=LevelImage(image,black_color->black,white_color->black,1.0,
             &image->exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) &&
           (image->matte == MagickTrue))
         {
-          PushPixelChannelMap(image,AlphaChannel);
+          channel_mask=SetPixelChannelMask(image,AlphaChannel);
           status|=LevelImage(image,black_color->alpha,white_color->alpha,1.0,
             &image->exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
     }
   else
     {
       if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
         {
-          PushPixelChannelMap(image,RedChannel);
+          channel_mask=SetPixelChannelMask(image,RedChannel);
           status|=LevelizeImage(image,black_color->red,white_color->red,1.0);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
         {
-          PushPixelChannelMap(image,GreenChannel);
+          channel_mask=SetPixelChannelMask(image,GreenChannel);
           status|=LevelizeImage(image,black_color->green,white_color->green,
             1.0);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
         {
-          PushPixelChannelMap(image,BlueChannel);
+          channel_mask=SetPixelChannelMask(image,BlueChannel);
           status|=LevelizeImage(image,black_color->blue,white_color->blue,1.0);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
           (image->colorspace == CMYKColorspace))
         {
-          PushPixelChannelMap(image,BlackChannel);
+          channel_mask=SetPixelChannelMask(image,BlackChannel);
           status|=LevelizeImage(image,black_color->black,white_color->black,
             1.0);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
       if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) &&
           (image->matte == MagickTrue))
         {
-          PushPixelChannelMap(image,AlphaChannel);
+          channel_mask=SetPixelChannelMask(image,AlphaChannel);
           status|=LevelizeImage(image,black_color->alpha,white_color->alpha,
             1.0);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
         }
     }
   return(status == 0 ? MagickFalse : MagickTrue);
index 7fe94d98200e43e9113fa15e3635bb69bb046794..552062efddf3cd2fe6a5c2c6ad52127e001c6b59 100644 (file)
@@ -4128,6 +4128,9 @@ MagickExport Image *ShadowImage(const Image *image,const double opacity,
   CacheView
     *border_view;
 
+  ChannelType
+    channel_mask;
+
   Image
     *border_image,
     *clone_image,
@@ -4222,9 +4225,9 @@ MagickExport Image *ShadowImage(const Image *image,const double opacity,
       }
   }
   border_view=DestroyCacheView(border_view);
-  PushPixelChannelMap(border_image,AlphaChannel);
+  channel_mask=SetPixelChannelMask(border_image,AlphaChannel);
   shadow_image=BlurImage(border_image,0.0,sigma,exception);
-  PopPixelChannelMap(border_image);
+  (void) SetPixelChannelMap(border_image,channel_mask);
   border_image=DestroyImage(border_image);
   if (shadow_image == (Image *) NULL)
     return((Image *) NULL);
index a1db3db7ad69c1d9a830288397ac5e9870a67018..ac93dc4d5ebb8ed5ef82f81a3c6d9e174ad85911 100644 (file)
@@ -980,6 +980,9 @@ MagickExport MagickBooleanType IsPaletteImage(const Image *image,
 MagickExport MagickBooleanType MinMaxStretchImage(Image *image,
   const double black,const double white,ExceptionInfo *exception)
 {
+  ChannelType
+    channel_mask;
+
   double
     min,
     max;
@@ -1005,55 +1008,55 @@ MagickExport MagickBooleanType MinMaxStretchImage(Image *image,
   */
   if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
     {
-      PushPixelChannelMap(image,RedChannel);
+      channel_mask=SetPixelChannelMask(image,RedChannel);
       (void) GetImageRange(image,&min,&max,exception);
       min+=black;
       max-=white;
       if (fabs(min-max) >= MagickEpsilon)
         status&=LevelImage(image,min,max,1.0,exception);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
     }
   if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
     {
-      PushPixelChannelMap(image,GreenChannel);
+      channel_mask=SetPixelChannelMask(image,GreenChannel);
       (void) GetImageRange(image,&min,&max,exception);
       min+=black;
       max-=white;
       if (fabs(min-max) >= MagickEpsilon)
         status&=LevelImage(image,min,max,1.0,exception);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
     }
   if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
     {
-      PushPixelChannelMap(image,BlueChannel);
+      channel_mask=SetPixelChannelMask(image,BlueChannel);
       (void) GetImageRange(image,&min,&max,exception);
       min+=black;
       max-=white;
       if (fabs(min-max) >= MagickEpsilon)
         status&=LevelImage(image,min,max,1.0,exception);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
     }
   if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
        (image->colorspace == CMYKColorspace))
     {
-      PushPixelChannelMap(image,BlackChannel);
+      channel_mask=SetPixelChannelMask(image,BlackChannel);
       (void) GetImageRange(image,&min,&max,exception);
       min+=black;
       max-=white;
       if (fabs(min-max) >= MagickEpsilon)
         status&=LevelImage(image,min,max,1.0,exception);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
     }
   if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) &&
        (image->matte == MagickTrue))
     {
-      PushPixelChannelMap(image,AlphaChannel);
+      channel_mask=SetPixelChannelMask(image,AlphaChannel);
       (void) GetImageRange(image,&min,&max,exception);
       min+=black;
       max-=white;
       if (fabs(min-max) >= MagickEpsilon)
         status&=LevelImage(image,min,max,1.0,exception);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
     }
   return(status != 0 ? MagickTrue : MagickFalse);
 }
index 9f183592d28d1d0955782dac97c25daafee55237..65ecf6e4a45ac9ca16f5b303c486caf2654445d6 100644 (file)
@@ -185,6 +185,7 @@ MagickExport Image *AcquireImage(const ImageInfo *image_info)
   GetTimerInfo(&image->timer);
   image->ping=MagickFalse;
   image->cache=AcquirePixelCache(0);
+  image->channel_mask=DefaultChannels;
   image->channel_map=AcquirePixelChannelMap();
   image->blob=CloneBlobInfo((BlobInfo *) NULL);
   image->debug=IsEventLogging();
@@ -806,7 +807,7 @@ MagickExport Image *CloneImage(const Image *image,const size_t columns,
   clone_image->magick_rows=image->magick_rows;
   clone_image->type=image->type;
   clone_image->sync=image->sync;
-  clone_image->map=image->map;
+  clone_image->mask=image->mask;
   clone_image->channel_map=ClonePixelChannelMap(image->channel_map);
   (void) CopyMagickString(clone_image->magick_filename,image->magick_filename,
     MaxTextExtent);
@@ -2428,6 +2429,9 @@ MagickExport MagickBooleanType SeparateImage(Image *image)
 */
 MagickExport Image *SeparateImages(const Image *image,ExceptionInfo *exception)
 {
+  ChannelType
+    channel_mask;
+
   Image
     *images,
     *separate_image;
@@ -2440,42 +2444,42 @@ MagickExport Image *SeparateImages(const Image *image,ExceptionInfo *exception)
   if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0)
     {
       separate_image=CloneImage(image,0,0,MagickTrue,exception);
-      PushPixelChannelMap(separate_image,RedChannel);
+      channel_mask=SetPixelChannelMask(separate_image,RedChannel);
       (void) SeparateImage(separate_image);
-      PopPixelChannelMap(separate_image);
+      (void) SetPixelChannelMap(separate_image,channel_mask);
       AppendImageToList(&images,separate_image);
     }
   if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0)
     {
       separate_image=CloneImage(image,0,0,MagickTrue,exception);
-      PushPixelChannelMap(separate_image,GreenChannel);
+      channel_mask=SetPixelChannelMask(separate_image,GreenChannel);
       (void) SeparateImage(separate_image);
-      PopPixelChannelMap(separate_image);
+      (void) SetPixelChannelMap(separate_image,channel_mask);
       AppendImageToList(&images,separate_image);
     }
   if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0)
     {
       separate_image=CloneImage(image,0,0,MagickTrue,exception);
-      PushPixelChannelMap(separate_image,BlueChannel);
+      channel_mask=SetPixelChannelMask(separate_image,BlueChannel);
       (void) SeparateImage(separate_image);
-      PopPixelChannelMap(separate_image);
+      (void) SetPixelChannelMap(separate_image,channel_mask);
       AppendImageToList(&images,separate_image);
     }
   if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) &&
       (image->colorspace == CMYKColorspace))
     {
       separate_image=CloneImage(image,0,0,MagickTrue,exception);
-      PushPixelChannelMap(separate_image,BlackChannel);
+      channel_mask=SetPixelChannelMask(separate_image,BlackChannel);
       (void) SeparateImage(separate_image);
-      PopPixelChannelMap(separate_image);
+      (void) SetPixelChannelMap(separate_image,channel_mask);
       AppendImageToList(&images,separate_image);
     }
   if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0)
     {
       separate_image=CloneImage(image,0,0,MagickTrue,exception);
-      PushPixelChannelMap(separate_image,AlphaChannel);
+      channel_mask=SetPixelChannelMask(separate_image,AlphaChannel);
       (void) SeparateImage(separate_image);
-      PopPixelChannelMap(separate_image);
+      (void) SetPixelChannelMap(separate_image,channel_mask);
       AppendImageToList(&images,separate_image);
     }
   return(images);
@@ -2515,6 +2519,9 @@ MagickExport Image *SeparateImages(const Image *image,ExceptionInfo *exception)
 MagickExport MagickBooleanType SetImageAlphaChannel(Image *image,
   const AlphaChannelType alpha_type,ExceptionInfo *exception)
 {
+  ChannelType
+    channel_mask;
+
   MagickBooleanType
     status;
 
@@ -2607,9 +2614,9 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image,
         Special usage case for SeparateImage(): copy grayscale color to
         the alpha channel.
       */
-      PushPixelChannelMap(image,GrayChannel);
+      channel_mask=SetPixelChannelMask(image,GrayChannel);
       status=SeparateImage(image);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
       image->matte=MagickTrue; /* make sure transparency is now on! */
       if (alpha_type == ShapeAlphaChannel)
         {
@@ -2627,9 +2634,9 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image,
     }
     case ExtractAlphaChannel:
     {
-      PushPixelChannelMap(image,AlphaChannel);
+      channel_mask=SetPixelChannelMask(image,AlphaChannel);
       status=SeparateImage(image);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
       image->matte=MagickFalse;
       break;
     }
@@ -3606,13 +3613,16 @@ MagickExport MagickBooleanType SetImageType(Image *image,const ImageType type)
     }
     case PaletteBilevelMatteType:
     {
+      ChannelType
+        channel_mask;
+
       if (IsRGBColorspace(image->colorspace) == MagickFalse)
         status=TransformImageColorspace(image,RGBColorspace);
       if (image->matte == MagickFalse)
         (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
-      PushPixelChannelMap(image,AlphaChannel);
+      channel_mask=SetPixelChannelMask(image,AlphaChannel);
       (void) BilevelImage(image,(double) QuantumRange/2.0);
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
       quantize_info=AcquireQuantizeInfo(image_info);
       status=QuantizeImage(quantize_info,image);
       quantize_info=DestroyQuantizeInfo(quantize_info);
index 928b78ad3108229abbbbe64abbf77163417fa406..7054390893003cabe3ca4178bfd31a220be07303 100644 (file)
@@ -287,11 +287,11 @@ struct _Image
   MagickBooleanType
     sync;
 
-  size_t
-    map;  
+  ChannelType
+    channel_mask;  
 
   PixelChannelMap
-    **channel_map;
+    *channel_map;
 
   void
     *cache;
index 2726a74e3fde3f0f6dab78f556afb7ba2dc5a8c6..60334d7b94cf6fee05d1743764d535c4bcdb04ab 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
@@ -78,7 +80,9 @@
 #endif
 
 /* Define if you have FFTW library */
-/* #undef FFTW_DELEGATE */
+#ifndef MAGICKCORE_FFTW_DELEGATE
+#define MAGICKCORE_FFTW_DELEGATE 1
+#endif
 
 /* Location of filter modules */
 #ifndef MAGICKCORE_FILTER_PATH
 #endif
 
 /* Define if you have the <lcms2.h> header file. */
-#ifndef MAGICKCORE_HAVE_LCMS2_H
-#define MAGICKCORE_HAVE_LCMS2_H 1
-#endif
+/* #undef HAVE_LCMS2_H */
 
 /* Define if you have the <lcms2/lcms2.h> header file. */
 /* #undef HAVE_LCMS2_LCMS2_H */
 
 /* Define if you have the <lcms.h> header file. */
-/* #undef HAVE_LCMS_H */
+#ifndef MAGICKCORE_HAVE_LCMS_H
+#define MAGICKCORE_HAVE_LCMS_H 1
+#endif
 
 /* Define if you have the <lcms/lcms.h> header file. */
 /* #undef HAVE_LCMS_LCMS_H */
 #endif
 
 /* Define if you have JBIG library */
-/* #undef JBIG_DELEGATE */
+#ifndef MAGICKCORE_JBIG_DELEGATE
+#define MAGICKCORE_JBIG_DELEGATE 1
+#endif
 
 /* Define if you have JPEG version 2 "Jasper" library */
 #ifndef MAGICKCORE_JP2_DELEGATE
 #endif
 
 /* Define if you have LQR library */
-/* #undef LQR_DELEGATE */
+#ifndef MAGICKCORE_LQR_DELEGATE
+#define MAGICKCORE_LQR_DELEGATE 1
+#endif
 
 /* Define if using libltdl to support dynamically loadable modules */
 #ifndef MAGICKCORE_LTDL_DELEGATE
 
 /* Define to the system default library search path. */
 #ifndef MAGICKCORE_LT_DLSEARCH_PATH
-#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/atlas:/usr/lib/llvm:/usr/lib64/llvm:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/tcl8.5/tclx8.4:/usr/lib64/tcl8.5:/usr/lib/wine/:/usr/lib64/wine/:/usr/lib64/xulrunner-2"
+#define MAGICKCORE_LT_DLSEARCH_PATH "/lib64:/usr/lib64:/lib:/usr/lib:/usr/lib64/R/lib:/usr/lib64/atlas:/opt/modules/pkg/intel/f77/10.0.025/lib:/usr/lib64/llvm:/usr/local/lib:/usr/lib64/mysql:/usr/lib64/qt-3.3/lib:/usr/lib64/xulrunner-2"
 #endif
 
 /* The archive extension */
 /* #undef NO_MINUS_C_MINUS_O */
 
 /* Define if you have OPENEXR library */
-/* #undef OPENEXR_DELEGATE */
+#ifndef MAGICKCORE_OPENEXR_DELEGATE
+#define MAGICKCORE_OPENEXR_DELEGATE 1
+#endif
 
 /* Define to the address where bug reports for this package should be sent. */
 #ifndef MAGICKCORE_PACKAGE_BUGREPORT
 #endif
 
 /* Define if you have RSVG library */
-/* #undef RSVG_DELEGATE */
+#ifndef MAGICKCORE_RSVG_DELEGATE
+#define MAGICKCORE_RSVG_DELEGATE 1
+#endif
 
 /* Define to the type of arg 1 for `select'. */
 #ifndef MAGICKCORE_SELECT_TYPE_ARG1
 
 
 /* Define if you have WEBP library */
-/* #undef WEBP_DELEGATE */
+#ifndef MAGICKCORE_WEBP_DELEGATE
+#define MAGICKCORE_WEBP_DELEGATE 1
+#endif
 
 /* Define to use the Windows GDI32 library */
 /* #undef WINGDI32_DELEGATE */
 /* #undef WITH_DMALLOC */
 
 /* Define if you have WMF library */
-/* #undef WMF_DELEGATE */
+#ifndef MAGICKCORE_WMF_DELEGATE
+#define MAGICKCORE_WMF_DELEGATE 1
+#endif
 
 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
    significant byte first (like Motorola and SPARC, unlike Intel). */
index fee52f4d94ba8cb7de1649b200f82c5896c32d51..4a6dc33a07a07da67f404293e55738bcdd7cd7f2 100644 (file)
@@ -29,60 +29,60 @@ extern "C" {
 
 static inline Quantum GetPixelAlpha(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][AlphaPixelChannel].channel]);
+  return(pixel[image->channel_map[AlphaPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelAlphaTraits(const Image *image)
 {
-  return(image->channel_map[image->map][AlphaPixelChannel].traits);
+  return(image->channel_map[AlphaPixelChannel].traits);
 }
 
 static inline Quantum GetPixelBlack(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][BlackPixelChannel].channel]);
+  return(pixel[image->channel_map[BlackPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelBlackTraits(const Image *image)
 {
-  return(image->channel_map[image->map][BlackPixelChannel].traits);
+  return(image->channel_map[BlackPixelChannel].traits);
 }
 
 static inline Quantum GetPixelBlue(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][BluePixelChannel].channel]);
+  return(pixel[image->channel_map[BluePixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelBlueTraits(const Image *image)
 {
-  return(image->channel_map[image->map][BluePixelChannel].traits);
+  return(image->channel_map[BluePixelChannel].traits);
 }
 
 static inline Quantum GetPixelCb(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][CbPixelChannel].channel]);
+  return(pixel[image->channel_map[CbPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelCbTraits(const Image *image)
 {
-  return(image->channel_map[image->map][CbPixelChannel].traits);
+  return(image->channel_map[CbPixelChannel].traits);
 }
 
 static inline Quantum GetPixelChannel(const Image *image,
   const PixelChannel channel,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][channel].channel]);
+  return(pixel[image->channel_map[channel].channel]);
 }
 
 static inline PixelChannel GetPixelChannelMapChannel(const Image *image,
   const PixelChannel channel)
 {
-  return(image->channel_map[image->map][channel].channel);
+  return(image->channel_map[channel].channel);
 }
 
 static inline PixelTrait GetPixelChannelMapTraits(const Image *image,
   const PixelChannel channel)
 {
-  return(image->channel_map[image->map][channel].traits);
+  return(image->channel_map[channel].traits);
 }
 
 static inline size_t GetPixelChannels(const Image *image)
@@ -92,52 +92,52 @@ static inline size_t GetPixelChannels(const Image *image)
 
 static inline Quantum GetPixelCr(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][CrPixelChannel].channel]);
+  return(pixel[image->channel_map[CrPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelCrTraits(const Image *image)
 {
-  return(image->channel_map[image->map][CrPixelChannel].traits);
+  return(image->channel_map[CrPixelChannel].traits);
 }
 
 static inline Quantum GetPixelCyan(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][CyanPixelChannel].channel]);
+  return(pixel[image->channel_map[CyanPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelCyanTraits(const Image *image)
 {
-  return(image->channel_map[image->map][CyanPixelChannel].traits);
+  return(image->channel_map[CyanPixelChannel].traits);
 }
 
 static inline Quantum GetPixelGray(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][GrayPixelChannel].channel]);
+  return(pixel[image->channel_map[GrayPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelGrayTraits(const Image *image)
 {
-  return(image->channel_map[image->map][GrayPixelChannel].traits);
+  return(image->channel_map[GrayPixelChannel].traits);
 }
 
 static inline Quantum GetPixelGreen(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][GreenPixelChannel].channel]);
+  return(pixel[image->channel_map[GreenPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelGreenTraits(const Image *image)
 {
-  return(image->channel_map[image->map][GreenPixelChannel].traits);
+  return(image->channel_map[GreenPixelChannel].traits);
 }
 
 static inline Quantum GetPixelIndex(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][IndexPixelChannel].channel]);
+  return(pixel[image->channel_map[IndexPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelIndexTraits(const Image *image)
 {
-  return(image->channel_map[image->map][IndexPixelChannel].traits);
+  return(image->channel_map[IndexPixelChannel].traits);
 }
 
 static inline Quantum GetPixelInfoIntensity(const PixelInfo *pixel_info)
@@ -168,12 +168,12 @@ static inline Quantum GetPixelInfoLuminance(const PixelInfo *pixel_info)
 
 static inline Quantum GetPixelMagenta(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][MagentaPixelChannel].channel]);
+  return(pixel[image->channel_map[MagentaPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelMagentaTraits(const Image *image)
 {
-  return(image->channel_map[image->map][MagentaPixelChannel].traits);
+  return(image->channel_map[MagentaPixelChannel].traits);
 }
 
 static inline size_t GetPixelMetaChannels(const Image *image)
@@ -188,12 +188,12 @@ static inline size_t GetPixelMetacontentExtent(const Image *image)
 
 static inline Quantum GetPixelRed(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][RedPixelChannel].channel]);
+  return(pixel[image->channel_map[RedPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelRedTraits(const Image *image)
 {
-  return(image->channel_map[image->map][RedPixelChannel].traits);
+  return(image->channel_map[RedPixelChannel].traits);
 }
 
 static inline void GetPixelPacket(const Image *image,const Quantum *pixel,
@@ -229,27 +229,27 @@ static inline Quantum GetPixelPacketIntensity(const PixelPacket *pixel)
 static inline PixelTrait GetPixelTraits(const Image *image,
   const PixelChannel channel)
 {
-  return(image->channel_map[image->map][channel].traits);
+  return(image->channel_map[channel].traits);
 }
 
 static inline Quantum GetPixelY(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][YPixelChannel].channel]);
+  return(pixel[image->channel_map[YPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelYTraits(const Image *image)
 {
-  return(image->channel_map[image->map][YPixelChannel].traits);
+  return(image->channel_map[YPixelChannel].traits);
 }
 
 static inline Quantum GetPixelYellow(const Image *image,const Quantum *pixel)
 {
-  return(pixel[image->channel_map[image->map][YellowPixelChannel].channel]);
+  return(pixel[image->channel_map[YellowPixelChannel].channel]);
 }
 
 static inline PixelTrait GetPixelYellowTraits(const Image *image)
 {
-  return(image->channel_map[image->map][YellowPixelChannel].traits);
+  return(image->channel_map[YellowPixelChannel].traits);
 }
 
 static inline MagickBooleanType IsPixelEquivalent(const Image *image,
@@ -429,57 +429,57 @@ static inline void SetPacketPixelInfo(const Image *image,
 static inline void SetPixelAlpha(const Image *image,const Quantum alpha,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][AlphaPixelChannel].channel]=alpha;
+  pixel[image->channel_map[AlphaPixelChannel].channel]=alpha;
 }
 
 static inline void SetPixelAlphaTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][AlphaPixelChannel].traits=traits;
+  image->channel_map[AlphaPixelChannel].traits=traits;
 }
 
 static inline void SetPixelBlack(const Image *image,const Quantum black,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][BlackPixelChannel].channel]=black;
+  pixel[image->channel_map[BlackPixelChannel].channel]=black;
 }
 
 static inline void SetPixelBlackTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][BlackPixelChannel].traits=traits;
+  image->channel_map[BlackPixelChannel].traits=traits;
 }
 
 static inline void SetPixelBlue(const Image *image,const Quantum blue,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][BluePixelChannel].channel]=blue;
+  pixel[image->channel_map[BluePixelChannel].channel]=blue;
 }
 
 static inline void SetPixelBlueTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][BluePixelChannel].traits=traits;
+  image->channel_map[BluePixelChannel].traits=traits;
 }
 
 static inline void SetPixelCb(const Image *image,const Quantum cb,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][CbPixelChannel].channel]=cb;
+  pixel[image->channel_map[CbPixelChannel].channel]=cb;
 }
 
 static inline void SetPixelCbTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][CbPixelChannel].traits=traits;
+  image->channel_map[CbPixelChannel].traits=traits;
 }
 
 static inline void SetPixelChannel(const Image *image,
   const PixelChannel channel,const Quantum quantum,Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][channel].channel]=quantum;
+  pixel[image->channel_map[channel].channel]=quantum;
 }
 
 static inline void SetPixelChannelMapChannel(const Image *image,
   const PixelChannel channel,const PixelChannel channels)
 {
-  image->channel_map[image->map][channel].channel=channels;
+  image->channel_map[channel].channel=channels;
 }
 
 static inline void SetPixelChannels(Image *image,const size_t number_channels)
@@ -490,63 +490,63 @@ static inline void SetPixelChannels(Image *image,const size_t number_channels)
 static inline void SetPixelChannelTraits(Image *image,
   const PixelChannel channel,const PixelTrait traits)
 {
-  image->channel_map[image->map][channel].traits=traits;
+  image->channel_map[channel].traits=traits;
 }
 
 static inline void SetPixelChannelMapTraits(Image *image,
   const PixelChannel channel,const PixelTrait traits)
 {
-  image->channel_map[image->map][channel].traits=traits;
+  image->channel_map[channel].traits=traits;
 }
 
 static inline void SetPixelCr(const Image *image,const Quantum cr,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][CrPixelChannel].channel]=cr;
+  pixel[image->channel_map[CrPixelChannel].channel]=cr;
 }
 
 static inline void SetPixelCrTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][CrPixelChannel].traits=traits;
+  image->channel_map[CrPixelChannel].traits=traits;
 }
 
 static inline void SetPixelCyan(const Image *image,const Quantum cyan,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][CyanPixelChannel].channel]=cyan;
+  pixel[image->channel_map[CyanPixelChannel].channel]=cyan;
 }
 
 static inline void SetPixelGray(const Image *image,const Quantum gray,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][GrayPixelChannel].channel]=gray;
+  pixel[image->channel_map[GrayPixelChannel].channel]=gray;
 }
 
 static inline void SetPixelGrayTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][GrayPixelChannel].traits=traits;
+  image->channel_map[GrayPixelChannel].traits=traits;
 }
 
 static inline void SetPixelGreen(const Image *image,const Quantum green,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][GreenPixelChannel].channel]=green;
+  pixel[image->channel_map[GreenPixelChannel].channel]=green;
 }
 
 static inline void SetPixelGreenTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][GreenPixelChannel].traits=traits;
+  image->channel_map[GreenPixelChannel].traits=traits;
 }
 
 static inline void SetPixelIndex(const Image *image,const Quantum index,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][IndexPixelChannel].channel]=index;
+  pixel[image->channel_map[IndexPixelChannel].channel]=index;
 }
 
 static inline void SetPixelIndexTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][IndexPixelChannel].traits=traits;
+  image->channel_map[IndexPixelChannel].traits=traits;
 }
 
 static inline void SetPixelInfo(const Image *image,const Quantum *pixel,
@@ -590,13 +590,13 @@ static inline void SetPixelInfoPacket(const Image *image,
 static inline void SetPixelMagenta(const Image *image,const Quantum magenta,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][MagentaPixelChannel].channel]=
+  pixel[image->channel_map[MagentaPixelChannel].channel]=
     magenta;
 }
 
 static inline void SetPixelMagentaTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][MagentaPixelChannel].traits=traits;
+  image->channel_map[MagentaPixelChannel].traits=traits;
 }
 
 static inline void SetPixelMetaChannels(Image *image,
@@ -613,12 +613,12 @@ static inline void SetPixelMetacontentExtent(Image *image,const size_t extent)
 static inline void SetPixelRed(const Image *image,const Quantum red,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][RedPixelChannel].channel]=red;
+  pixel[image->channel_map[RedPixelChannel].channel]=red;
 }
 
 static inline void SetPixelRedTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][RedPixelChannel].traits=traits;
+  image->channel_map[RedPixelChannel].traits=traits;
 }
 
 static inline void SetPixelPacket(const Image *image,const PixelPacket *packet,
@@ -644,23 +644,23 @@ static inline void SetPixelPixelInfo(const Image *image,
 static inline void SetPixelYellow(const Image *image,const Quantum yellow,
   Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][YellowPixelChannel].channel]=
+  pixel[image->channel_map[YellowPixelChannel].channel]=
     yellow;
 }
 
 static inline void SetPixelYellowTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][YellowPixelChannel].traits=traits;
+  image->channel_map[YellowPixelChannel].traits=traits;
 }
 
 static inline void SetPixelY(const Image *image,const Quantum y,Quantum *pixel)
 {
-  pixel[image->channel_map[image->map][YPixelChannel].channel]=y;
+  pixel[image->channel_map[YPixelChannel].channel]=y;
 }
 
 static inline void SetPixelYTraits(Image *image,const PixelTrait traits)
 {
-  image->channel_map[image->map][YPixelChannel].traits=traits;
+  image->channel_map[YPixelChannel].traits=traits;
 }
 
 static inline Quantum GetPixelIntensity(const Image *image,const Quantum *pixel)
index a1f5462d9d9ab7297345a0a536ef5b692cf2c5e5..b5c2262569a32d66f36f35265e80695561682aa9 100644 (file)
 %
 %  The format of the AcquirePixelChannelMap() method is:
 %
-%      PixelChannelMap **AcquirePixelChannelMap(void)
+%      PixelChannelMap *AcquirePixelChannelMap(void)
 %
 */
-MagickExport PixelChannelMap **AcquirePixelChannelMap(void)
+MagickExport PixelChannelMap *AcquirePixelChannelMap(void)
 {
   PixelChannelMap
-    **channel_map;
+    *channel_map;
 
   register ssize_t
     i;
 
-  channel_map=(PixelChannelMap **) AcquireAlignedMemory(MaxPixelChannelMaps,
-    sizeof(**channel_map));
-  if (channel_map == (PixelChannelMap **) NULL)
+  channel_map=(PixelChannelMap *) AcquireQuantumMemory(MaxPixelChannels,
+    sizeof(*channel_map));
+  if (channel_map == (PixelChannelMap *) NULL)
     ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
-  for (i=0; i < MaxPixelChannelMaps; i++)
-  {
-    register ssize_t
-      j;
-
-    channel_map[i]=(PixelChannelMap *) AcquireQuantumMemory(MaxPixelChannels,
-      sizeof(*channel_map[i]));
-    if (channel_map[i] == (PixelChannelMap *) NULL)
-      ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
-    (void) ResetMagickMemory(channel_map[i],0,MaxPixelChannels*
-      sizeof(*channel_map[i]));
-    for (j=0; j < MaxPixelChannels; j++)
-      channel_map[i][j].channel=(PixelChannel) j;
-  }
+  (void) ResetMagickMemory(channel_map,0,MaxPixelChannels*sizeof(*channel_map));
+  for (i=0; i < MaxPixelChannels; i++)
+    channel_map[i].channel=(PixelChannel) i;
   return(channel_map);
 }
 \f
@@ -130,30 +119,24 @@ MagickExport PixelChannelMap **AcquirePixelChannelMap(void)
 %
 %  The format of the ClonePixelChannelMap() method is:
 %
-%      PixelChannelMap **ClonePixelChannelMap(
-%        PixelChannelMap **channel_map)
+%      PixelChannelMap *ClonePixelChannelMap(PixelChannelMap *channel_map)
 %
 %  A description of each parameter follows:
 %
 %    o channel_map: the pixel component map.
 %
 */
-MagickExport PixelChannelMap **ClonePixelChannelMap(
-  PixelChannelMap **channel_map)
+MagickExport PixelChannelMap *ClonePixelChannelMap(PixelChannelMap *channel_map)
 {
   PixelChannelMap
-    **clone_map;
-
-  register ssize_t
-    i;
+    *clone_map;
 
-  assert(channel_map != (PixelChannelMap **) NULL);
+  assert(channel_map != (PixelChannelMap *) NULL);
   clone_map=AcquirePixelChannelMap();
-  if (clone_map == (PixelChannelMap **) NULL)
-    return((PixelChannelMap **) NULL);
-  for (i=0; i < MaxPixelChannelMaps; i++)
-    (void) CopyMagickMemory(clone_map[i],channel_map[i],MaxPixelChannels*
-      sizeof(*channel_map[i]));
+  if (clone_map == (PixelChannelMap *) NULL)
+    return((PixelChannelMap *) NULL);
+  (void) CopyMagickMemory(clone_map,channel_map,MaxPixelChannels*
+    sizeof(*channel_map));
   return(clone_map);
 }
 \f
@@ -208,23 +191,19 @@ MagickExport PixelInfo *ClonePixelInfo(const PixelInfo *pixel)
 %
 %  The format of the DestroyPixelChannelMap() method is:
 %
-%      PixelChannelMap **DestroyPixelChannelMap(PixelChannelMap **channel_map)
+%      PixelChannelMap *DestroyPixelChannelMap(PixelChannelMap *channel_map)
 %
 %  A description of each parameter follows:
 %
 %    o channel_map: the pixel component map.
 %
 */
-MagickExport PixelChannelMap **DestroyPixelChannelMap(
-  PixelChannelMap **channel_map)
+MagickExport PixelChannelMap *DestroyPixelChannelMap(
+  PixelChannelMap *channel_map)
 {
-  register ssize_t
-    i;
-
-  assert(channel_map != (PixelChannelMap **) NULL);
-  for (i=0; i < MaxPixelChannelMaps; i++)
-    channel_map[i]=(PixelChannelMap *) RelinquishMagickMemory(channel_map[i]);
-  return((PixelChannelMap **) RelinquishMagickMemory(channel_map));
+  assert(channel_map != (PixelChannelMap *) NULL);
+  channel_map=(PixelChannelMap *) RelinquishMagickMemory(channel_map);
+  return((PixelChannelMap *) RelinquishMagickMemory(channel_map));
 }
 \f
 /*
@@ -3567,6 +3546,75 @@ MagickExport MagickBooleanType ImportImagePixels(Image *image,
 %                                                                             %
 %                                                                             %
 %                                                                             %
++   I n i t i a l i z e P i x e l C h a n n e l M a p                         %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  InitializePixelChannelMap() defines the standard pixel component map.
+%
+%  The format of the InitializePixelChannelMap() method is:
+%
+%      void InitializePixelChannelMap(Image *image)
+%
+%  A description of each parameter follows:
+%
+%    o image: the image.
+%
+*/
+MagickExport void InitializePixelChannelMap(Image *image)
+{
+  PixelChannel
+    alpha_channel;
+
+  register ssize_t
+    i;
+
+  for (i=0; i < (ssize_t) MaxPixelChannels; i++)
+  {
+    SetPixelChannelMapChannel(image,(PixelChannel) i,(PixelChannel) i);
+    SetPixelChannelMapTraits(image,(PixelChannel) i,UndefinedPixelTrait);
+  }
+  image->sync=MagickTrue;
+  image->number_channels=4;
+  if (0 && image->colorspace == GRAYColorspace)
+    image->number_channels=2;
+  if (image->colorspace == CMYKColorspace)
+    image->number_channels++;
+  if (image->storage_class == PseudoClass)
+    image->number_channels++;
+  for (i=0; i < (ssize_t) image->number_channels; i++)
+    SetPixelChannelMapTraits(image,(PixelChannel) i,(PixelTrait)
+      UpdatePixelTrait);
+  alpha_channel=GetPixelChannelMapChannel(image,AlphaPixelChannel);
+  if (image->matte != MagickFalse)
+    for (i=0; i < (ssize_t) image->number_channels; i++)
+      if ((PixelChannel) i != alpha_channel)
+        SetPixelChannelMapTraits(image,(PixelChannel) i,(PixelTrait)
+          (UpdatePixelTrait | BlendPixelTrait));
+  if (0 && image->colorspace == GRAYColorspace)
+    {
+      image->number_channels=2;
+      SetPixelChannelMapChannel(image,GreenPixelChannel,RedPixelChannel);
+      SetPixelChannelMapChannel(image,BluePixelChannel,RedPixelChannel);
+    }
+  if (image->storage_class == PseudoClass)
+    {
+      SetPixelChannelMapChannel(image,IndexPixelChannel,IndexPixelChannel);
+      SetPixelChannelMapTraits(image,IndexPixelChannel,CopyPixelTrait);
+    }
+  image->number_channels+=image->number_meta_channels;
+  for ( ; i < (ssize_t) image->number_channels; i++)
+    SetPixelChannelMapTraits(image,(PixelChannel) i,CopyPixelTrait);
+  SetPixelChannelMap(image,image->channel_mask);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 %   I n t e r p o l a t e P i x e l C h a n n e l                             %
 %                                                                             %
 %                                                                             %
@@ -4844,69 +4892,6 @@ MagickExport MagickBooleanType IsFuzzyEquivalencePixelPacket(const Image *image,
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   P o p P i x e l C h a n n e l M a p                                       %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  PopPixelChannelMap() pops the pixel component map.
-%
-%  The format of the PopPixelChannelMap method is:
-%
-%      void PopPixelChannelMap(Image *image)
-%
-%  A description of each parameter follows:
-%
-%    o image: the image.
-%
-*/
-MagickExport void PopPixelChannelMap(Image *image)
-{
-  image->map--;
-  if (image->map < 0)
-    ThrowFatalException(ResourceLimitFatalError,"PixelChannelMapStack");
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%   P u s h P i x e l C h a n n e l M a p                                     %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  PushPixelChannelMap() pushes the pixel channel map from the specified
-%  channel mask.
-%
-%  The format of the PushPixelChannelMap method is:
-%
-%      void PushPixelChannelMap(Image *image,const ChannelType channel_mask)
-%
-%  A description of each parameter follows:
-%
-%    o image: the image.
-%
-%    o channel_mask: the channel mask.
-%
-*/
-MagickExport void PushPixelChannelMap(Image *image,
-  const ChannelType channel_mask)
-{
-  image->map++;
-  if (image->map >= MaxPixelChannelMaps)
-    ThrowFatalException(ResourceLimitFatalError,"PixelChannelMapStack");
-  SetPixelChannelMap(image,channel_mask);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
 %   S e t P i x e l C h a n n e l M a p                                       %
 %                                                                             %
 %                                                                             %
@@ -4947,65 +4932,35 @@ MagickExport void SetPixelChannelMap(Image *image,const ChannelType mask)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-+   S t a n d a r d P i x e l C h a n n e l M a p                             %
+%   S e t P i x e l C h a n n e l M a s k                                     %
 %                                                                             %
 %                                                                             %
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  StandardPixelChannelMap() defines the standard pixel component map.
+%  SetPixelChannelMask() sets the pixel channel mask from the specified
+%  channel mask.
 %
-%  The format of the StandardPixelChannelMap() method is:
+%  The format of the SetPixelChannelMask method is:
 %
-%      void StandardPixelChannelMap(Image *image)
+%      ChannelType SetPixelChannelMask(Image *image,
+%        const ChannelType channel_mask)
 %
 %  A description of each parameter follows:
 %
 %    o image: the image.
 %
+%    o channel_mask: the channel mask.
+%
 */
-MagickExport void StandardPixelChannelMap(Image *image)
+MagickExport ChannelType SetPixelChannelMask(Image *image,
+  const ChannelType channel_mask)
 {
-  PixelChannel
-    alpha_channel;
-
-  register ssize_t
-    i;
+  ChannelType
+    mask;
 
-  for (i=0; i < (ssize_t) MaxPixelChannels; i++)
-  {
-    SetPixelChannelMapChannel(image,(PixelChannel) i,(PixelChannel) i);
-    SetPixelChannelMapTraits(image,(PixelChannel) i,UndefinedPixelTrait);
-  }
-  image->sync=MagickTrue;
-  image->number_channels=4;
-  if (0 && image->colorspace == GRAYColorspace)
-    image->number_channels=2;
-  if (image->colorspace == CMYKColorspace)
-    image->number_channels++;
-  if (image->storage_class == PseudoClass)
-    image->number_channels++;
-  for (i=0; i < (ssize_t) image->number_channels; i++)
-    SetPixelChannelMapTraits(image,(PixelChannel) i,(PixelTrait)
-      UpdatePixelTrait);
-  alpha_channel=GetPixelChannelMapChannel(image,AlphaPixelChannel);
-  if (image->matte != MagickFalse)
-    for (i=0; i < (ssize_t) image->number_channels; i++)
-      if ((PixelChannel) i != alpha_channel)
-        SetPixelChannelMapTraits(image,(PixelChannel) i,(PixelTrait)
-          (UpdatePixelTrait | BlendPixelTrait));
-  if (0 && image->colorspace == GRAYColorspace)
-    {
-      image->number_channels=2;
-      SetPixelChannelMapChannel(image,GreenPixelChannel,RedPixelChannel);
-      SetPixelChannelMapChannel(image,BluePixelChannel,RedPixelChannel);
-    }
-  if (image->storage_class == PseudoClass)
-    {
-      SetPixelChannelMapChannel(image,IndexPixelChannel,IndexPixelChannel);
-      SetPixelChannelMapTraits(image,IndexPixelChannel,CopyPixelTrait);
-    }
-  image->number_channels+=image->number_meta_channels;
-  for ( ; i < (ssize_t) image->number_channels; i++)
-    SetPixelChannelMapTraits(image,(PixelChannel) i,CopyPixelTrait);
+  mask=image->channel_mask;
+  image->channel_mask=channel_mask;
+  SetPixelChannelMap(image,channel_mask);
+  return(mask);
 }
index 0917049ab5ca81302e9072376f87363f11bf3d0e..08ef29db29366b790c2eda87eeebe6e96bd72db6 100644 (file)
@@ -26,7 +26,6 @@ extern "C" {
 #include <MagickCore/constitute.h>
 
 #define MaxPixelChannels  32
-#define MaxPixelChannelMaps  8
 
 typedef enum
 {
@@ -141,6 +140,9 @@ typedef struct _PixelPacket
 typedef struct _CacheView
   CacheView_;
 
+extern MagickExport ChannelType
+  SetPixelChannelMask(Image *,const ChannelType);
+
 extern MagickExport MagickBooleanType
   ExportImagePixels(const Image *,const ssize_t,const ssize_t,const size_t,
     const size_t,const char *,const StorageType,void *,ExceptionInfo *),
@@ -159,18 +161,16 @@ extern MagickExport MagickBooleanType
     const PixelPacket *);
 
 extern MagickExport PixelChannelMap
-  **AcquirePixelChannelMap(void),
-  **ClonePixelChannelMap(PixelChannelMap **),
-  **DestroyPixelChannelMap(PixelChannelMap **);
+  *AcquirePixelChannelMap(void),
+  *ClonePixelChannelMap(PixelChannelMap *),
+  *DestroyPixelChannelMap(PixelChannelMap *);
 
 extern MagickExport PixelInfo
   *ClonePixelInfo(const PixelInfo *);
 
 extern MagickExport void
-  StandardPixelChannelMap(Image *),
+  InitializePixelChannelMap(Image *),
   GetPixelInfo(const Image *,PixelInfo *),
-  PopPixelChannelMap(Image *),
-  PushPixelChannelMap(Image *,const ChannelType),
   SetPixelChannelMap(Image *,const ChannelType);
 
 #if defined(__cplusplus) || defined(c_plusplus)
index 9d9c7577e908f4561752e89d94f80787d1544bdc..fcf2f8185a23f6ff103862b2027b7b85dd3e8bc0 100644 (file)
@@ -27,7 +27,7 @@ extern "C" {
 */
 #define MagickPackageName "ImageMagick"
 #define MagickCopyright  "Copyright (C) 1999-2011 ImageMagick Studio LLC"
-#define MagickSVNRevision  "4982"
+#define MagickSVNRevision  "exported"
 #define MagickLibVersion  0x700
 #define MagickLibVersionText  "7.0.0"
 #define MagickLibVersionNumber  5,0,0
index 91fff18900298f47320784266f04eec81e32730d..329abca234148f237d67e80cdb208452ab2f695e 100644 (file)
@@ -111,6 +111,9 @@ static MagickBooleanType CompositeImageList(ImageInfo *image_info,Image **image,
   Image *composite_image,CompositeOptions *composite_options,
   ExceptionInfo *exception)
 {
+  ChannelType
+    channel_mask;
+
   MagickStatusType
     status;
 
@@ -122,25 +125,25 @@ static MagickBooleanType CompositeImageList(ImageInfo *image_info,Image **image,
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",(*image)->filename);
   assert(exception != (ExceptionInfo *) NULL);
   status=MagickTrue;
-  PushPixelChannelMap(composite_image,composite_options->channel);
+  channel_mask=SetPixelChannelMask(composite_image,composite_options->channel);
   if (composite_image != (Image *) NULL)
     {
       assert(composite_image->signature == MagickSignature);
-      switch( composite_options->compose )
-        {
-          case BlendCompositeOp:
-          case BlurCompositeOp:
-          case DisplaceCompositeOp:
-          case DistortCompositeOp:
-          case DissolveCompositeOp:
-          case ModulateCompositeOp:
-          case ThresholdCompositeOp:
-            (void) SetImageArtifact(composite_image,"compose:args",
-              composite_options->compose_args);
-            break;
-          default:
-            break;
-        }
+      switch (composite_options->compose)
+      {
+        case BlendCompositeOp:
+        case BlurCompositeOp:
+        case DisplaceCompositeOp:
+        case DistortCompositeOp:
+        case DissolveCompositeOp:
+        case ModulateCompositeOp:
+        case ThresholdCompositeOp:
+          (void) SetImageArtifact(composite_image,"compose:args",
+            composite_options->compose_args);
+          break;
+        default:
+          break;
+      }
       /*
         Composite image.
       */
@@ -218,7 +221,7 @@ static MagickBooleanType CompositeImageList(ImageInfo *image_info,Image **image,
               GetImageException(*image,exception);
             }
     }
-  PopPixelChannelMap(composite_image);
+  (void) SetPixelChannelMap(composite_image,channel_mask);
   return(status != 0 ? MagickTrue : MagickFalse);
 }
 
index 3b2e855f12da05138284ae5175445852c0e847ac..a58c1b389db353ef566eadba31395e69bfe66d83 100644 (file)
@@ -4043,7 +4043,8 @@ Fx(ref,...)
       expression[MaxTextExtent];
 
     ChannelType
-      channel;
+      channel,
+      channel_mask;
 
     ExceptionInfo
       *exception;
@@ -4149,10 +4150,10 @@ Fx(ref,...)
           }
         }
       }
-    PushPixelChannelMap(image,channel);
+    channel_mask=SetPixelChannelMask(image,channel);
     image=FxImage(image,expression,exception);
     if (image != (Image *) NULL)
-      PopPixelChannelMap(image);
+      (void) SetPixelChannelMask(image,channel_mask);
     if ((image == (Image *) NULL) || (exception->severity >= ErrorException))
       goto PerlException;
     for ( ; image; image=image->next)
@@ -7204,7 +7205,8 @@ Mogrify(ref,...)
       message[MaxTextExtent];
 
     ChannelType
-      channel;
+      channel,
+      channel_mask;
 
     CompositeOperator
       compose;
@@ -7491,11 +7493,11 @@ Mogrify(ref,...)
             argument_list[0].integer_reference=UniformNoise;
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=AddNoiseImage(image,(NoiseType)
             argument_list[0].integer_reference,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 4:  /* Colorize */
@@ -7557,11 +7559,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=BlurImage(image,geometry_info.rho,geometry_info.sigma,
             exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 7:  /* Chop */
@@ -7717,11 +7719,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=StatisticImage(image,MedianStatistic,(size_t) geometry_info.rho,
             (size_t) geometry_info.sigma,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 19:  /* Minify */
@@ -7752,11 +7754,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=StatisticImage(image,NonpeakStatistic,(size_t)
             geometry_info.rho,(size_t) geometry_info.sigma,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 22:  /* Roll */
@@ -7844,11 +7846,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=SharpenImage(image,geometry_info.rho,geometry_info.sigma,
             exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 28:  /* Shear */
@@ -8354,7 +8356,7 @@ Mogrify(ref,...)
             geometry.y);
           flags=ParseGravityGeometry(image,composite_geometry,&geometry,
             exception);
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           if (attribute_flag[8] == 0) /* no rotate */
             CompositeImage(image,compose,composite_image,geometry.x,geometry.y);
           else
@@ -8377,7 +8379,7 @@ Mogrify(ref,...)
               else
                 image->mask=DestroyImage(image->mask);
             }
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 36:  /* Contrast */
@@ -8640,9 +8642,9 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           EqualizeImage(image);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 40:  /* Gamma */
@@ -8726,11 +8728,10 @@ Mogrify(ref,...)
           invert=MagickFalse;
           if (attribute_flag[6] != 0)
             invert=(MagickBooleanType) argument_list[6].integer_reference;
-          PushPixelChannelMap(image,AlphaChannel);
+          channel_mask=SetPixelChannelMask(image,AlphaChannel);
           (void) FloodfillPaintImage(image,draw_info,&target,geometry.x,
             geometry.y,invert);
-          PopPixelChannelMap(image);
-          StandardPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -8780,19 +8781,19 @@ Mogrify(ref,...)
             argument_list[0].integer_reference=0;
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) NegateImage(image,argument_list[0].integer_reference != 0 ?
             MagickTrue : MagickFalse,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 45:  /* Normalize */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           NormalizeImage(image,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 46:  /* NumberColors */
@@ -8822,9 +8823,9 @@ Mogrify(ref,...)
           invert=MagickFalse;
           if (attribute_flag[4] != 0)
             invert=(MagickBooleanType) argument_list[4].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) OpaquePaintImage(image,&target,&fill_color,invert);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 48:  /* Quantize */
@@ -8961,10 +8962,10 @@ Mogrify(ref,...)
             op=(MagickEvaluateOperator) argument_list[1].integer_reference;
           if (attribute_flag[2] != MagickFalse)
             channel=(ChannelType) argument_list[2].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) EvaluateImage(image,op,argument_list[0].real_reference,
             exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 56:  /* Transparent */
@@ -9009,9 +9010,9 @@ Mogrify(ref,...)
             channel=(ChannelType) argument_list[1].integer_reference;
           threshold=SiPrefixToDouble(argument_list[0].string_reference,
             QuantumRange);
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) BilevelImage(image,threshold);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 58:  /* Charcoal */
@@ -9063,9 +9064,9 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) SeparateImage(image);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 63:  /* Stereo */
@@ -9118,11 +9119,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=GaussianBlurImage(image,geometry_info.rho,geometry_info.sigma,
             exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 67:  /* Convolve */
@@ -9173,11 +9174,11 @@ Mogrify(ref,...)
               if (kernel == (KernelInfo *) NULL)
                 break;
             }
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           kernel->bias=image->bias;
           image=ConvolveImage(image,kernel,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           kernel=DestroyKernelInfo(kernel);
           break;
         }
@@ -9275,11 +9276,11 @@ Mogrify(ref,...)
             geometry_info.psi=argument_list[4].real_reference;
           if (attribute_flag[5] != 0)
             channel=(ChannelType) argument_list[5].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=UnsharpMaskImage(image,geometry_info.rho,geometry_info.sigma,
             geometry_info.xi,geometry_info.psi,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 70:  /* MotionBlur */
@@ -9301,11 +9302,11 @@ Mogrify(ref,...)
             geometry_info.xi=argument_list[3].real_reference;
           if (attribute_flag[4] != 0)
             channel=(ChannelType) argument_list[4].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=MotionBlurImage(image,geometry_info.rho,geometry_info.sigma,
             geometry_info.xi,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 71:  /* OrderedDither */
@@ -9314,10 +9315,10 @@ Mogrify(ref,...)
             argument_list[0].string_reference="o8x8";
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) OrderedPosterizeImage(image,argument_list[0].string_reference,
             exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 72:  /* Shave */
@@ -9372,9 +9373,9 @@ Mogrify(ref,...)
               argument_list[0].real_reference=argument_list[5].real_reference;
               attribute_flag[0]=attribute_flag[5];
             }
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) LevelImage(image,black_point,white_point,gamma,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 74:  /* Clip */
@@ -9594,10 +9595,10 @@ Mogrify(ref,...)
             argument_list[0].string_reference="50%";
           if (attribute_flag[2] != 0)
             channel=(ChannelType) argument_list[2].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           BlackThresholdImage(image,argument_list[0].string_reference,
             exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 81:  /* WhiteThreshold */
@@ -9606,10 +9607,10 @@ Mogrify(ref,...)
             argument_list[0].string_reference="50%";
           if (attribute_flag[2] != 0)
             channel=(ChannelType) argument_list[2].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           WhiteThresholdImage(image,argument_list[0].string_reference,
             exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 82:  /* RadialBlur */
@@ -9625,10 +9626,10 @@ Mogrify(ref,...)
             geometry_info.rho=argument_list[1].real_reference;
           if (attribute_flag[2] != 0)
             channel=(ChannelType) argument_list[2].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=RadialBlurImage(image,geometry_info.rho,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 83:  /* Thumbnail */
@@ -9667,9 +9668,9 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) SeparateImage(image);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 87:  /* Splice */
@@ -9778,10 +9779,10 @@ Mogrify(ref,...)
           if (attribute_flag[4] != 0)
             sharpen=argument_list[4].integer_reference != 0 ? MagickTrue :
               MagickFalse;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) SigmoidalContrastImage(image,sharpen,geometry_info.rho,
             geometry_info.sigma);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 93:  /* Extent */
@@ -9876,9 +9877,9 @@ Mogrify(ref,...)
             white_point=argument_list[2].real_reference;
           if (attribute_flag[4] != 0)
             channel=(ChannelType) argument_list[4].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) ContrastStretchImage(image,black_point,white_point,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 96:  /* Sans0 */
@@ -9904,11 +9905,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=AdaptiveSharpenImage(image,geometry_info.rho,
             geometry_info.sigma,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 99:  /* Transpose */
@@ -9980,11 +9981,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=AdaptiveBlurImage(image,geometry_info.rho,geometry_info.sigma,
             exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 103:  /* Sketch */
@@ -10163,10 +10164,10 @@ Mogrify(ref,...)
           invert=MagickFalse;
           if (attribute_flag[7] != 0)
             invert=(MagickBooleanType) argument_list[7].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) FloodfillPaintImage(image,draw_info,&target,geometry.x,
             geometry.y,invert);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -10226,9 +10227,9 @@ Mogrify(ref,...)
             }
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) ClutImage(image,argument_list[0].image_reference,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 114:  /* LiquidRescale */
@@ -10336,11 +10337,11 @@ Mogrify(ref,...)
               argument_list[2].integer_reference);
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=SparseColorImage(image,method,number_coordinates,coordinates,
             exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           if ((attribute_flag[2] != 0) && (image != (Image *) NULL))
             virtual_pixel=SetImageVirtualPixelMethod(image,virtual_pixel);
           coordinates=(double *) RelinquishMagickMemory(coordinates);
@@ -10410,11 +10411,11 @@ Mogrify(ref,...)
             geometry_info.xi=argument_list[3].integer_reference;;
           if (attribute_flag[4] != 0)
             channel=(ChannelType) argument_list[4].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=SelectiveBlurImage(image,geometry_info.rho,geometry_info.sigma,
             geometry_info.xi,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 122:  /* HaldClut */
@@ -10427,9 +10428,9 @@ Mogrify(ref,...)
             }
           if (attribute_flag[1] != 0)
             channel=(ChannelType) argument_list[1].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) HaldClutImage(image,argument_list[0].image_reference);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 123:  /* BlueShift */
@@ -10466,18 +10467,18 @@ Mogrify(ref,...)
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) AutoGammaImage(image,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 128:  /* AutoLevel */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) AutoLevelImage(image,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 129:  /* LevelColors */
@@ -10496,19 +10497,19 @@ Mogrify(ref,...)
                &white_point,exception);
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) LevelImageColors(image,&black_point,&white_point,
             argument_list[0].integer_reference != 0 ? MagickTrue : MagickFalse);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 130:  /* Clamp */
         {
           if (attribute_flag[0] != 0)
             channel=(ChannelType) argument_list[0].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) ClampImage(image);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 132:  /* BrightnessContrast */
@@ -10533,9 +10534,9 @@ Mogrify(ref,...)
             contrast=argument_list[2].real_reference;
           if (attribute_flag[4] != 0)
             channel=(ChannelType) argument_list[4].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           (void) BrightnessContrastImage(image,brightness,contrast,exception);
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 133:  /* Morphology */
@@ -10562,10 +10563,10 @@ Mogrify(ref,...)
           iterations=1;
           if (attribute_flag[3] != 0)
             iterations=argument_list[4].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=MorphologyImage(image,method,iterations,kernel,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           kernel=DestroyKernelInfo(kernel);
           break;
         }
@@ -10641,11 +10642,11 @@ Mogrify(ref,...)
             geometry_info.sigma=argument_list[2].real_reference;
           if (attribute_flag[3] != 0)
             channel=(ChannelType) argument_list[3].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=StatisticImage(image,ModeStatistic,(size_t) geometry_info.rho,
             (size_t) geometry_info.sigma,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
         case 137:  /* Statistic */
@@ -10669,11 +10670,11 @@ Mogrify(ref,...)
             channel=(ChannelType) argument_list[3].integer_reference;
           if (attribute_flag[4] != 0)
             statistic=(StatisticType) argument_list[4].integer_reference;
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           image=StatisticImage(image,statistic,(size_t) geometry_info.rho,
             (size_t) geometry_info.sigma,exception);
           if (image != (Image *) NULL)
-            PopPixelChannelMap(image);
+            (void) SetPixelChannelMask(image,channel_mask);
           break;
         }
       }
@@ -13234,7 +13235,8 @@ SetPixel(ref,...)
       *attribute;
 
     ChannelType
-      channel;
+      channel,
+      channel_mask;
 
     ExceptionInfo
       *exception;
@@ -13395,7 +13397,7 @@ SetPixel(ref,...)
       }
     }
     (void) SetImageStorageClass(image,DirectClass,exception);
-    PushPixelChannelMap(image,channel);
+    channel_mask=SetPixelChannelMask(image,channel);
     q=GetAuthenticPixels(image,region.x,region.y,1,1,exception);
     if ((q == (const Quantum *) NULL) || (av == (AV *) NULL) ||
         (SvTYPE(av) != SVt_PVAV))
@@ -13449,7 +13451,7 @@ SetPixel(ref,...)
           }
         (void) SyncAuthenticPixels(image,exception);
       }
-    PopPixelChannelMap(image);
+    (void) SetPixelChannelMask(image,channel_mask);
 
   PerlException:
     InheritPerlException(exception,perl_exception);
index 04d2df3c74db41ea20bc56e23c9b2dc8ec4d8cf9..5b0750fe68c7363f866e208beb9a90c9c7772510 100644 (file)
@@ -605,6 +605,9 @@ static void MSLStartElement(void *context,const xmlChar *tag,
   ChannelType
     channel;
 
+  ChannelType
+    channel_mask;
+
   char
     key[MaxTextExtent],
     *value;
@@ -736,10 +739,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          PushPixelChannelMap(msl_info->image[n],channel);
+          channel_mask=SetPixelChannelMask(msl_info->image[n],channel);
           noise_image=AddNoiseImage(msl_info->image[n],noise,
             &msl_info->image[n]->exception);
-          PopPixelChannelMap(msl_info->image[n]);
+          (void) SetPixelChannelMap(msl_info->image[n],channel_mask);
           if (noise_image == (Image *) NULL)
             break;
           msl_info->image[n]=DestroyImage(msl_info->image[n]);
@@ -1229,10 +1232,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          PushPixelChannelMap(msl_info->image[n],channel);
+          channel_mask=SetPixelChannelMask(msl_info->image[n],channel);
           blur_image=BlurImage(msl_info->image[n],geometry_info.rho,
             geometry_info.sigma,&msl_info->image[n]->exception);
-          PopPixelChannelMap(msl_info->image[n]);
+          (void) SetPixelChannelMap(msl_info->image[n],channel_mask);
           if (blur_image == (Image *) NULL)
             break;
           msl_info->image[n]=DestroyImage(msl_info->image[n]);
@@ -2053,7 +2056,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
             geometry.y);
           flags=ParseGravityGeometry(image,composite_geometry,&geometry,
             &exception);
-          PushPixelChannelMap(image,channel);
+          channel_mask=SetPixelChannelMask(image,channel);
           if (rotate_image == (Image *) NULL)
             CompositeImage(image,compose,composite_image,geometry.x,geometry.y);
           else
@@ -2067,7 +2070,7 @@ static void MSLStartElement(void *context,const xmlChar *tag,
               CompositeImage(image,compose,rotate_image,geometry.x,geometry.y);
               rotate_image=DestroyImage(rotate_image);
             }
-          PopPixelChannelMap(image);
+          (void) SetPixelChannelMask(image,channel_mask);
           composite_image=DestroyImage(composite_image);
           break;
         }
@@ -3735,11 +3738,11 @@ static void MSLStartElement(void *context,const xmlChar *tag,
           draw_info=CloneDrawInfo(msl_info->image_info[n],
             msl_info->draw_info[n]);
           draw_info->fill.alpha=ClampToQuantum(opacity);
-          PushPixelChannelMap(msl_info->image[n],AlphaChannel);
+          channel_mask=SetPixelChannelMask(msl_info->image[n],AlphaChannel);
           (void) FloodfillPaintImage(msl_info->image[n],draw_info,&target,
             geometry.x,geometry.y,paint_method == FloodfillMethod ?
             MagickFalse : MagickTrue);
-          PopPixelChannelMap(msl_info->image[n]);
+          (void) SetPixelChannelMap(msl_info->image[n],channel_mask);
           draw_info=DestroyDrawInfo(draw_info);
           break;
         }
@@ -4035,10 +4038,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          PushPixelChannelMap(msl_info->image[n],channel);
+          channel_mask=SetPixelChannelMask(msl_info->image[n],channel);
           (void) NegateImage(msl_info->image[n],gray,
             &msl_info->image[n]->exception);
-          PopPixelChannelMap(msl_info->image[n]);
+          (void) SetPixelChannelMap(msl_info->image[n],channel_mask);
           break;
         }
       if (LocaleCompare((const char *) tag,"normalize") == 0)
@@ -4228,10 +4231,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
                 }
               }
             }
-          PushPixelChannelMap(msl_info->image[n],channel);
+          channel_mask=SetPixelChannelMask(msl_info->image[n],channel);
           (void) OpaquePaintImage(msl_info->image[n],&target,&fill_color,
             MagickFalse);
-          PopPixelChannelMap(msl_info->image[n]);
+          (void) SetPixelChannelMap(msl_info->image[n],channel_mask);
           break;
         }
       ThrowMSLException(OptionError,"UnrecognizedElement",(const char *) tag);
index 8b559d824db1c7ede3904f396e36847d37b614aa..b2b772ebdb822d5715687fd03dcd65666148971b 100644 (file)
@@ -11555,6 +11555,9 @@ static MagickBooleanType WriteOneJNGImage(MngInfo *mng_info,
 
   if (transparent)
     {
+      ChannelType
+        channel_mask;
+
       jng_color_type=14;
 
       /* Create JPEG blob, image, and image_info */
@@ -11577,9 +11580,9 @@ static MagickBooleanType WriteOneJNGImage(MngInfo *mng_info,
         ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
 
       (void) CopyMagickString(jpeg_image->magick,"JPEG",MaxTextExtent);
-      PushPixelChannelMap(jpeg_image,AlphaChannel);
+      channel_mask=SetPixelChannelMask(jpeg_image,AlphaChannel);
       status=SeparateImage(jpeg_image);
-      PopPixelChannelMap(jpeg_image);
+      (void) SetPixelChannelMap(jpeg_image,channel_mask);
       jpeg_image->matte=MagickFalse;
 
       if (jng_quality >= 1000)
index e009f90a1f6913f3c54d7beba8ba1de56e8dfabb..74e723ed16162859e5b1be3d4f6f8d450ab16f6f 100644 (file)
@@ -427,6 +427,9 @@ static MagickBooleanType SerializeImageIndexes(const ImageInfo *image_info,
 static MagickBooleanType WritePS3MaskImage(const ImageInfo *image_info,
   Image *image,const CompressionType compression)
 {
+  ChannelType
+    channel_mask;
+
   char
     buffer[MaxTextExtent];
 
@@ -515,9 +518,9 @@ static MagickBooleanType WritePS3MaskImage(const ImageInfo *image_info,
   mask_image=CloneImage(image,0,0,MagickTrue,&image->exception);
   if (mask_image == (Image *) NULL)
     ThrowWriterException(CoderError,image->exception.reason);
-  PushPixelChannelMap(mask_image,AlphaChannel);
+  channel_mask=SetPixelChannelMask(mask_image,AlphaChannel);
   status=SeparateImage(mask_image);
-  PopPixelChannelMap(mask_image);
+  (void) SetPixelChannelMap(mask_image,channel_mask);
   if (status == MagickFalse)
     {
       mask_image=DestroyImage(mask_image);