]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/display.c
Fix CLUT interpolation method
[imagemagick] / MagickCore / display.c
index 4f68122a1e34fbf42d62ff1a9c735451981f893e..e1cd6afab397db8dcb6e3bd348e77aa0729b7151 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  %
@@ -43,6 +43,7 @@
 #include "MagickCore/artifact.h"
 #include "MagickCore/blob.h"
 #include "MagickCore/cache.h"
+#include "MagickCore/cache-private.h"
 #include "MagickCore/client.h"
 #include "MagickCore/color.h"
 #include "MagickCore/colorspace.h"
@@ -52,6 +53,7 @@
 #include "MagickCore/delegate.h"
 #include "MagickCore/display.h"
 #include "MagickCore/display-private.h"
+#include "MagickCore/distort.h"
 #include "MagickCore/draw.h"
 #include "MagickCore/effect.h"
 #include "MagickCore/enhance.h"
@@ -80,6 +82,7 @@
 #include "MagickCore/resource_.h"
 #include "MagickCore/shear.h"
 #include "MagickCore/segment.h"
+#include "MagickCore/statistic.h"
 #include "MagickCore/string_.h"
 #include "MagickCore/string-private.h"
 #include "MagickCore/transform.h"
@@ -1605,13 +1608,13 @@ static void
   XDrawPanRectangle(Display *,XWindows *),
   XImageCache(Display *,XResourceInfo *,XWindows *,const CommandType,Image **,
     ExceptionInfo *),
-  XMagnifyImage(Display *,XWindows *,XEvent *),
+  XMagnifyImage(Display *,XWindows *,XEvent *,ExceptionInfo *),
   XMakePanImage(Display *,XResourceInfo *,XWindows *,Image *,ExceptionInfo *),
-  XPanImage(Display *,XWindows *,XEvent *),
+  XPanImage(Display *,XWindows *,XEvent *,ExceptionInfo *),
   XMagnifyWindowCommand(Display *,XWindows *,const MagickStatusType,
-    const KeySym),
+    const KeySym,ExceptionInfo *),
   XSetCropGeometry(Display *,XWindows *,RectangleInfo *,Image *),
-  XScreenEvent(Display *,XWindows *,XEvent *),
+  XScreenEvent(Display *,XWindows *,XEvent *,ExceptionInfo *),
   XTranslateImage(Display *,XWindows *,Image *,const KeySym);
 \f
 /*
@@ -1698,8 +1701,8 @@ MagickExport MagickBooleanType DisplayImages(const ImageInfo *image_info,
     image=GetImageFromList(images,i % GetImageListLength(images));
     (void) XDisplayImage(display,&resource_info,argv,1,&image,&state,exception);
   }
-  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);
@@ -1942,7 +1945,7 @@ static MagickBooleanType XAnnotateEditImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (event.xany.window == windows->command.id)
       {
         /*
@@ -2126,14 +2129,14 @@ static MagickBooleanType XAnnotateEditImage(Display *display,
               break;
             if (entry != 8)
               {
-                degrees=InterpretLocaleValue(RotateMenu[entry],(char **) NULL);
+                degrees=StringToDouble(RotateMenu[entry],(char **) NULL);
                 break;
               }
             (void) XDialogWidget(display,windows,"OK","Enter rotation angle:",
               angle);
             if (*angle == '\0')
               break;
-            degrees=InterpretLocaleValue(angle,(char **) NULL);
+            degrees=StringToDouble(angle,(char **) NULL);
             break;
           }
           case AnnotateHelpCommand:
@@ -2315,7 +2318,7 @@ static MagickBooleanType XAnnotateEditImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (event.xany.window == windows->command.id)
       {
         /*
@@ -2730,7 +2733,8 @@ static MagickBooleanType XAnnotateEditImage(Display *display,
     /*
       Annotate image with text.
     */
-    status=XAnnotateImage(display,windows->pixel_info,annotate_info,image);
+    status=XAnnotateImage(display,windows->pixel_info,annotate_info,image,
+      exception);
     if (status == 0)
       return(MagickFalse);
     /*
@@ -2751,7 +2755,7 @@ static MagickBooleanType XAnnotateEditImage(Display *display,
   /*
     Update image configuration.
   */
-  XConfigureImageColormap(display,resource_info,windows,image);
+  XConfigureImageColormap(display,resource_info,windows,image,exception);
   (void) XConfigureImage(display,resource_info,windows,image,exception);
   return(MagickTrue);
 }
@@ -2952,7 +2956,7 @@ static MagickBooleanType XChopImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (event.xany.window == windows->command.id)
       {
         /*
@@ -3130,7 +3134,7 @@ static MagickBooleanType XChopImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (distance > 9)
       XHighlightLine(display,windows->image.id,
         windows->image.highlight_context,&segment_info);
@@ -3247,7 +3251,7 @@ static MagickBooleanType XChopImage(Display *display,
   /*
     Update image configuration.
   */
-  XConfigureImageColormap(display,resource_info,windows,*image);
+  XConfigureImageColormap(display,resource_info,windows,*image,exception);
   (void) XConfigureImage(display,resource_info,windows,*image,exception);
   return(MagickTrue);
 }
