]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/channel.c
The 8bim profile will be updated when the iptc profile is changed.
[imagemagick] / MagickCore / channel.c
index 61c1f0e92e4238ca8f5f889c75f7fb263beb7ba9..57cde8f3d0b3915aa75bce27d60ee9135156dfe9 100644 (file)
 %                      MagickCore Image Channel Methods                       %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                               December 2003                                 %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -42,6 +42,7 @@
 */
 #include "MagickCore/studio.h"
 #include "MagickCore/cache-private.h"
+#include "MagickCore/channel.h"
 #include "MagickCore/colorspace-private.h"
 #include "MagickCore/composite-private.h"
 #include "MagickCore/enhance.h"
@@ -253,27 +254,16 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
   channel_op=ExtractChannelOp;
   for (channels=0; *token != '\0'; )
   {
-    MagickBooleanType
-      delete_channel;
-
     ssize_t
       i;
 
     /*
       Interpret channel expression.
     */
-    delete_channel=MagickFalse;
     switch (*token)
     {
-      case '~':
-      {
-        delete_channel=MagickTrue;
-        GetMagickToken(p,&p,token);
-        break;
-      }
       case ',':
       {
-        destination_channel=(PixelChannel) ((ssize_t) destination_channel+1);
         GetMagickToken(p,&p,token);
         break;
       }
@@ -354,33 +344,6 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
         break;
       }
       case ExchangeChannelOp:
-      {
-        PixelChannelMap
-          channel_map;
-
-        i=ParsePixelChannelOption(token);
-        if (i < 0)
-          {
-            (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
-              "UnrecognizedChannelType","`%s'",token);
-            destination_image=DestroyImageList(destination_image);
-            return(destination_image);
-          }
-        destination_channel=(PixelChannel) i;
-        if ((source_channel >= GetPixelChannels(image)) ||
-            (destination_channel >= GetPixelChannels(image)))
-          {
-            (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
-              "NoSuchImageChannel","`%s'",token);
-            destination_image=DestroyImageList(destination_image);
-            return(destination_image);
-          }
-         channel_map=destination_image->channel_map[destination_channel];
-         destination_image->channel_map[destination_channel]=
-           destination_image->channel_map[source_channel];
-         destination_image->channel_map[source_channel]=channel_map;
-         break;
-      }
       case TransferChannelOp:
       {
         i=ParsePixelChannelOption(token);
@@ -456,12 +419,7 @@ MagickExport Image *ChannelFxImage(const Image *image,const char *expression,
     {
       case ExtractChannelOp:
       {
-        if (delete_channel == MagickFalse)
-          channel_mask=(ChannelType) (channel_mask |
-            (1 << destination_channel));
-        else
-          channel_mask=(ChannelType) (channel_mask &~
-            (1 << destination_channel));
+        channel_mask=(ChannelType) (channel_mask | (1 << destination_channel));
         destination_channel=(PixelChannel) (destination_channel+1);
         break;
       }
@@ -780,6 +738,7 @@ MagickExport Image *SeparateImage(const Image *image,
 
       if (GetPixelReadMask(image,p) == 0)
         {
+          SetPixelBackgoundColor(separate_image,q);
           p+=GetPixelChannels(image);
           q+=GetPixelChannels(separate_image);
           continue;