]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/animate.c
(no commit message)
[imagemagick] / MagickCore / animate.c
index a76471308aaaf0d85221cea6ceb4e7769bfe74dc..03ce235ad1557654fa97eba185ddfade31c14e90 100644 (file)
@@ -17,7 +17,7 @@
 %                                July 1992                                    %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2012 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  %
 #include "MagickCore/studio.h"
 #include "MagickCore/animate.h"
 #include "MagickCore/animate-private.h"
+#include "MagickCore/attribute.h"
 #include "MagickCore/client.h"
 #include "MagickCore/color.h"
 #include "MagickCore/color-private.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/constitute.h"
 #include "MagickCore/delegate.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/string-private.h"
 #include "MagickCore/transform.h"
 #include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
 #include "MagickCore/version.h"
 #include "MagickCore/widget.h"
+#include "MagickCore/widget-private.h"
+#include "MagickCore/xwindow.h"
 #include "MagickCore/xwindow-private.h"
 \f
 #if defined(MAGICKCORE_X11_DELEGATE)
@@ -300,7 +305,7 @@ MagickExport MagickBooleanType AnimateImages(const ImageInfo *image_info,
   if (display == (Display *) NULL)
     {
       (void) ThrowMagickException(exception,GetMagickModule(),XServerError,
-        "UnableToOpenXServer","`%s'",XDisplayName(image_info->server_name));
+        "UnableToOpenXServer","'%s'",XDisplayName(image_info->server_name));
       return(MagickFalse);
     }
   if (exception->severity != UndefinedException)
@@ -314,10 +319,8 @@ MagickExport MagickBooleanType AnimateImages(const ImageInfo *image_info,
   resource_info.immutable=MagickTrue;
   argv[0]=AcquireString(GetClientName());
   (void) XAnimateImages(display,&resource_info,argv,1,images,exception);
-  SetErrorHandler((ErrorHandler) NULL);
-  SetWarningHandler((WarningHandler) NULL);
-  SetErrorHandler((ErrorHandler) NULL);
-  SetWarningHandler((WarningHandler) NULL);
+  (void) SetErrorHandler((ErrorHandler) NULL);
+  (void) SetWarningHandler((WarningHandler) NULL);
   argv[0]=DestroyString(argv[0]);
   (void) XCloseDisplay(display);
   XDestroyResourceInfo(&resource_info);
@@ -493,7 +496,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
             *title;
 
           title=InterpretImageProperties(resource_info->image_info,*image,
-            resource_info->title);
+            resource_info->title,exception);
           (void) CopyMagickString(windows->image.name,title,MaxTextExtent);
           title=DestroyString(title);
         }
@@ -540,8 +543,14 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       status=XSaveImage(display,resource_info,windows,*image,exception);
       if (status == MagickFalse)
         {
-          XNoticeWidget(display,windows,"Unable to write X image:",
-            (*image)->filename);
+          char
+            message[MaxTextExtent];
+
+          (void) FormatLocaleString(message,MaxTextExtent,"%s:%s",
+            exception->reason != (char *) NULL ? exception->reason : "",
+            exception->description != (char *) NULL ? exception->description :
+            "");
+          XNoticeWidget(display,windows,"Unable to save file:",message);
           break;
         }
       break;
@@ -572,7 +581,8 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
     }
     case InfoCommand:
     {
-      XDisplayImageInfo(display,resource_info,windows,(Image *) NULL,*image);
+      XDisplayImageInfo(display,resource_info,windows,(Image *) NULL,*image,
+        exception);
       break;
     }
     case HelpCommand:
@@ -873,20 +883,21 @@ MagickExport void XAnimateBackgroundImage(Display *display,
         */
         for (next=images; next != (Image *) NULL; )
         {
-          next->matte=MagickFalse;
+          next->alpha_trait=UndefinedPixelTrait;
           if ((next->storage_class == DirectClass) ||
               (next->colors != images->colors) ||
               (next->colors > (size_t) visual_info->colormap_size))
             break;
           for (i=0; i < (ssize_t) images->colors; i++)
-            if (IsPixelPacketEquivalent(next->colormap+i,images->colormap+i) == MagickFalse)
+            if (IsPixelInfoEquivalent(next->colormap+i,images->colormap+i) == MagickFalse)
               break;
           if (i < (ssize_t) images->colors)
             break;
           next=GetNextImageInList(next);
         }
         if (next != (Image *) NULL)
-          (void) RemapImages(resources.quantize_info,images,(Image *) NULL);
+          (void) RemapImages(resources.quantize_info,images,(Image *) NULL,
+            exception);
       }
   /*
     Sort images by increasing scene number.
@@ -911,18 +922,18 @@ MagickExport void XAnimateBackgroundImage(Display *display,
     if ((resource_info->map_type != (char *) NULL) ||
         (visual_info->klass == TrueColor) ||
         (visual_info->klass == DirectColor))
-      (void) SetImageType(image_list[scene],image_list[scene]->matte ==
-        MagickFalse ? TrueColorType : TrueColorMatteType);
+      (void) SetImageType(image_list[scene],image_list[scene]->alpha_trait ==
+        BlendPixelTrait ? TrueColorType : TrueColorMatteType,exception);
     if ((display_image->columns < image_list[scene]->columns) &&
         (display_image->rows < image_list[scene]->rows))
       display_image=image_list[scene];
   }
   if ((resource_info->map_type != (char *) NULL) ||
       (visual_info->klass == TrueColor) || (visual_info->klass == DirectColor))
-    (void) SetImageType(display_image,display_image->matte == MagickFalse ?
-      TrueColorType : TrueColorMatteType);
+    (void) SetImageType(display_image,display_image->alpha_trait !=
+      BlendPixelTrait ? TrueColorType : TrueColorMatteType,exception);
   XMakeStandardColormap(display,visual_info,&resources,display_image,map_info,
-    &pixel);
+    &pixel,exception);
   /*
     Graphic context superclass.
   */