@@ -3394,7 +3398,7 @@ static MagickBooleanType XColorEditImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (event.xany.window == windows->command.id)
       {
         /*
@@ -3541,7 +3545,7 @@ static MagickBooleanType XColorEditImage(Display *display,
               break;
             if (entry != 5)
               {
-                (*image)->fuzz=SiPrefixToDouble(FuzzMenu[entry],(double)
+                (*image)->fuzz=StringToDoubleInterval(FuzzMenu[entry],(double)
                   QuantumRange+1.0);
                 break;
               }
@@ -3551,7 +3555,8 @@ static MagickBooleanType XColorEditImage(Display *display,
             if (*fuzz == '\0')
               break;
             (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent);
-            (*image)->fuzz=SiPrefixToDouble(fuzz,(double) QuantumRange+1.0);
+            (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+
+              1.0);
             break;
           }
           case ColorEditUndoCommand:
@@ -3611,7 +3616,7 @@ static MagickBooleanType XColorEditImage(Display *display,
         */
         x=event.xbutton.x;
         y=event.xbutton.y;
-        XConfigureImageColormap(display,resource_info,windows,*image);
+        XConfigureImageColormap(display,resource_info,windows,*image,exception);
         (void) XConfigureImage(display,resource_info,windows,*image,exception);
         XInfoWidget(display,windows,text);
         (void) XCheckDefineCursor(display,windows->image.id,cursor);
@@ -3755,18 +3760,11 @@ static MagickBooleanType XColorEditImage(Display *display,
               pixel,
               target;
 
-            Quantum
-              virtual_pixel[MaxPixelChannels];
-
             /*
               Update color information using replace algorithm.
             */
-            (void) GetOneCacheViewVirtualPixel(image_view,(ssize_t) x_offset,
-              (ssize_t) y_offset,virtual_pixel,exception);
-            target.red=virtual_pixel[RedPixelChannel];
-            target.green=virtual_pixel[GreenPixelChannel];
-            target.blue=virtual_pixel[BluePixelChannel];
-            target.alpha=virtual_pixel[AlphaPixelChannel];
+            (void) GetOneCacheViewVirtualPixelInfo(image_view,(ssize_t)
+              x_offset,(ssize_t) y_offset,&target,exception);
             if ((*image)->storage_class == DirectClass)
               {
                 for (y=0; y < (int) (*image)->rows; y++)
@@ -3798,11 +3796,11 @@ static MagickBooleanType XColorEditImage(Display *display,
                 for (i=0; i < (ssize_t) (*image)->colors; i++)
                   if (IsFuzzyEquivalencePixelInfo((*image)->colormap+i,&target))
                     {
-                      (*image)->colormap[i].red=ScaleShortToQuantum(
+                      (*image)->colormap[i].red=(double) ScaleShortToQuantum(
                         color.red);
-                      (*image)->colormap[i].green=ScaleShortToQuantum(
+                      (*image)->colormap[i].green=(double) ScaleShortToQuantum(
                         color.green);
-                      (*image)->colormap[i].blue=ScaleShortToQuantum(
+                      (*image)->colormap[i].blue=(double) ScaleShortToQuantum(
                         color.blue);
                     }
                 (void) SyncImage(*image,exception);
@@ -3821,8 +3819,9 @@ static MagickBooleanType XColorEditImage(Display *display,
             /*
               Update color information using floodfill algorithm.
             */
-            (void) GetOneVirtualMagickPixel(*image,(ssize_t) x_offset,
-              (ssize_t) y_offset,&target,exception);
+            (void) GetOneVirtualPixelInfo(*image,
+              GetPixelCacheVirtualMethod(*image),(ssize_t) x_offset,(ssize_t)
+              y_offset,&target,exception);
             if (method == FillToBorderMethod)
               {
                 target.red=(MagickRealType)
@@ -4039,7 +4038,7 @@ static MagickBooleanType XCompositeImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     XHighlightRectangle(display,windows->image.id,
       windows->image.highlight_context,&highlight_info);
     if (event.xany.window == windows->command.id)
@@ -4088,7 +4087,7 @@ static MagickBooleanType XCompositeImage(Display *display,
               GXinvert);
             if (*factor == '\0')
               break;
-            blend=InterpretLocaleValue(factor,(char **) NULL);
+            blend=StringToDouble(factor,(char **) NULL);
             compose=DissolveCompositeOp;
             break;
           }
@@ -4298,8 +4297,7 @@ static MagickBooleanType XCompositeImage(Display *display,
         Scale composite image.
       */
       resize_image=ResizeImage(composite_image,composite_info.width,
-        composite_info.height,composite_image->filter,composite_image->blur,
-        exception);
+        composite_info.height,composite_image->filter,exception);
       composite_image=DestroyImage(composite_image);
       if (resize_image == (Image *) NULL)
         {
@@ -4357,14 +4355,14 @@ static MagickBooleanType XCompositeImage(Display *display,
   /*
     Composite image with X Image window.
   */
-  (void) CompositeImage(image,compose,composite_image,composite_info.x,
-    composite_info.y,exception);
+  (void) CompositeImage(image,composite_image,compose,MagickTrue,
+    composite_info.x,composite_info.y,exception);
   composite_image=DestroyImage(composite_image);
   XSetCursorState(display,windows,MagickFalse);
   /*
     Update image configuration.
   */
-  XConfigureImageColormap(display,resource_info,windows,image);
+  XConfigureImageColormap(display,resource_info,windows,image,exception);
   (void) XConfigureImage(display,resource_info,windows,image,exception);
   return(MagickTrue);
 }
@@ -4497,7 +4495,7 @@ static MagickBooleanType XConfigureImage(Display *display,
     Update Magnify window configuration.
   */
   if (windows->magnify.mapped != MagickFalse)
-    XMakeMagnifyImage(display,windows);
+    XMakeMagnifyImage(display,windows,exception);
   windows->pan.crop_geometry=windows->image.crop_geometry;
   XBestIconSize(display,&windows->pan,image);
   while (((windows->pan.width << 1) < MaxIconSize) &&
@@ -4706,7 +4704,7 @@ static MagickBooleanType XCropImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (event.xany.window == windows->command.id)
       {
         /*
@@ -4907,7 +4905,7 @@ static MagickBooleanType XCropImage(Display *display,
       /*
         Wait for next event.
       */
-      XScreenEvent(display,windows,&event);
+      XScreenEvent(display,windows,&event,exception);
       if ((highlight_info.width > 3) && (highlight_info.height > 3))
         XHighlightRectangle(display,windows->image.id,
           windows->image.highlight_context,&highlight_info);
@@ -5003,7 +5001,7 @@ static MagickBooleanType XCropImage(Display *display,
         }
       XHighlightRectangle(display,windows->image.id,
         windows->image.highlight_context,&highlight_info);
-      XScreenEvent(display,windows,&event);
+      XScreenEvent(display,windows,&event,exception);
       if (event.xany.window == windows->command.id)
         {
           /*
@@ -5377,7 +5375,7 @@ static MagickBooleanType XCropImage(Display *display,
   /*
     Update image configuration.
   */
-  XConfigureImageColormap(display,resource_info,windows,image);
+  XConfigureImageColormap(display,resource_info,windows,image,exception);
   (void) XConfigureImage(display,resource_info,windows,image,exception);
   return(MagickTrue);
 }
@@ -5554,7 +5552,7 @@ static MagickBooleanType XDrawEditImage(Display *display,
       /*
         Wait for next event.
       */
-      XScreenEvent(display,windows,&event);
+      XScreenEvent(display,windows,&event,exception);
       if (event.xany.window == windows->command.id)
         {
           /*
@@ -6056,7 +6054,7 @@ static MagickBooleanType XDrawEditImage(Display *display,
       /*
         Wait for next event.
       */
-      XScreenEvent(display,windows,&event);
+      XScreenEvent(display,windows,&event,exception);
       switch (element)
       {
         case PointElement:
@@ -6330,12 +6328,12 @@ static MagickBooleanType XDrawEditImage(Display *display,
     */
     XSetCursorState(display,windows,MagickTrue);
     XCheckRefreshWindows(display,windows);
-    status=XDrawImage(display,windows->pixel_info,&draw_info,*image);
+    status=XDrawImage(display,windows->pixel_info,&draw_info,*image,exception);
     XSetCursorState(display,windows,MagickFalse);
     /*
       Update image colormap and return to image drawing.
     */
-    XConfigureImageColormap(display,resource_info,windows,*image);
+    XConfigureImageColormap(display,resource_info,windows,*image,exception);
     (void) XConfigureImage(display,resource_info,windows,*image,exception);
   }
   XSetCursorState(display,windows,MagickFalse);
@@ -6496,7 +6494,7 @@ static void XImageCache(Display *display,XResourceInfo *resource_info,
       cache_image=DestroyImage(cache_image);
       if (windows->image.orphan != MagickFalse)
         return;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       return;
     }
@@ -6662,7 +6660,7 @@ static void XImageCache(Display *display,XResourceInfo *resource_info,
       redo_image=NewImageList();
       if (windows->image.orphan != MagickFalse)
         return;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       return;
     }
@@ -6673,7 +6671,7 @@ static void XImageCache(Display *display,XResourceInfo *resource_info,
   */
   XSetCursorState(display,windows,MagickTrue);
   XCheckRefreshWindows(display,windows);
-  XDisplayImageInfo(display,resource_info,windows,undo_image,*image);
+  XDisplayImageInfo(display,resource_info,windows,undo_image,*image,exception);
   XSetCursorState(display,windows,MagickFalse);
 }
 \f
@@ -7454,7 +7452,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
           windows->image.crop_geometry);
       windows->image.x=0;
       windows->image.y=0;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7485,7 +7483,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
           windows->image.x=0;
           windows->image.y=0;
         }
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7667,7 +7665,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
         break;
       windows->image.window_changes.width=(int) (*image)->columns;
       windows->image.window_changes.height=(int) (*image)->rows;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7708,7 +7706,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
         break;
       windows->image.window_changes.width=(int) (*image)->columns;
       windows->image.window_changes.height=(int) (*image)->rows;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7725,7 +7723,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       (void) XDialogWidget(display,windows,"Trim","Enter fuzz factor:",fuzz);
       if (*fuzz == '\0')
         break;
-      (*image)->fuzz=SiPrefixToDouble(fuzz,(double) QuantumRange+1.0);
+      (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+1.0);
       /*
         Trim image.
       */
@@ -7762,7 +7760,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7790,7 +7788,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7817,7 +7815,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7842,7 +7840,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7857,7 +7855,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7872,7 +7870,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7911,7 +7909,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7948,7 +7946,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7963,7 +7961,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7978,7 +7976,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -7993,7 +7991,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8009,7 +8007,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8043,7 +8041,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8073,7 +8071,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8097,7 +8095,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8135,7 +8133,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8171,7 +8169,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8211,7 +8209,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8237,7 +8235,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XCheckRefreshWindows(display,windows);
       flags=ParseGeometry(radius,&geometry_info);
       sharp_image=SharpenImage(*image,geometry_info.rho,geometry_info.sigma,
-        geometry_info.xi,exception);
+        exception);
       if (sharp_image != (Image *) NULL)
         {
           *image=DestroyImage(*image);
@@ -8247,7 +8245,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8273,7 +8271,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XCheckRefreshWindows(display,windows);
       flags=ParseGeometry(radius,&geometry_info);
       blur_image=BlurImage(*image,geometry_info.rho,geometry_info.sigma,
-        geometry_info.xi,exception);
+        exception);
       if (blur_image != (Image *) NULL)
         {
           *image=DestroyImage(*image);
@@ -8283,7 +8281,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8307,12 +8305,12 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       */
       XSetCursorState(display,windows,MagickTrue);
       XCheckRefreshWindows(display,windows);
-      threshold=SiPrefixToDouble(factor,QuantumRange);
+      threshold=StringToDoubleInterval(factor,(double) QuantumRange+1.0);
       (void) BilevelImage(*image,threshold,exception);
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8348,7 +8346,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8384,7 +8382,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8425,7 +8423,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8453,7 +8451,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8477,12 +8475,12 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       flags=ParseGeometry(threshold,&geometry_info);
       if ((flags & SigmaValue) == 0)
         geometry_info.sigma=1.0;
-      (void) SegmentImage(*image,RGBColorspace,MagickFalse,geometry_info.rho,
+      (void) SegmentImage(*image,sRGBColorspace,MagickFalse,geometry_info.rho,
         geometry_info.sigma,exception);
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8509,7 +8507,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       */
       XSetCursorState(display,windows,MagickTrue);
       XCheckRefreshWindows(display,windows);
-      threshold=SiPrefixToDouble(factor,QuantumRange);
+      threshold=StringToDoubleInterval(factor,(double) QuantumRange+1.0);
       sepia_image=SepiaToneImage(*image,threshold,exception);
       if (sepia_image != (Image *) NULL)
         {
@@ -8520,7 +8518,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8544,12 +8542,12 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       */
       XSetCursorState(display,windows,MagickTrue);
       XCheckRefreshWindows(display,windows);
-      threshold=SiPrefixToDouble(factor,QuantumRange);
+      threshold=StringToDoubleInterval(factor,(double) QuantumRange+1.0);
       (void) SolarizeImage(*image,threshold,exception);
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8585,7 +8583,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8621,7 +8619,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8652,9 +8650,9 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
         geometry_info.xi=0.1*(*image)->columns;
       if ((flags & PsiValue) == 0)
         geometry_info.psi=0.1*(*image)->rows;
-      vignette_image=VignetteImage(*image,geometry_info.rho,geometry_info.sigma,
-        (ssize_t) ceil(geometry_info.xi-0.5),(ssize_t) ceil(geometry_info.psi-
-        0.5),exception);
+      vignette_image=VignetteImage(*image,geometry_info.rho,0.0,(ssize_t)
+        ceil(geometry_info.xi-0.5),(ssize_t) ceil(geometry_info.psi-0.5),
+        exception);
       if (vignette_image != (Image *) NULL)
         {
           *image=DestroyImage(*image);
@@ -8664,7 +8662,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8702,7 +8700,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8738,7 +8736,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8768,7 +8766,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       if ((flags & SigmaValue) == 0)
         geometry_info.sigma=geometry_info.rho;
       charcoal_image=CharcoalImage(*image,geometry_info.rho,geometry_info.sigma,
-        geometry_info.xi,exception);
+        exception);
       if (charcoal_image != (Image *) NULL)
         {
           *image=DestroyImage(*image);
@@ -8778,7 +8776,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       XSetCursorState(display,windows,MagickFalse);
       if (windows->image.orphan != MagickFalse)
         break;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8895,7 +8893,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
         break;
       windows->image.window_changes.width=(int) (*image)->columns;
       windows->image.window_changes.height=(int) (*image)->rows;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -8951,7 +8949,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
         break;
       windows->image.window_changes.width=(int) (*image)->columns;
       windows->image.window_changes.height=(int) (*image)->rows;
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
       (void) XConfigureImage(display,resource_info,windows,*image,exception);
       break;
     }
@@ -9327,7 +9325,8 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
 %
 %  The format of the XMagnifyImage method is:
 %
-%      void XMagnifyImage(Display *display,XWindows *windows,XEvent *event)
+%      void XMagnifyImage(Display *display,XWindows *windows,XEvent *event,
+%        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -9339,8 +9338,11 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
 %    o event: Specifies a pointer to a XEvent structure.  If it is NULL,
 %      the entire image is refreshed.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
-static void XMagnifyImage(Display *display,XWindows *windows,XEvent *event)
+static void XMagnifyImage(Display *display,XWindows *windows,XEvent *event,
+  ExceptionInfo *exception)
 {
   char
     text[MaxTextExtent];
@@ -9388,7 +9390,7 @@ static void XMagnifyImage(Display *display,XWindows *windows,XEvent *event)
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,event);
+    XScreenEvent(display,windows,event,exception);
     switch (event->type)
     {
       case ButtonPress:
@@ -9451,7 +9453,8 @@ static void XMagnifyImage(Display *display,XWindows *windows,XEvent *event)
 %  The format of the XMagnifyWindowCommand method is:
 %
 %      void XMagnifyWindowCommand(Display *display,XWindows *windows,
-%        const MagickStatusType state,const KeySym key_symbol)
+%        const MagickStatusType state,const KeySym key_symbol,
+%        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -9465,9 +9468,11 @@ static void XMagnifyImage(Display *display,XWindows *windows,XEvent *event)
 %    o key_symbol: Specifies a KeySym which indicates which side of the image
 %      to trim.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
 static void XMagnifyWindowCommand(Display *display,XWindows *windows,
-  const MagickStatusType state,const KeySym key_symbol)
+  const MagickStatusType state,const KeySym key_symbol,ExceptionInfo *exception)
 {
   unsigned int
     quantum;
@@ -9552,7 +9557,7 @@ static void XMagnifyWindowCommand(Display *display,XWindows *windows,
     default:
       break;
   }
-  XMakeMagnifyImage(display,windows);
+  XMakeMagnifyImage(display,windows,exception);
 }
 \f
 /*
@@ -9753,7 +9758,7 @@ static MagickBooleanType XMatteEditImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (event.xany.window == windows->command.id)
       {
         /*
@@ -9854,7 +9859,7 @@ static MagickBooleanType XMatteEditImage(Display *display,
               break;
             if (entry != 5)
               {
-                (*image)->fuzz=SiPrefixToDouble(FuzzMenu[entry],(double)
+                (*image)->fuzz=StringToDoubleInterval(FuzzMenu[entry],(double)
                   QuantumRange+1.0);
                 break;
               }
@@ -9864,7 +9869,8 @@ static MagickBooleanType XMatteEditImage(Display *display,
             if (*fuzz == '\0')
               break;
             (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent);
-            (*image)->fuzz=SiPrefixToDouble(fuzz,(double) QuantumRange+1.0);
+            (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+
+              1.0);
             break;
           }
           case MatteEditValueCommand:
@@ -9963,7 +9969,7 @@ static MagickBooleanType XMatteEditImage(Display *display,
         */
         x=event.xbutton.x;
         y=event.xbutton.y;
-        XConfigureImageColormap(display,resource_info,windows,*image);
+        XConfigureImageColormap(display,resource_info,windows,*image,exception);
         (void) XConfigureImage(display,resource_info,windows,*image,exception);
         XInfoWidget(display,windows,text);
         (void) XCheckDefineCursor(display,windows->image.id,cursor);
@@ -10085,7 +10091,8 @@ static MagickBooleanType XMatteEditImage(Display *display,
           continue;
         if (SetImageStorageClass(*image,DirectClass,exception) == MagickFalse)
           return(MagickFalse);
-        (*image)->matte=MagickTrue;
+        if ((*image)->matte == MagickFalse)
+          (void) SetImageAlphaChannel(*image,OpaqueAlphaChannel,exception);
         image_view=AcquireCacheView(*image);
         switch (method)
         {
@@ -10109,18 +10116,11 @@ static MagickBooleanType XMatteEditImage(Display *display,
               pixel,
               target;
 
-            Quantum
-              virtual_pixel[MaxPixelChannels];
-
             /*
               Update matte information using replace algorithm.
             */
-            (void) GetOneCacheViewVirtualPixel(image_view,(ssize_t) x_offset,
-              (ssize_t) y_offset,virtual_pixel,exception);
-            target.red=virtual_pixel[RedPixelChannel];
-            target.green=virtual_pixel[GreenPixelChannel];
-            target.blue=virtual_pixel[BluePixelChannel];
-            target.alpha=virtual_pixel[AlphaPixelChannel];
+            (void) GetOneCacheViewVirtualPixelInfo(image_view,(ssize_t)
+              x_offset,(ssize_t) y_offset,&target,exception);
             for (y=0; y < (int) (*image)->rows; y++)
             {
               q=GetCacheViewAuthenticPixels(image_view,0,(ssize_t) y,
@@ -10154,8 +10154,9 @@ static MagickBooleanType XMatteEditImage(Display *display,
             /*
               Update matte information using floodfill algorithm.
             */
-            (void) GetOneVirtualMagickPixel(*image,(ssize_t) x_offset,
-              (ssize_t) y_offset,&target,exception);
+            (void) GetOneVirtualPixelInfo(*image,
+              GetPixelCacheVirtualMethod(*image),(ssize_t) x_offset,(ssize_t)
+              y_offset,&target,exception);
             if (method == FillToBorderMethod)
               {
                 target.red=(MagickRealType) ScaleShortToQuantum(
@@ -10167,13 +10168,13 @@ static MagickBooleanType XMatteEditImage(Display *display,
               }
             draw_info=CloneDrawInfo(resource_info->image_info,
               (DrawInfo *) NULL);
-            draw_info->fill.alpha=ClampToQuantum(InterpretLocaleValue(matte,
-              (char **) NULL));
+            draw_info->fill.alpha=(MagickRealType) ClampToQuantum(
+              StringToDouble(matte,(char **) NULL));
             channel_mask=SetPixelChannelMask(*image,AlphaChannel); 
             (void) FloodfillPaintImage(*image,draw_info,&target,(ssize_t)
               x_offset,(ssize_t) y_offset,method == FloodfillMethod ?
               MagickFalse : MagickTrue,exception);
-            (void) SetPixelChannelMap(*image,channel_mask);
+            (void) SetPixelChannelMapMask(*image,channel_mask);
             draw_info=DestroyDrawInfo(draw_info);
             break;
           }
@@ -10412,7 +10413,8 @@ static Image *XOpenImage(Display *display,XResourceInfo *resource_info,
 %
 %  The format of the XPanImage method is:
 %
-%      void XPanImage(Display *display,XWindows *windows,XEvent *event)
+%      void XPanImage(Display *display,XWindows *windows,XEvent *event,
+%        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -10424,8 +10426,11 @@ static Image *XOpenImage(Display *display,XResourceInfo *resource_info,
 %    o event: Specifies a pointer to a XEvent structure.  If it is NULL,
 %      the entire image is refreshed.
 %
+%    o exception: return any errors or warnings in this structure.
+%
 */
-static void XPanImage(Display *display,XWindows *windows,XEvent *event)
+static void XPanImage(Display *display,XWindows *windows,XEvent *event,
+  ExceptionInfo *exception)
 {
   char
     text[MaxTextExtent];
@@ -10554,7 +10559,7 @@ static void XPanImage(Display *display,XWindows *windows,XEvent *event)
       Wait for next event.
     */
     if ((state & ExitState) == 0)
-      XScreenEvent(display,windows,event);
+      XScreenEvent(display,windows,event,exception);
   } while ((state & ExitState) == 0);
   /*
     Restore cursor.
@@ -10702,7 +10707,7 @@ static MagickBooleanType XPasteImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     XHighlightRectangle(display,windows->image.id,
       windows->image.highlight_context,&highlight_info);
     if (event.xany.window == windows->command.id)
@@ -10923,14 +10928,14 @@ static MagickBooleanType XPasteImage(Display *display,
   /*
     Paste image with X Image window.
   */
-  (void) CompositeImage(image,compose,paste_image,paste_info.x,paste_info.y,
-    exception);
+  (void) CompositeImage(image,paste_image,compose,MagickTrue,paste_info.x,
+    paste_info.y,exception);
   paste_image=DestroyImage(paste_image);
   XSetCursorState(display,windows,MagickFalse);
   /*
     Update image colormap.
   */
-  XConfigureImageColormap(display,resource_info,windows,image);
+  XConfigureImageColormap(display,resource_info,windows,image,exception);
   (void) XConfigureImage(display,resource_info,windows,image,exception);
   return(MagickTrue);
 }
@@ -11343,7 +11348,7 @@ static MagickBooleanType XROIImage(Display *display,
     /*
       Wait for next event.
     */
-    XScreenEvent(display,windows,&event);
+    XScreenEvent(display,windows,&event,exception);
     if (event.xany.window == windows->command.id)
       {
         /*
@@ -11507,7 +11512,7 @@ static MagickBooleanType XROIImage(Display *display,
       /*
         Wait for next event.
       */
-      XScreenEvent(display,windows,&event);
+      XScreenEvent(display,windows,&event,exception);
       if ((highlight_info.width > 3) && (highlight_info.height > 3))
         XHighlightRectangle(display,windows->image.id,
           windows->image.highlight_context,&highlight_info);
@@ -11657,8 +11662,8 @@ static MagickBooleanType XROIImage(Display *display,
               (void) XMagickCommand(display,resource_info,windows,
                 SaveToUndoBufferCommand,image,exception);
               windows->image.orphan=MagickFalse;
-              (void) CompositeImage(*image,CopyCompositeOp,roi_image,
-                crop_info.x,crop_info.y,exception);
+              (void) CompositeImage(*image,roi_image,CopyCompositeOp,
+                MagickTrue,crop_info.x,crop_info.y,exception);
               roi_image=DestroyImage(roi_image);
               (void) SetImageProgressMonitor(*image,progress_monitor,
                 (*image)->client_data);
@@ -11667,8 +11672,10 @@ static MagickBooleanType XROIImage(Display *display,
           }
           if (command_type != InfoCommand)
             {
-              XConfigureImageColormap(display,resource_info,windows,*image);
-              (void) XConfigureImage(display,resource_info,windows,*image,exception);
+              XConfigureImageColormap(display,resource_info,windows,*image,
+                exception);
+              (void) XConfigureImage(display,resource_info,windows,*image,
+                exception);
             }
           XCheckRefreshWindows(display,windows);
           XInfoWidget(display,windows,text);
@@ -11678,7 +11685,7 @@ static MagickBooleanType XROIImage(Display *display,
         }
       XHighlightRectangle(display,windows->image.id,
         windows->image.highlight_context,&highlight_info);
-      XScreenEvent(display,windows,&event);
+      XScreenEvent(display,windows,&event,exception);
       if (event.xany.window == windows->command.id)
         {
           /*
@@ -12102,7 +12109,7 @@ static MagickBooleanType XRotateImage(Display *display,
         /*
           Wait for next event.
         */
-        XScreenEvent(display,windows,&event);
+        XScreenEvent(display,windows,&event,exception);
         XHighlightLine(display,windows->image.id,
           windows->image.highlight_context,&rotate_info);
         if (event.xany.window == windows->command.id)
@@ -12320,7 +12327,7 @@ static MagickBooleanType XRotateImage(Display *display,
         /*
           Wait for next event.
         */
-        XScreenEvent(display,windows,&event);
+        XScreenEvent(display,windows,&event,exception);
         if (distance > 9)
           XHighlightLine(display,windows->image.id,
             windows->image.highlight_context,&rotate_info);
@@ -12394,11 +12401,11 @@ static MagickBooleanType XRotateImage(Display *display,
       exception);
   XSetCursorState(display,windows,MagickTrue);
   XCheckRefreshWindows(display,windows);
-  (*image)->background_color.red=ScaleShortToQuantum(
+  (*image)->background_color.red=(double) ScaleShortToQuantum(
     windows->pixel_info->pen_colors[pen_id].red);
-  (*image)->background_color.green=ScaleShortToQuantum(
+  (*image)->background_color.green=(double) ScaleShortToQuantum(
     windows->pixel_info->pen_colors[pen_id].green);
-  (*image)->background_color.blue=ScaleShortToQuantum(
+  (*image)->background_color.blue=(double) ScaleShortToQuantum(
     windows->pixel_info->pen_colors[pen_id].blue);
   rotate_image=RotateImage(*image,degrees,exception);
   XSetCursorState(display,windows,MagickFalse);
@@ -12468,7 +12475,7 @@ static MagickBooleanType XRotateImage(Display *display,
           windows->image.window_changes.width=(int) width;
           windows->image.window_changes.height=(int) height;
         }
-      XConfigureImageColormap(display,resource_info,windows,*image);
+      XConfigureImageColormap(display,resource_info,windows,*image,exception);
     }
   else
     if (((rotations % 4) == 1) || ((rotations % 4) == 3))
@@ -12658,7 +12665,8 @@ static MagickBooleanType XSaveImage(Display *display,
 %
 %  The format of the XScreenEvent function is:
 %
-%      void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
+%      void XScreenEvent(Display *display,XWindows *windows,XEvent *event,
+%        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -12669,6 +12677,7 @@ static MagickBooleanType XSaveImage(Display *display,
 %
 %    o event: Specifies a pointer to a X11 XEvent structure.
 %
+%    o exception: return any errors or warnings in this structure.
 %
 */
 
@@ -12692,7 +12701,8 @@ static int XPredicate(Display *magick_unused(display),XEvent *event,char *data)
 }
 #endif
 
-static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
+static void XScreenEvent(Display *display,XWindows *windows,XEvent *event,
+  ExceptionInfo *exception)
 {
   register int
     x,
@@ -12723,7 +12733,7 @@ static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
         }
       if (event->xbutton.window == windows->pan.id)
         {
-          XPanImage(display,windows,event);
+          XPanImage(display,windows,event,exception);
           break;
         }
       if (event->xbutton.window == windows->image.id)
@@ -12748,7 +12758,7 @@ static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
             windows->magnify.y=windows->image.y+y;
             if (windows->magnify.mapped == MagickFalse)
               (void) XMapRaised(display,windows->magnify.id);
-            XMakeMagnifyImage(display,windows);
+            XMakeMagnifyImage(display,windows,exception);
             if (event->type == ButtonRelease)
               (void) XWithdrawWindow(display,windows->info.id,
                 windows->info.screen);
@@ -12806,7 +12816,7 @@ static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
                 &window_changes);
               break;
             }
-          XMakeMagnifyImage(display,windows);
+          XMakeMagnifyImage(display,windows,exception);
           break;
         }
       break;
@@ -12827,7 +12837,7 @@ static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
       if (event->xexpose.window == windows->magnify.id)
         if (event->xexpose.count == 0)
           {
-            XMakeMagnifyImage(display,windows);
+            XMakeMagnifyImage(display,windows,exception);
             break;
           }
       break;
@@ -12847,7 +12857,8 @@ static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
       */
       (void) XLookupString((XKeyEvent *) &event->xkey,command,(int)
         sizeof(command),&key_symbol,(XComposeStatus *) NULL);
-      XMagnifyWindowCommand(display,windows,event->xkey.state,key_symbol);
+      XMagnifyWindowCommand(display,windows,event->xkey.state,key_symbol,
+        exception);
       break;
     }
     case MapNotify:
@@ -12888,7 +12899,7 @@ static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
              if (y >= (int) windows->image.height)
                y=(int) (windows->image.height-1);
             windows->magnify.y=windows->image.y+y;
-            XMakeMagnifyImage(display,windows);
+            XMakeMagnifyImage(display,windows,exception);
           }
       break;
     }
@@ -13223,9 +13234,6 @@ static Image *XTileImage(Display *display,XResourceInfo *resource_info,
       PixelInfo
         pixel;
 
-      Quantum
-        virtual_pixel[MaxPixelChannels];
-
       register int
         j;
 
@@ -13258,12 +13266,7 @@ static Image *XTileImage(Display *display,XResourceInfo *resource_info,
         x_offset=(int) (width*(tile % (((int) image->columns-x)/width))+x);
         y_offset=(int) (height*(tile/(((int) image->columns-x)/width))+y);
         image_view=AcquireCacheView(image);
-        (void) GetOneCacheViewVirtualPixel(image_view,0,0,virtual_pixel,
-          exception);
-        pixel.red=virtual_pixel[RedPixelChannel];
-        pixel.green=virtual_pixel[GreenPixelChannel];
-        pixel.blue=virtual_pixel[BluePixelChannel];
-        pixel.alpha=virtual_pixel[AlphaPixelChannel];
+        (void) GetOneCacheViewVirtualPixelInfo(image_view,0,0,&pixel,exception);
         for (i=0; i < (int) height; i++)
         {
           s=GetCacheViewAuthenticPixels(image_view,(ssize_t) x_offset,(ssize_t)
@@ -13272,7 +13275,7 @@ static Image *XTileImage(Display *display,XResourceInfo *resource_info,
             break;
           for (j=0; j < (int) width; j++)
           {
-            SetPixelPixelInfo(image,&pixel,s);
+            SetPixelInfoPixel(image,&pixel,s);
             s+=GetPixelChannels(image);
           }
           if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
@@ -13283,7 +13286,7 @@ static Image *XTileImage(Display *display,XResourceInfo *resource_info,
       }
       windows->image.window_changes.width=(int) image->columns;
       windows->image.window_changes.height=(int) image->rows;
-      XConfigureImageColormap(display,resource_info,windows,image);
+      XConfigureImageColormap(display,resource_info,windows,image,exception);
       (void) XConfigureImage(display,resource_info,windows,image,exception);
       break;
     }
@@ -13890,7 +13893,8 @@ MagickExport MagickBooleanType XDisplayBackgroundImage(Display *display,
     Initialize Standard Colormap.
   */
   resources.colormap=SharedColormap;
-  XMakeStandardColormap(display,visual_info,&resources,image,map_info,&pixel);
+  XMakeStandardColormap(display,visual_info,&resources,image,map_info,&pixel,
+    exception);
   /*
     Graphic context superclass.
   */
@@ -14600,7 +14604,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
         display_image->magick);
     }
   XMakeStandardColormap(display,visual_info,resource_info,display_image,
-    map_info,pixel);
+    map_info,pixel,exception);
   display_image->taint=MagickFalse;
   /*
     Initialize graphic context.
@@ -15101,8 +15105,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
                           resource_info->image_info->filename,MaxTextExtent,
                           "%s:%s",display_image->magick,
                           display_image->filename);
-                        nexus=ReadImage(resource_info->image_info,
-                          &display_image->exception);
+                        nexus=ReadImage(resource_info->image_info,exception);
                         if (nexus != (Image *) NULL)
                           {
                             nexus=DestroyImage(nexus);
@@ -15220,7 +15223,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
                 */
                 (void) XMagickCommand(display,resource_info,windows,ZoomCommand,
                   &display_image,exception);
-                XMagnifyImage(display,windows,&event);
+                XMagnifyImage(display,windows,&event,exception);
                 break;
               }
               case Button3:
@@ -15318,7 +15321,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
             */
             factor=XMenuWidget(display,windows,"Magnify",MagnifyMenu,command);
             if (factor >= 0)
-              XMagnifyWindowCommand(display,windows,0,MagnifyCommands[factor]);
+              XMagnifyWindowCommand(display,windows,0,MagnifyCommands[factor],
+                exception);
             break;
           }
         if (event.xbutton.window == windows->pan.id)
@@ -15343,7 +15347,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
               }
               default:
               {
-                XPanImage(display,windows,&event);
+                XPanImage(display,windows,&event,exception);
                 break;
               }
             }
@@ -15492,9 +15496,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
                 (void) CopyMagickString(resource_info->image_info->filename,
                   ((char *) data)+5,MaxTextExtent);
               }
-            nexus=ReadImage(resource_info->image_info,
-              &display_image->exception);
-            CatchException(&display_image->exception);
+            nexus=ReadImage(resource_info->image_info,exception);
+            CatchException(exception);
             if (nexus != (Image *) NULL)
               *state|=NextImageState | ExitState;
             (void) XFree((void *) data);
@@ -15673,7 +15676,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
                 status=XMakeImage(display,resource_info,&windows->magnify,
                   display_image,windows->magnify.width,windows->magnify.height,
                   exception);
-                XMakeMagnifyImage(display,windows);
+                XMakeMagnifyImage(display,windows,exception);
               }
             break;
           }
@@ -15750,7 +15753,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
         if ((event.xexpose.window == windows->magnify.id) &&
             (windows->magnify.mapped != MagickFalse))
           {
-            XMakeMagnifyImage(display,windows);
+            XMakeMagnifyImage(display,windows,exception);
             break;
           }
         if (event.xexpose.window == windows->pan.id)
@@ -15789,7 +15792,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
                 &display_image,exception);
           }
         if (event.xkey.window == windows->magnify.id)
-          XMagnifyWindowCommand(display,windows,event.xkey.state,key_symbol);
+          XMagnifyWindowCommand(display,windows,event.xkey.state,key_symbol,
+            exception);
         if (event.xkey.window == windows->pan.id)
           {
             if ((key_symbol == XK_q) || (key_symbol == XK_Escape))
@@ -15858,7 +15862,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
           }
         if (event.xmap.window == windows->magnify.id)
           {
-            XMakeMagnifyImage(display,windows);
+            XMakeMagnifyImage(display,windows,exception);
             windows->magnify.mapped=MagickTrue;
             (void) XWithdrawWindow(display,windows->info.id,
               windows->info.screen);
@@ -15886,7 +15890,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
             */
             taint=display_image->taint;
             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);
@@ -15963,8 +15967,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
         (void) CopyMagickString(resource_info->image_info->filename,
           (char *) data,MaxTextExtent);
         (void) XFree((void *) data);
-        nexus=ReadImage(resource_info->image_info,&display_image->exception);
-        CatchException(&display_image->exception);
+        nexus=ReadImage(resource_info->image_info,exception);
+        CatchException(exception);
         if (nexus != (Image *) NULL)
           *state|=NextImageState | ExitState;
         break;
@@ -16011,7 +16015,7 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
           {
             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;
@@ -16143,8 +16147,8 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
 
     status=chdir(resource_info->home_directory);
     if (status == -1)
-      (void) ThrowMagickException(&display_image->exception,GetMagickModule(),
-        FileOpenError,"UnableToOpenFile","%s",resource_info->home_directory);
+      (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
+        "UnableToOpenFile","%s",resource_info->home_directory);
   }
   *image=display_image;
   return(nexus);