@@ -1122,7 +1133,7 @@ MagickExport void XAnimateBackgroundImage(Display *display,
     (void) XClearWindow(display,window_info.id);
     window_info.pixmaps[scene]=window_info.pixmap;
     window_info.matte_pixmaps[scene]=window_info.matte_pixmap;
-    if (image_list[scene]->matte)
+    if (image_list[scene]->alpha_trait)
       (void) XClearWindow(display,window_info.id);
     delay=1000*image_list[scene]->delay/MagickMax(
       image_list[scene]->ticks_per_second,1L);
@@ -1494,13 +1505,13 @@ MagickExport Image *XAnimateImages(Display *display,
         */
         for (next=images; next != (Image *) NULL; )
         {
-          next->matte=MagickFalse;
+          next->alpha_trait=UndefinedPixelTrait;
           if ((next->storage_class == DirectClass) ||
               (next->colors != images->colors) ||
               (next->colors > (size_t) visual_info->colormap_size))
             break;
           for (i=0; i < (ssize_t) images->colors; i++)
-            if (IsPixelPacketEquivalent(next->colormap+i,images->colormap+i) == MagickFalse)
+            if (IsPixelInfoEquivalent(next->colormap+i,images->colormap+i) == MagickFalse)
               break;
           if (i < (ssize_t) images->colors)
             break;
@@ -1508,7 +1519,7 @@ MagickExport Image *XAnimateImages(Display *display,
         }
         if (next != (Image *) NULL)
           (void) RemapImages(resource_info->quantize_info,images,
-            (Image *) NULL);
+            (Image *) NULL,exception);
       }
   /*
     Sort images by increasing scene number.
@@ -1533,8 +1544,8 @@ MagickExport Image *XAnimateImages(Display *display,
     if ((resource_info->map_type != (char *) NULL) ||
         (visual_info->klass == TrueColor) ||
         (visual_info->klass == DirectColor))
-      (void) SetImageType(image_list[scene],image_list[scene]->matte ==
-        MagickFalse ? TrueColorType : TrueColorMatteType);
+      (void) SetImageType(image_list[scene],image_list[scene]->alpha_trait ==
+        BlendPixelTrait ? TrueColorType : TrueColorMatteType,exception);
     if ((display_image->columns < image_list[scene]->columns) &&
         (display_image->rows < image_list[scene]->rows))
       display_image=image_list[scene];
@@ -1552,7 +1563,7 @@ MagickExport Image *XAnimateImages(Display *display,
         display_image->magick);
     }
   XMakeStandardColormap(display,visual_info,resource_info,display_image,
-    map_info,pixel);
+    map_info,pixel,exception);
   /*
     Initialize graphic context.
   */
@@ -1648,7 +1659,7 @@ MagickExport Image *XAnimateImages(Display *display,
         *title;
 
       title=InterpretImageProperties(resource_info->image_info,display_image,
-        resource_info->title);
+        resource_info->title,exception);
       (void) CopyMagickString(windows->image.name,title,MaxTextExtent);
       (void) CopyMagickString(windows->image.icon_name,title,MaxTextExtent);
       title=DestroyString(title);
@@ -1919,7 +1930,6 @@ MagickExport Image *XAnimateImages(Display *display,
     /*
       Create X image.
     */
-    (void) TransformImageColorspace(image_list[scene],RGBColorspace);
     windows->image.pixmap=(Pixmap) NULL;
     windows->image.matte_pixmap=(Pixmap) NULL;
     if ((resource_info->map_type != (char *) NULL) ||
@@ -1959,7 +1969,7 @@ MagickExport Image *XAnimateImages(Display *display,
           *title;
 
         title=InterpretImageProperties(resource_info->image_info,
-          image_list[scene],resource_info->title);
+          image_list[scene],resource_info->title,exception);
         (void) CopyMagickString(windows->image.name,title,MaxTextExtent);
         title=DestroyString(title);
       }
@@ -2097,7 +2107,7 @@ MagickExport Image *XAnimateImages(Display *display,
                     *title;
 
                   title=InterpretImageProperties(resource_info->image_info,
-                    image,resource_info->title);
+                    image,resource_info->title,exception);
                   (void) CopyMagickString(windows->image.name,title,
                     MaxTextExtent);
                   title=DestroyString(title);
@@ -2625,7 +2635,7 @@ MagickExport Image *XAnimateImages(Display *display,
               Create an icon image.
             */
             XMakeStandardColormap(display,icon_visual,icon_resources,
-              display_image,icon_map,icon_pixel);
+              display_image,icon_map,icon_pixel,exception);
             (void) XMakeImage(display,icon_resources,&windows->icon,
               display_image,windows->icon.width,windows->icon.height,
               exception);
@@ -2733,7 +2743,7 @@ MagickExport Image *XAnimateImages(Display *display,
           {
             if (map_info->colormap == icon_map->colormap)
               XConfigureImageColormap(display,resource_info,windows,
-                display_image);
+                display_image,exception);
             (void) XFreeStandardColormap(display,icon_visual,icon_map,
               icon_pixel);
             windows->icon.mapped=MagickFalse;
@@ -3026,7 +3036,7 @@ MagickExport MagickBooleanType AnimateImages(const ImageInfo *image_info,
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
   (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
-    "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image->filename);
+    "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image->filename);
   return(MagickFalse);
 }
 #endif