#include "MagickCore/transform.h"
#include "MagickCore/threshold.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)
*/
static CommandType
XImageWindowCommand(Display *,XResourceInfo *,XWindows *,
- const MagickStatusType,KeySym,Image **);
+ const MagickStatusType,KeySym,Image **,ExceptionInfo *);
static Image
*XMagickCommand(Display *,XResourceInfo *,XWindows *,const CommandType,
- Image **),
+ Image **,ExceptionInfo *),
*XOpenImage(Display *,XResourceInfo *,XWindows *,const MagickBooleanType),
- *XTileImage(Display *,XResourceInfo *,XWindows *,Image *,XEvent *),
- *XVisualDirectoryImage(Display *,XResourceInfo *,XWindows *);
+ *XTileImage(Display *,XResourceInfo *,XWindows *,Image *,XEvent *,
+ ExceptionInfo *),
+ *XVisualDirectoryImage(Display *,XResourceInfo *,XWindows *,
+ ExceptionInfo *);
static MagickBooleanType
- XAnnotateEditImage(Display *,XResourceInfo *,XWindows *,Image *),
- XDrawEditImage(Display *,XResourceInfo *,XWindows *,Image **),
- XChopImage(Display *,XResourceInfo *,XWindows *,Image **),
- XCropImage(Display *,XResourceInfo *,XWindows *,Image *,const ClipboardMode),
- XBackgroundImage(Display *,XResourceInfo *,XWindows *,Image **),
- XColorEditImage(Display *,XResourceInfo *,XWindows *,Image **),
- XCompositeImage(Display *,XResourceInfo *,XWindows *,Image *),
- XConfigureImage(Display *,XResourceInfo *,XWindows *,Image *),
- XMatteEditImage(Display *,XResourceInfo *,XWindows *,Image **),
- XPasteImage(Display *,XResourceInfo *,XWindows *,Image *),
- XPrintImage(Display *,XResourceInfo *,XWindows *,Image *),
- XRotateImage(Display *,XResourceInfo *,XWindows *,double,Image **),
- XROIImage(Display *,XResourceInfo *,XWindows *,Image **),
- XSaveImage(Display *,XResourceInfo *,XWindows *,Image *),
- XTrimImage(Display *,XResourceInfo *,XWindows *,Image *);
+ XAnnotateEditImage(Display *,XResourceInfo *,XWindows *,Image *,
+ ExceptionInfo *),
+ XBackgroundImage(Display *,XResourceInfo *,XWindows *,Image **,
+ ExceptionInfo *),
+ XChopImage(Display *,XResourceInfo *,XWindows *,Image **,
+ ExceptionInfo *),
+ XCropImage(Display *,XResourceInfo *,XWindows *,Image *,const ClipboardMode,
+ ExceptionInfo *),
+ XColorEditImage(Display *,XResourceInfo *,XWindows *,Image **,
+ ExceptionInfo *),
+ XCompositeImage(Display *,XResourceInfo *,XWindows *,Image *,
+ ExceptionInfo *),
+ XConfigureImage(Display *,XResourceInfo *,XWindows *,Image *,ExceptionInfo *),
+ XDrawEditImage(Display *,XResourceInfo *,XWindows *,Image **,
+ ExceptionInfo *),
+ XMatteEditImage(Display *,XResourceInfo *,XWindows *,Image **,
+ ExceptionInfo *),
+ XPasteImage(Display *,XResourceInfo *,XWindows *,Image *,ExceptionInfo *),
+ XPrintImage(Display *,XResourceInfo *,XWindows *,Image *,ExceptionInfo *),
+ XRotateImage(Display *,XResourceInfo *,XWindows *,double,Image **,
+ ExceptionInfo *),
+ XROIImage(Display *,XResourceInfo *,XWindows *,Image **,ExceptionInfo *),
+ XSaveImage(Display *,XResourceInfo *,XWindows *,Image *,ExceptionInfo *),
+ XTrimImage(Display *,XResourceInfo *,XWindows *,Image *,ExceptionInfo *);
static void
XDrawPanRectangle(Display *,XWindows *),
- XImageCache(Display *,XResourceInfo *,XWindows *,const CommandType,Image **),
+ XImageCache(Display *,XResourceInfo *,XWindows *,const CommandType,Image **,
+ ExceptionInfo *),
XMagnifyImage(Display *,XWindows *,XEvent *),
- XMakePanImage(Display *,XResourceInfo *,XWindows *,Image *),
+ XMakePanImage(Display *,XResourceInfo *,XWindows *,Image *,ExceptionInfo *),
XPanImage(Display *,XWindows *,XEvent *),
XMagnifyWindowCommand(Display *,XWindows *,const MagickStatusType,
const KeySym),
% The format of the DisplayImages method is:
%
% MagickBooleanType DisplayImages(const ImageInfo *image_info,
-% Image *images)
+% Image *images,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
MagickExport MagickBooleanType DisplayImages(const ImageInfo *image_info,
- Image *images)
+ Image *images,ExceptionInfo *exception)
{
char
*argv[1];
display=XOpenDisplay(image_info->server_name);
if (display == (Display *) NULL)
{
- (void) ThrowMagickException(&images->exception,GetMagickModule(),
- XServerError,"UnableToOpenXServer","`%s'",XDisplayName(
- image_info->server_name));
+ (void) ThrowMagickException(exception,GetMagickModule(),XServerError,
+ "UnableToOpenXServer","`%s'",XDisplayName(image_info->server_name));
return(MagickFalse);
}
- if (images->exception.severity != UndefinedException)
- CatchException(&images->exception);
+ if (exception->severity != UndefinedException)
+ CatchException(exception);
(void) XSetErrorHandler(XError);
resource_database=XGetResourceDatabase(display,GetClientName());
(void) ResetMagickMemory(&resource_info,0,sizeof(resource_info));
if ((images->iterations != 0) && (i >= (ssize_t) images->iterations))
break;
image=GetImageFromList(images,i % GetImageListLength(images));
- (void) XDisplayImage(display,&resource_info,argv,1,&image,&state);
+ (void) XDisplayImage(display,&resource_info,argv,1,&image,&state,exception);
}
+ SetErrorHandler((ErrorHandler) NULL);
+ SetWarningHandler((WarningHandler) NULL);
argv[0]=DestroyString(argv[0]);
(void) XCloseDisplay(display);
XDestroyResourceInfo(&resource_info);
- if (images->exception.severity != UndefinedException)
+ if (exception->severity != UndefinedException)
return(MagickFalse);
return(MagickTrue);
}
% The format of the XAnnotateEditImage method is:
%
% MagickBooleanType XAnnotateEditImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
}
static MagickBooleanType XAnnotateEditImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
static const char
*AnnotateMenu[] =
Update image configuration.
*/
XConfigureImageColormap(display,resource_info,windows,image);
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
return(MagickTrue);
}
\f
% The format of the XBackgroundImage method is:
%
% MagickBooleanType XBackgroundImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image **image)
+% XResourceInfo *resource_info,XWindows *windows,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XBackgroundImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image **image)
+ XResourceInfo *resource_info,XWindows *windows,Image **image,
+ ExceptionInfo *exception)
{
#define BackgroundImageTag "Background/Image"
"Enter window id (id 0x00 selects window with pointer):",window_id);
if (*window_id == '\0')
return(MagickFalse);
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XInfoWidget(display,windows,BackgroundImageTag);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
background_resources=(*resource_info);
background_resources.window_id=window_id;
background_resources.backdrop=status != 0 ? MagickTrue : MagickFalse;
- status=XDisplayBackgroundImage(display,&background_resources,*image);
+ status=XDisplayBackgroundImage(display,&background_resources,*image,
+ exception);
if (status != MagickFalse)
XClientMessage(display,windows->image.id,windows->im_protocols,
windows->im_retain_colors,CurrentTime);
XSetCursorState(display,windows,MagickFalse);
- (void) XMagickCommand(display,resource_info,windows,UndoCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,UndoCommand,image,
+ exception);
return(MagickTrue);
}
\f
% The format of the XChopImage method is:
%
% MagickBooleanType XChopImage(Display *display,XResourceInfo *resource_info,
-% XWindows *windows,Image **image)
+% XWindows *windows,Image **image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XChopImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image **image)
+ XResourceInfo *resource_info,XWindows *windows,Image **image,
+ ExceptionInfo *exception)
{
static const char
*ChopMenu[] =
/*
Image chopping is relative to image configuration.
*/
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
windows->image.window_changes.width=windows->image.ximage->width-
/*
Chop image.
*/
- chop_image=ChopImage(*image,&chop_info,&(*image)->exception);
+ chop_image=ChopImage(*image,&chop_info,exception);
XSetCursorState(display,windows,MagickFalse);
if (chop_image == (Image *) NULL)
return(MagickFalse);
Update image configuration.
*/
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
return(MagickTrue);
}
\f
% The format of the XColorEditImage method is:
%
% MagickBooleanType XColorEditImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image **image)
+% XResourceInfo *resource_info,XWindows *windows,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image; returned from ReadImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-
-
static MagickBooleanType XColorEditImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image **image)
+ XResourceInfo *resource_info,XWindows *windows,Image **image,
+ ExceptionInfo *exception)
{
static const char
*ColorEditMenu[] =
Cursor
cursor;
- ExceptionInfo
- *exception;
-
int
entry,
id,
case ColorEditUndoCommand:
{
(void) XMagickCommand(display,resource_info,windows,UndoCommand,
- image);
+ image,exception);
break;
}
case ColorEditHelpCommand:
x=event.xbutton.x;
y=event.xbutton.y;
(void) XMagickCommand(display,resource_info,windows,
- SaveToUndoBufferCommand,image);
+ SaveToUndoBufferCommand,image,exception);
state|=UpdateConfigurationState;
break;
}
x=event.xbutton.x;
y=event.xbutton.y;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
XInfoWidget(display,windows,text);
(void) XCheckDefineCursor(display,windows->image.id,cursor);
state&=(~UpdateConfigurationState);
if ((x_offset >= (int) (*image)->columns) ||
(y_offset >= (int) (*image)->rows))
continue;
- exception=(&(*image)->exception);
image_view=AcquireCacheView(*image);
switch (method)
{
SetPixelRed(*image,ScaleShortToQuantum(color.red),q);
SetPixelGreen(*image,ScaleShortToQuantum(color.green),q);
SetPixelBlue(*image,ScaleShortToQuantum(color.blue),q);
- (void) SyncCacheViewAuthenticPixels(image_view,
- &(*image)->exception);
+ (void) SyncCacheViewAuthenticPixels(image_view,exception);
break;
}
case ReplaceMethod:
Update color information using replace algorithm.
*/
(void) GetOneCacheViewVirtualPixel(image_view,(ssize_t) x_offset,
- (ssize_t) y_offset,&target,&(*image)->exception);
+ (ssize_t) y_offset,&target,exception);
if ((*image)->storage_class == DirectClass)
{
for (y=0; y < (int) (*image)->rows; y++)
&draw_info->fill,exception);
(void) FloodfillPaintImage(*image,draw_info,&target,(ssize_t)
x_offset,(ssize_t) y_offset,method == FloodfillMethod ?
- MagickFalse : MagickTrue);
+ MagickFalse : MagickTrue,exception);
draw_info=DestroyDrawInfo(draw_info);
break;
}
% The format of the XCompositeImage method is:
%
% MagickBooleanType XCompositeImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image; returned from ReadImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XCompositeImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
static char
displacement_geometry[MaxTextExtent] = "30x30",
XCheckRefreshWindows(display,windows);
(void) CopyMagickString(resource_info->image_info->filename,filename,
MaxTextExtent);
- composite_image=ReadImage(resource_info->image_info,&image->exception);
- CatchException(&image->exception);
+ composite_image=ReadImage(resource_info->image_info,exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (composite_image == (Image *) NULL)
return(MagickFalse);
*/
resize_image=ResizeImage(composite_image,composite_info.width,
composite_info.height,composite_image->filter,composite_image->blur,
- &image->exception);
+ exception);
composite_image=DestroyImage(composite_image);
if (resize_image == (Image *) NULL)
{
CacheView
*image_view;
- ExceptionInfo
- *exception;
-
int
y;
/*
Create mattes for blending.
*/
- (void) SetImageAlphaChannel(composite_image,OpaqueAlphaChannel);
+ (void) SetImageAlphaChannel(composite_image,OpaqueAlphaChannel,exception);
opacity=(Quantum) (ScaleQuantumToChar((Quantum) QuantumRange)-
((ssize_t) ScaleQuantumToChar((Quantum) QuantumRange)*blend)/100);
- exception=(&image->exception);
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
image->matte=MagickTrue;
Update image configuration.
*/
XConfigureImageColormap(display,resource_info,windows,image);
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
return(MagickTrue);
}
\f
% The format of the XConfigureImage method is:
%
% MagickBooleanType XConfigureImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
+% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType XConfigureImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
char
geometry[MaxTextExtent];
windows->image.y=(int)
(height*windows->image.y/windows->image.ximage->height);
status=XMakeImage(display,resource_info,&windows->image,image,
- (unsigned int) width,(unsigned int) height);
+ (unsigned int) width,(unsigned int) height,exception);
if (status == MagickFalse)
XNoticeWidget(display,windows,"Unable to configure X image:",
windows->image.name);
%
% MagickBooleanType XCropImage(Display *display,
% XResourceInfo *resource_info,XWindows *windows,Image *image,
-% const ClipboardMode mode)
+% const ClipboardMode mode,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o mode: This unsigned value specified whether the image should be
% cropped, copied, or cut.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XCropImage(Display *display,
XResourceInfo *resource_info,XWindows *windows,Image *image,
- const ClipboardMode mode)
+ const ClipboardMode mode,ExceptionInfo *exception)
{
static const char
*CropModeMenu[] =
Cursor
cursor;
- ExceptionInfo
- *exception;
-
int
id,
x,
XSetCropGeometry(display,windows,&crop_info,image);
windows->image.window_changes.width=(int) crop_info.width;
windows->image.window_changes.height=(int) crop_info.height;
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
return(MagickTrue);
}
/*
crop_info.y+=y;
crop_info.y=(ssize_t) (scale_factor*crop_info.y+0.5);
crop_info.height=(unsigned int) (scale_factor*crop_info.height+0.5);
- crop_image=CropImage(image,&crop_info,&image->exception);
+ crop_image=CropImage(image,&crop_info,exception);
XSetCursorState(display,windows,MagickFalse);
if (crop_image == (Image *) NULL)
return(MagickFalse);
resource_info->copy_image=crop_image;
if (mode == CopyMode)
{
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
return(MagickTrue);
}
/*
Cut image.
*/
- exception=(&image->exception);
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
image->matte=MagickTrue;
Update image configuration.
*/
XConfigureImageColormap(display,resource_info,windows,image);
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
return(MagickTrue);
}
\f
% The format of the XDrawEditImage method is:
%
% MagickBooleanType XDrawEditImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image **image)
+% XResourceInfo *resource_info,XWindows *windows,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XDrawEditImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image **image)
+ XResourceInfo *resource_info,XWindows *windows,Image **image,
+ ExceptionInfo *exception)
{
static const char
*DrawMenu[] =
sizeof(*coordinate_info));
if (coordinate_info == (XPoint *) NULL)
{
- (void) ThrowMagickException(&(*image)->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'","...");
return(MagickFalse);
}
image_info=AcquireImageInfo();
(void) CopyMagickString(image_info->filename,filename,
MaxTextExtent);
- stipple_image=ReadImage(image_info,&(*image)->exception);
- CatchException(&(*image)->exception);
+ stipple_image=ReadImage(image_info,exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (stipple_image == (Image *) NULL)
break;
(void) AcquireUniqueFileResource(filename);
(void) FormatLocaleString(stipple_image->filename,MaxTextExtent,
"xbm:%s",filename);
- (void) WriteImage(image_info,stipple_image);
+ (void) WriteImage(image_info,stipple_image,exception);
stipple_image=DestroyImage(stipple_image);
image_info=DestroyImageInfo(image_info);
status=XReadBitmapFile(display,root_window,filename,&width,
case DrawUndoCommand:
{
(void) XMagickCommand(display,resource_info,windows,UndoCommand,
- image);
+ image,exception);
break;
}
case DrawHelpCommand:
coordinate_info=(XPoint *) ResizeQuantumMemory(coordinate_info,
max_coordinates,sizeof(*coordinate_info));
if (coordinate_info == (XPoint *) NULL)
- (void) ThrowMagickException(&(*image)->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'","...");
break;
}
coordinate_info=(XPoint *) ResizeQuantumMemory(coordinate_info,
max_coordinates,sizeof(*coordinate_info));
if (coordinate_info == (XPoint *) NULL)
- (void) ThrowMagickException(&(*image)->exception,GetMagickModule(),
+ (void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'","...");
break;
}
draw_info.x=(int) rectangle_info.x;
draw_info.y=(int) rectangle_info.y;
(void) XMagickCommand(display,resource_info,windows,SaveToUndoBufferCommand,
- image);
+ image,exception);
width=(unsigned int) (*image)->columns;
height=(unsigned int) (*image)->rows;
x=0;
Update image colormap and return to image drawing.
*/
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
}
XSetCursorState(display,windows,MagickFalse);
coordinate_info=(XPoint *) RelinquishMagickMemory(coordinate_info);
% The format of the XImageCache method is:
%
% void XImageCache(Display *display,XResourceInfo *resource_info,
-% XWindows *windows,const CommandType command,Image **image)
+% XWindows *windows,const CommandType command,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image: the image; XImageCache may transform the image and return a new
% image pointer.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static void XImageCache(Display *display,XResourceInfo *resource_info,
- XWindows *windows,const CommandType command,Image **image)
+ XWindows *windows,const CommandType command,Image **image,
+ ExceptionInfo *exception)
{
Image
*cache_image;
if (windows->image.orphan != MagickFalse)
return;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
return;
}
case CutCommand:
break;
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- cache_image->list=CloneImage(*image,0,0,MagickTrue,&(*image)->exception);
+ cache_image->list=CloneImage(*image,0,0,MagickTrue,exception);
XSetCursorState(display,windows,MagickFalse);
if (cache_image->list == (Image *) NULL)
{
if (windows->image.orphan != MagickFalse)
return;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
return;
}
if (command != InfoCommand)
% XImageWindowCommand() makes a transform to the image or Image window as
% specified by a user menu button or keyboard command.
%
-% The format of the XMagickCommand method is:
+% The format of the XImageWindowCommand method is:
%
% CommandType XImageWindowCommand(Display *display,
% XResourceInfo *resource_info,XWindows *windows,
-% const MagickStatusType state,KeySym key_symbol,Image **image)
+% const MagickStatusType state,KeySym key_symbol,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o key_symbol: Specifies a command to perform.
%
-% o image: the image; XImageWIndowCommand
-% may transform the image and return a new image pointer.
+% o image: the image; XImageWIndowCommand may transform the image and
+% return a new image pointer.
+%
+% o exception: return any errors or warnings in this structure.
%
*/
static CommandType XImageWindowCommand(Display *display,
XResourceInfo *resource_info,XWindows *windows,const MagickStatusType state,
- KeySym key_symbol,Image **image)
+ KeySym key_symbol,Image **image,ExceptionInfo *exception)
{
static char
delta[MaxTextExtent] = "";
windows->image.window_changes.width=(int) crop_info.width;
windows->image.window_changes.height=(int) crop_info.height;
(void) XSetWindowBackgroundPixmap(display,windows->image.id,None);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,
+ exception);
return(NullCommand);
}
XTranslateImage(display,windows,*image,key_symbol);
% The format of the XMagickCommand method is:
%
% Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
-% XWindows *windows,const CommandType command,Image **image)
+% XWindows *windows,const CommandType command,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
-% o nexus: Method XMagickCommand returns an image when the
-% user chooses 'Load Image' from the command menu. Otherwise a null
-% image is returned.
-%
% o display: Specifies a connection to an X server; returned from
% XOpenDisplay.
%
%
% o command: Specifies a command to perform.
%
-% o image: the image; XMagickCommand
-% may transform the image and return a new image pointer.
+% o image: the image; XMagickCommand may transform the image and return a
+% new image pointer.
+%
+% o exception: return any errors or warnings in this structure.
%
*/
static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
- XWindows *windows,const CommandType command,Image **image)
+ XWindows *windows,const CommandType command,Image **image,
+ ExceptionInfo *exception)
{
char
filename[MaxTextExtent],
Process user command.
*/
XCheckRefreshWindows(display,windows);
- XImageCache(display,resource_info,windows,command,image);
+ XImageCache(display,resource_info,windows,command,image,exception);
nexus=NewImageList();
windows->image.window_changes.width=windows->image.ximage->width;
windows->image.window_changes.height=windows->image.ximage->height;
*/
status=chdir(resource_info->home_directory);
if (status == -1)
- (void) ThrowMagickException(&(*image)->exception,GetMagickModule(),
- FileOpenError,"UnableToOpenFile","%s",resource_info->home_directory);
+ (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
+ "UnableToOpenFile","%s",resource_info->home_directory);
nexus=XOpenImage(display,resource_info,windows,MagickTrue);
break;
}
/*
Save image.
*/
- status=XSaveImage(display,resource_info,windows,*image);
+ status=XSaveImage(display,resource_info,windows,*image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to write X image:",
/*
Print image.
*/
- status=XPrintImage(display,resource_info,windows,*image);
+ status=XPrintImage(display,resource_info,windows,*image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to print X image:",
(void) FormatLocaleString(image_info->filename,MaxTextExtent,
"%s:%s",format,color);
(void) CloneString(&image_info->size,geometry);
- nexus=ReadImage(image_info,&(*image)->exception);
- CatchException(&(*image)->exception);
+ nexus=ReadImage(image_info,exception);
+ CatchException(exception);
XClientMessage(display,windows->image.id,windows->im_protocols,
windows->im_next_image,CurrentTime);
break;
/*
Visual Image directory.
*/
- nexus=XVisualDirectoryImage(display,resource_info,windows);
+ nexus=XVisualDirectoryImage(display,resource_info,windows,exception);
break;
}
case QuitCommand:
/*
Cut image.
*/
- (void) XCropImage(display,resource_info,windows,*image,CutMode);
+ (void) XCropImage(display,resource_info,windows,*image,CutMode,exception);
break;
}
case CopyCommand:
/*
Copy image.
*/
- (void) XCropImage(display,resource_info,windows,*image,CopyMode);
+ (void) XCropImage(display,resource_info,windows,*image,CopyMode,
+ exception);
break;
}
case PasteCommand:
/*
Paste image.
*/
- status=XPasteImage(display,resource_info,windows,*image);
+ status=XPasteImage(display,resource_info,windows,*image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to paste X image",
*/
windows->image.window_changes.width=windows->image.ximage->width/2;
windows->image.window_changes.height=windows->image.ximage->height/2;
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case OriginalSizeCommand:
*/
windows->image.window_changes.width=(int) (*image)->columns;
windows->image.window_changes.height=(int) (*image)->rows;
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case DoubleSizeCommand:
*/
windows->image.window_changes.width=windows->image.ximage->width << 1;
windows->image.window_changes.height=windows->image.ximage->height << 1;
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case ResizeCommand:
(void) ParseMetaGeometry(geometry,&x,&y,&width,&height);
windows->image.window_changes.width=(int) width;
windows->image.window_changes.height=(int) height;
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case ApplyCommand:
windows->image.x=0;
windows->image.y=0;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case RefreshCommand:
{
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case RestoreCommand:
windows->image.y=0;
}
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case CropCommand:
/*
Crop image.
*/
- (void) XCropImage(display,resource_info,windows,*image,CropMode);
+ (void) XCropImage(display,resource_info,windows,*image,CropMode,
+ exception);
break;
}
case ChopCommand:
/*
Chop image.
*/
- status=XChopImage(display,resource_info,windows,image);
+ status=XChopImage(display,resource_info,windows,image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to cut X image",
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- flop_image=FlopImage(*image,&(*image)->exception);
+ flop_image=FlopImage(*image,exception);
if (flop_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=flop_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.crop_geometry != (char *) NULL)
{
}
if (windows->image.orphan != MagickFalse)
break;
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case FlipCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- flip_image=FlipImage(*image,&(*image)->exception);
+ flip_image=FlipImage(*image,exception);
if (flip_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=flip_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.crop_geometry != (char *) NULL)
{
}
if (windows->image.orphan != MagickFalse)
break;
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case RotateRightCommand:
/*
Rotate image 90 degrees clockwise.
*/
- status=XRotateImage(display,resource_info,windows,90.0,image);
+ status=XRotateImage(display,resource_info,windows,90.0,image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to rotate X image",
/*
Rotate image 90 degrees counter-clockwise.
*/
- status=XRotateImage(display,resource_info,windows,-90.0,image);
+ status=XRotateImage(display,resource_info,windows,-90.0,image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to rotate X image",
/*
Rotate image.
*/
- status=XRotateImage(display,resource_info,windows,0.0,image);
+ status=XRotateImage(display,resource_info,windows,0.0,image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to rotate X image",
/*
Shear image.
*/
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) QueryColorDatabase(color,&(*image)->background_color,
- &(*image)->exception);
+ exception);
flags=ParseGeometry(geometry,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=geometry_info.rho;
shear_image=ShearImage(*image,geometry_info.rho,geometry_info.sigma,
- &(*image)->exception);
+ exception);
if (shear_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=shear_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
windows->image.window_changes.width=(int) (*image)->columns;
windows->image.window_changes.height=(int) (*image)->rows;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case RollCommand:
/*
Roll image.
*/
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) ParsePageGeometry(*image,geometry,&page_geometry,
- &(*image)->exception);
+ exception);
roll_image=RollImage(*image,page_geometry.x,page_geometry.y,
- &(*image)->exception);
+ exception);
if (roll_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=roll_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
windows->image.window_changes.width=(int) (*image)->columns;
windows->image.window_changes.height=(int) (*image)->rows;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case TrimCommand:
/*
Trim image.
*/
- status=XTrimImage(display,resource_info,windows,*image);
+ status=XTrimImage(display,resource_info,windows,*image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to trim X image",
(void) CopyMagickString(modulate_factors,"100.0/100.0/",MaxTextExtent);
(void) ConcatenateMagickString(modulate_factors,hue_percent,
MaxTextExtent);
- (void) ModulateImage(*image,modulate_factors);
+ (void) ModulateImage(*image,modulate_factors,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SaturationCommand:
(void) CopyMagickString(modulate_factors,"100.0/",MaxTextExtent);
(void) ConcatenateMagickString(modulate_factors,saturation_percent,
MaxTextExtent);
- (void) ModulateImage(*image,modulate_factors);
+ (void) ModulateImage(*image,modulate_factors,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case BrightnessCommand:
XCheckRefreshWindows(display,windows);
(void) CopyMagickString(modulate_factors,brightness_percent,
MaxTextExtent);
- (void) ModulateImage(*image,modulate_factors);
+ (void) ModulateImage(*image,modulate_factors,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case GammaCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) GammaImage(*image,atof(factor),&(*image)->exception);
+ (void) GammaImage(*image,atof(factor),exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SpiffCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) ContrastImage(*image,MagickTrue);
+ (void) ContrastImage(*image,MagickTrue,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case DullCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) ContrastImage(*image,MagickFalse);
+ (void) ContrastImage(*image,MagickFalse,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case ContrastStretchCommand:
white_point*=(double) (*image)->columns*(*image)->rows/100.0;
}
white_point=(MagickRealType) (*image)->columns*(*image)->rows-white_point;
- (void) ContrastStretchImage(*image,black_point,white_point);
+ (void) ContrastStretchImage(*image,black_point,white_point,
+ exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SigmoidalContrastCommand:
if ((flags & PercentValue) != 0)
geometry_info.sigma=1.0*QuantumRange*geometry_info.sigma/100.0;
(void) SigmoidalContrastImage(*image,MagickTrue,geometry_info.rho,
- geometry_info.sigma);
+ geometry_info.sigma,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case NormalizeCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) NormalizeImage(*image);
+ (void) NormalizeImage(*image,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case EqualizeCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) EqualizeImage(*image);
+ (void) EqualizeImage(*image,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case NegateCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) NegateImage(*image,MagickFalse,&(*image)->exception);
+ (void) NegateImage(*image,MagickFalse,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case GrayscaleCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) SetImageType(*image,(*image)->matte == MagickFalse ?
- GrayscaleType : GrayscaleMatteType);
+ GrayscaleType : GrayscaleMatteType,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case MapCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- affinity_image=ReadImage(image_info,&(*image)->exception);
+ affinity_image=ReadImage(image_info,exception);
if (affinity_image != (Image *) NULL)
{
- (void) RemapImage(&quantize_info,*image,affinity_image);
+ (void) RemapImage(&quantize_info,*image,affinity_image,exception);
affinity_image=DestroyImage(affinity_image);
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case QuantizeCommand:
XCheckRefreshWindows(display,windows);
quantize_info.number_colors=StringToUnsignedLong(colors);
quantize_info.dither=status != 0 ? MagickTrue : MagickFalse;
- (void) QuantizeImage(&quantize_info,*image);
+ (void) QuantizeImage(&quantize_info,*image,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case DespeckleCommand:
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- despeckle_image=DespeckleImage(*image,&(*image)->exception);
+ despeckle_image=DespeckleImage(*image,exception);
if (despeckle_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=despeckle_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case EmbossCommand:
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
emboss_image=EmbossImage(*image,geometry_info.rho,geometry_info.sigma,
- &(*image)->exception);
+ exception);
if (emboss_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=emboss_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case ReduceNoiseCommand:
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
noise_image=StatisticImage(*image,NonpeakStatistic,(size_t)
- geometry_info.rho,(size_t) geometry_info.rho,&(*image)->exception);
+ geometry_info.rho,(size_t) geometry_info.rho,exception);
if (noise_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=noise_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case AddNoiseCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
noise_image=AddNoiseImage(*image,(NoiseType) ParseCommandOption(
- MagickNoiseOptions,MagickFalse,noise_type),&(*image)->exception);
+ MagickNoiseOptions,MagickFalse,noise_type),exception);
if (noise_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=noise_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SharpenCommand:
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
sharp_image=SharpenImage(*image,geometry_info.rho,geometry_info.sigma,
- &(*image)->exception);
+ geometry_info.xi,exception);
if (sharp_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=sharp_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case BlurCommand:
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
blur_image=BlurImage(*image,geometry_info.rho,geometry_info.sigma,
- &(*image)->exception);
+ geometry_info.xi,exception);
if (blur_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=blur_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case ThresholdCommand:
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case EdgeDetectCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
- edge_image=EdgeImage(*image,geometry_info.rho,&(*image)->exception);
+ edge_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
+ exception);
if (edge_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=edge_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SpreadCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(amount,&geometry_info);
- spread_image=EdgeImage(*image,geometry_info.rho,&(*image)->exception);
+ spread_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
+ exception);
if (spread_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=spread_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case ShadeCommand:
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
shade_image=ShadeImage(*image,status != 0 ? MagickFalse : MagickTrue,
- geometry_info.rho,geometry_info.sigma,&(*image)->exception);
+ geometry_info.rho,geometry_info.sigma,exception);
if (shade_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=shade_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case RaiseCommand:
/*
Raise an image.
*/
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) ParsePageGeometry(*image,bevel_width,&page_geometry,
- &(*image)->exception);
- (void) RaiseImage(*image,&page_geometry,MagickTrue);
+ exception);
+ (void) RaiseImage(*image,&page_geometry,MagickTrue,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SegmentCommand:
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
(void) SegmentImage(*image,RGBColorspace,MagickFalse,geometry_info.rho,
- geometry_info.sigma);
+ geometry_info.sigma,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SepiaToneCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
threshold=SiPrefixToDouble(factor,QuantumRange);
- sepia_image=SepiaToneImage(*image,threshold,&(*image)->exception);
+ sepia_image=SepiaToneImage(*image,threshold,exception);
if (sepia_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=sepia_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SolarizeCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
threshold=SiPrefixToDouble(factor,QuantumRange);
- (void) SolarizeImage(*image,threshold);
+ (void) SolarizeImage(*image,threshold,exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SwirlCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(degrees,&geometry_info);
- swirl_image=SwirlImage(*image,geometry_info.rho,&(*image)->exception);
+ swirl_image=SwirlImage(*image,geometry_info.rho,exception);
if (swirl_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=swirl_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case ImplodeCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(factor,&geometry_info);
- implode_image=ImplodeImage(*image,geometry_info.rho,&(*image)->exception);
+ implode_image=ImplodeImage(*image,geometry_info.rho,exception);
if (implode_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=implode_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case VignetteCommand:
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),&(*image)->exception);
+ 0.5),exception);
if (vignette_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=vignette_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case WaveCommand:
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
wave_image=WaveImage(*image,geometry_info.rho,geometry_info.sigma,
- &(*image)->exception);
+ (*image)->interpolate,exception);
if (wave_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=wave_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case OilPaintCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
- paint_image=OilPaintImage(*image,geometry_info.rho,&(*image)->exception);
+ paint_image=OilPaintImage(*image,geometry_info.rho,geometry_info.sigma,
+ exception);
if (paint_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=paint_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case CharcoalDrawCommand:
/*
Charcoal the image.
*/
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=geometry_info.rho;
charcoal_image=CharcoalImage(*image,geometry_info.rho,geometry_info.sigma,
- &(*image)->exception);
+ geometry_info.xi,exception);
if (charcoal_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=charcoal_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case AnnotateCommand:
/*
Annotate the image with text.
*/
- status=XAnnotateEditImage(display,resource_info,windows,*image);
+ status=XAnnotateEditImage(display,resource_info,windows,*image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to annotate X image",
/*
Draw image.
*/
- status=XDrawEditImage(display,resource_info,windows,image);
+ status=XDrawEditImage(display,resource_info,windows,image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to draw on the X image",
/*
Color edit.
*/
- status=XColorEditImage(display,resource_info,windows,image);
+ status=XColorEditImage(display,resource_info,windows,image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to pixel edit X image",
/*
Matte edit.
*/
- status=XMatteEditImage(display,resource_info,windows,image);
+ status=XMatteEditImage(display,resource_info,windows,image,exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to matte edit X image",
/*
Composite image.
*/
- status=XCompositeImage(display,resource_info,windows,*image);
+ status=XCompositeImage(display,resource_info,windows,*image,
+ exception);
if (status == MagickFalse)
{
XNoticeWidget(display,windows,"Unable to composite X image",
/*
Add a border to the image.
*/
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) QueryColorDatabase(color,&(*image)->border_color,
- &(*image)->exception);
+ exception);
(void) ParsePageGeometry(*image,geometry,&page_geometry,
- &(*image)->exception);
- border_image=BorderImage(*image,&page_geometry,&(*image)->exception);
+ exception);
+ border_image=BorderImage(*image,&page_geometry,exception);
if (border_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=border_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
windows->image.window_changes.width=(int) (*image)->columns;
windows->image.window_changes.height=(int) (*image)->rows;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case AddFrameCommand:
/*
Surround image with an ornamental border.
*/
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) QueryColorDatabase(color,&(*image)->matte_color,
- &(*image)->exception);
+ exception);
(void) ParsePageGeometry(*image,geometry,&page_geometry,
- &(*image)->exception);
+ exception);
frame_info.width=page_geometry.width;
frame_info.height=page_geometry.height;
frame_info.outer_bevel=page_geometry.x;
frame_info.y=(ssize_t) frame_info.height;
frame_info.width=(*image)->columns+2*frame_info.width;
frame_info.height=(*image)->rows+2*frame_info.height;
- frame_image=FrameImage(*image,&frame_info,&(*image)->exception);
+ frame_image=FrameImage(*image,&frame_info,exception);
if (frame_image != (Image *) NULL)
{
*image=DestroyImage(*image);
*image=frame_image;
}
- CatchException(&(*image)->exception);
+ CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
if (windows->image.orphan != MagickFalse)
break;
windows->image.window_changes.width=(int) (*image)->columns;
windows->image.window_changes.height=(int) (*image)->rows;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case CommentCommand:
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
status=InvokeDelegate(image_info,*image,"edit",(char *) NULL,
- &(*image)->exception);
+ exception);
if (status == MagickFalse)
XNoticeWidget(display,windows,"Unable to edit image comment",
(char *) NULL);
char
*comment;
- comment=FileToString(image_info->filename,~0UL,&(*image)->exception);
+ comment=FileToString(image_info->filename,~0UL,exception);
if (comment != (char *) NULL)
{
(void) SetImageProperty(*image,"comment",comment);
(void) AcquireUniqueFilename(filename);
(void) FormatLocaleString((*image)->filename,MaxTextExtent,"launch:%s",
filename);
- status=WriteImage(image_info,*image);
+ status=WriteImage(image_info,*image,exception);
if (status == MagickFalse)
XNoticeWidget(display,windows,"Unable to launch image editor",
(char *) NULL);
else
{
- nexus=ReadImage(resource_info->image_info,&(*image)->exception);
- CatchException(&(*image)->exception);
+ nexus=ReadImage(resource_info->image_info,exception);
+ CatchException(exception);
XClientMessage(display,windows->image.id,windows->im_protocols,
windows->im_next_image,CurrentTime);
}
/*
Apply an image processing technique to a region of interest.
*/
- (void) XROIImage(display,resource_info,windows,image);
+ (void) XROIImage(display,resource_info,windows,image,exception);
break;
}
case InfoCommand:
(void) AcquireUniqueFilename(filename);
(void) FormatLocaleString((*image)->filename,MaxTextExtent,"preview:%s",
filename);
- status=WriteImage(image_info,*image);
+ status=WriteImage(image_info,*image,exception);
(void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- preview_image=ReadImage(image_info,&(*image)->exception);
+ preview_image=ReadImage(image_info,exception);
(void) RelinquishUniqueFileResource(filename);
if (preview_image == (Image *) NULL)
break;
(void) FormatLocaleString(preview_image->filename,MaxTextExtent,"show:%s",
filename);
- status=WriteImage(image_info,preview_image);
+ status=WriteImage(image_info,preview_image,exception);
preview_image=DestroyImage(preview_image);
if (status == MagickFalse)
XNoticeWidget(display,windows,"Unable to show image preview",
(void) AcquireUniqueFilename(filename);
(void) FormatLocaleString((*image)->filename,MaxTextExtent,"histogram:%s",
filename);
- status=WriteImage(image_info,*image);
+ status=WriteImage(image_info,*image,exception);
(void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- histogram_image=ReadImage(image_info,&(*image)->exception);
+ histogram_image=ReadImage(image_info,exception);
(void) RelinquishUniqueFileResource(filename);
if (histogram_image == (Image *) NULL)
break;
(void) FormatLocaleString(histogram_image->filename,MaxTextExtent,
"show:%s",filename);
- status=WriteImage(image_info,histogram_image);
+ status=WriteImage(image_info,histogram_image,exception);
histogram_image=DestroyImage(histogram_image);
if (status == MagickFalse)
XNoticeWidget(display,windows,"Unable to show histogram",
(void) AcquireUniqueFilename(filename);
(void) FormatLocaleString((*image)->filename,MaxTextExtent,"matte:%s",
filename);
- status=WriteImage(image_info,*image);
+ status=WriteImage(image_info,*image,exception);
(void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- matte_image=ReadImage(image_info,&(*image)->exception);
+ matte_image=ReadImage(image_info,exception);
(void) RelinquishUniqueFileResource(filename);
if (matte_image == (Image *) NULL)
break;
(void) FormatLocaleString(matte_image->filename,MaxTextExtent,"show:%s",
filename);
- status=WriteImage(image_info,matte_image);
+ status=WriteImage(image_info,matte_image,exception);
matte_image=DestroyImage(matte_image);
if (status == MagickFalse)
XNoticeWidget(display,windows,"Unable to show matte",
/*
Background image.
*/
- status=XBackgroundImage(display,resource_info,windows,image);
+ status=XBackgroundImage(display,resource_info,windows,image,exception);
if (status == MagickFalse)
break;
- nexus=CloneImage(*image,0,0,MagickTrue,&(*image)->exception);
+ nexus=CloneImage(*image,0,0,MagickTrue,exception);
if (nexus != (Image *) NULL)
XClientMessage(display,windows->image.id,windows->im_protocols,
windows->im_next_image,CurrentTime);
status=XPreferencesWidget(display,resource_info,windows);
if (status == MagickFalse)
break;
- nexus=CloneImage(*image,0,0,MagickTrue,&(*image)->exception);
+ nexus=CloneImage(*image,0,0,MagickTrue,exception);
if (nexus != (Image *) NULL)
XClientMessage(display,windows->image.id,windows->im_protocols,
windows->im_next_image,CurrentTime);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
status=InvokeDelegate(image_info,*image,"browse",(char *) NULL,
- &(*image)->exception);
+ exception);
if (status == MagickFalse)
XNoticeWidget(display,windows,"Unable to browse documentation",
(char *) NULL);
% The format of the XMakePanImage method is:
%
% void XMakePanImage(Display *display,XResourceInfo *resource_info,
-% XWindows *windows,Image *image)
+% XWindows *windows,Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static void XMakePanImage(Display *display,XResourceInfo *resource_info,
- XWindows *windows,Image *image)
+ XWindows *windows,Image *image,ExceptionInfo *exception)
{
MagickStatusType
status;
windows->pan.x=(int) windows->image.x;
windows->pan.y=(int) windows->image.y;
status=XMakeImage(display,resource_info,&windows->pan,image,
- windows->pan.width,windows->pan.height);
+ windows->pan.width,windows->pan.height,exception);
if (status == MagickFalse)
- ThrowXWindowFatalException(XServerError,image->exception.reason,
- image->exception.description);
+ ThrowXWindowFatalException(ResourceLimitError,
+ "MemoryAllocationFailed",image->filename);
(void) XSetWindowBackgroundPixmap(display,windows->pan.id,
windows->pan.pixmap);
(void) XClearWindow(display,windows->pan.id);
% The format of the XMatteEditImage method is:
%
% MagickBooleanType XMatteEditImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image **image)
+% XResourceInfo *resource_info,XWindows *windows,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image; returned from ReadImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XMatteEditImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image **image)
+ XResourceInfo *resource_info,XWindows *windows,Image **image,
+ ExceptionInfo *exception)
{
static char
matte[MaxTextExtent] = "0";
case MatteEditUndoCommand:
{
(void) XMagickCommand(display,resource_info,windows,UndoCommand,
- image);
+ image,exception);
break;
}
case MatteEditHelpCommand:
x=event.xbutton.x;
y=event.xbutton.y;
(void) XMagickCommand(display,resource_info,windows,
- SaveToUndoBufferCommand,image);
+ SaveToUndoBufferCommand,image,exception);
state|=UpdateConfigurationState;
break;
}
x=event.xbutton.x;
y=event.xbutton.y;
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
XInfoWidget(display,windows,text);
(void) XCheckDefineCursor(display,windows->image.id,cursor);
state&=(~UpdateConfigurationState);
CacheView
*image_view;
- ExceptionInfo
- *exception;
-
int
x,
y;
if ((x_offset >= (int) (*image)->columns) ||
(y_offset >= (int) (*image)->rows))
continue;
- exception=(&(*image)->exception);
if (SetImageStorageClass(*image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
(*image)->matte=MagickTrue;
for (y=0; y < (int) (*image)->rows; y++)
{
q=GetCacheViewAuthenticPixels(image_view,0,(ssize_t) y,
- (*image)->columns,1,&(*image)->exception);
+ (*image)->columns,1,exception);
if (q == (Quantum *) NULL)
break;
for (x=0; x < (int) (*image)->columns; x++)
case FloodfillMethod:
case FillToBorderMethod:
{
+ ChannelType
+ channel_mask;
+
DrawInfo
*draw_info;
(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);
+ MagickFalse : MagickTrue,exception);
+ (void) SetPixelChannelMap(*image,channel_mask);
draw_info=DestroyDrawInfo(draw_info);
break;
}
% The format of the XPasteImage method is:
%
% MagickBooleanType XPasteImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image; returned from ReadImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XPasteImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
static const char
*PasteMenu[] =
*/
if (resource_info->copy_image == (Image *) NULL)
return(MagickFalse);
- paste_image=CloneImage(resource_info->copy_image,0,0,MagickTrue,
- &image->exception);
+ paste_image=CloneImage(resource_info->copy_image,0,0,MagickTrue,exception);
/*
Map Command widget.
*/
Update image colormap.
*/
XConfigureImageColormap(display,resource_info,windows,image);
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
return(MagickTrue);
}
\f
% The format of the XPrintImage method is:
%
% MagickBooleanType XPrintImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XPrintImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
char
filename[MaxTextExtent],
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- print_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ print_image=CloneImage(image,0,0,MagickTrue,exception);
if (print_image == (Image *) NULL)
return(MagickFalse);
(void) FormatLocaleString(geometry,MaxTextExtent,"%dx%d!",
(void) AcquireUniqueFilename(filename);
(void) FormatLocaleString(print_image->filename,MaxTextExtent,"print:%s",
filename);
- status=WriteImage(image_info,print_image);
+ status=WriteImage(image_info,print_image,exception);
(void) RelinquishUniqueFileResource(filename);
print_image=DestroyImage(print_image);
image_info=DestroyImageInfo(image_info);
% The format of the XROIImage method is:
%
% MagickBooleanType XROIImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image **image)
+% XResourceInfo *resource_info,XWindows *windows,Image **image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image; returned from ReadImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XROIImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image **image)
+ XResourceInfo *resource_info,XWindows *windows,Image **image,
+ ExceptionInfo *exception)
{
#define ApplyMenus 7
case RedoCommand:
{
(void) XMagickCommand(display,resource_info,windows,command_type,
- image);
+ image,exception);
break;
}
default:
crop_info.y=(ssize_t) (scale_factor*crop_info.y+0.5);
crop_info.height=(unsigned int)
(scale_factor*crop_info.height+0.5);
- roi_image=CropImage(*image,&crop_info,&(*image)->exception);
+ roi_image=CropImage(*image,&crop_info,exception);
(void) SetImageProgressMonitor(*image,progress_monitor,
(*image)->client_data);
if (roi_image == (Image *) NULL)
*/
windows->image.orphan=MagickTrue;
(void) XMagickCommand(display,resource_info,windows,command_type,
- &roi_image);
+ &roi_image,exception);
progress_monitor=SetImageProgressMonitor(*image,
(MagickProgressMonitor) NULL,(*image)->client_data);
(void) XMagickCommand(display,resource_info,windows,
- SaveToUndoBufferCommand,image);
+ SaveToUndoBufferCommand,image,exception);
windows->image.orphan=MagickFalse;
(void) CompositeImage(*image,CopyCompositeOp,roi_image,
crop_info.x,crop_info.y);
if (command_type != InfoCommand)
{
XConfigureImageColormap(display,resource_info,windows,*image);
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
}
XCheckRefreshWindows(display,windows);
XInfoWidget(display,windows,text);
default:
{
command_type=XImageWindowCommand(display,resource_info,windows,
- event.xkey.state,key_symbol,image);
+ event.xkey.state,key_symbol,image,exception);
if (command_type != NullCommand)
state|=UpdateRegionState;
break;
%
% MagickBooleanType XRotateImage(Display *display,
% XResourceInfo *resource_info,XWindows *windows,double degrees,
-% Image **image)
+% Image **image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XRotateImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,double degrees,Image **image)
+ XResourceInfo *resource_info,XWindows *windows,double degrees,Image **image,
+ ExceptionInfo *exception)
{
static const char
*RotateMenu[] =
for (rotations=0; normalized_degrees > 45.0; rotations++)
normalized_degrees-=90.0;
if (normalized_degrees != 0.0)
- (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image);
+ (void) XMagickCommand(display,resource_info,windows,ApplyCommand,image,
+ exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(*image)->background_color.red=ScaleShortToQuantum(
windows->pixel_info->pen_colors[pen_id].green);
(*image)->background_color.blue=ScaleShortToQuantum(
windows->pixel_info->pen_colors[pen_id].blue);
- rotate_image=RotateImage(*image,degrees,&(*image)->exception);
+ rotate_image=RotateImage(*image,degrees,exception);
XSetCursorState(display,windows,MagickFalse);
if (rotate_image == (Image *) NULL)
return(MagickFalse);
/*
Update image configuration.
*/
- (void) XConfigureImage(display,resource_info,windows,*image);
+ (void) XConfigureImage(display,resource_info,windows,*image,exception);
return(MagickTrue);
}
\f
% The format of the XSaveImage method is:
%
% MagickBooleanType XSaveImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XSaveImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
char
filename[MaxTextExtent],
GetPathComponent(image->filename,HeadPath,path);
GetPathComponent(image->filename,TailPath,filename);
- status=chdir(path);
- if (status == -1)
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- FileOpenError,"UnableToOpenFile","%s",path);
+ if (*path != '\0')
+ {
+ status=chdir(path);
+ if (status == -1)
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ FileOpenError,"UnableToOpenFile","%s",path);
+ }
}
XFileBrowserWidget(display,windows,"Save",filename);
if (*filename == '\0')
}
image_info=CloneImageInfo(resource_info->image_info);
(void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- (void) SetImageInfo(image_info,1,&image->exception);
+ (void) SetImageInfo(image_info,1,exception);
if ((LocaleCompare(image_info->magick,"JPEG") == 0) ||
(LocaleCompare(image_info->magick,"JPG") == 0))
{
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- save_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ save_image=CloneImage(image,0,0,MagickTrue,exception);
if (save_image == (Image *) NULL)
return(MagickFalse);
(void) FormatLocaleString(geometry,MaxTextExtent,"%dx%d!",
Write image.
*/
(void) CopyMagickString(save_image->filename,filename,MaxTextExtent);
- status=WriteImage(image_info,save_image);
+ status=WriteImage(image_info,save_image,exception);
if (status != MagickFalse)
image->taint=MagickFalse;
save_image=DestroyImage(save_image);
% The format of the XTileImage method is:
%
% Image *XTileImage(Display *display,XResourceInfo *resource_info,
-% XWindows *windows,Image *image,XEvent *event)
+% XWindows *windows,Image *image,XEvent *event,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% 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 Image *XTileImage(Display *display,XResourceInfo *resource_info,
- XWindows *windows,Image *image,XEvent *event)
+ XWindows *windows,Image *image,XEvent *event,ExceptionInfo *exception)
{
static const char
*VerbMenu[] =
MaxTextExtent);
(void) CopyMagickString(resource_info->image_info->filename,filename,
MaxTextExtent);
- tile_image=ReadImage(resource_info->image_info,&image->exception);
- CatchException(&image->exception);
+ tile_image=ReadImage(resource_info->image_info,exception);
+ CatchException(exception);
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
break;
}
}
case TileUpdateCommand:
{
- ExceptionInfo
- *exception;
-
int
x_offset,
y_offset;
*/
x_offset=(int) (width*(tile % (((int) image->columns-x)/width))+x);
y_offset=(int) (height*(tile/(((int) image->columns-x)/width))+y);
- exception=(&image->exception);
image_view=AcquireCacheView(image);
(void) GetOneCacheViewVirtualPixel(image_view,0,0,&pixel,exception);
for (i=0; i < (int) height; i++)
windows->image.window_changes.width=(int) image->columns;
windows->image.window_changes.height=(int) image->rows;
XConfigureImageColormap(display,resource_info,windows,image);
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
break;
}
default:
% The format of the XTrimImage method is:
%
% MagickBooleanType XTrimImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static MagickBooleanType XTrimImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
RectangleInfo
trim_info;
XSetCropGeometry(display,windows,&trim_info,image);
windows->image.window_changes.width=(int) trim_info.width;
windows->image.window_changes.height=(int) trim_info.height;
- (void) XConfigureImage(display,resource_info,windows,image);
+ (void) XConfigureImage(display,resource_info,windows,image,exception);
}
XSetCursorState(display,windows,MagickFalse);
return(MagickTrue);
% The format of the XVisualDirectoryImage method is:
%
% Image *XVisualDirectoryImage(Display *display,
-% XResourceInfo *resource_info,XWindows *windows)
+% XResourceInfo *resource_info,XWindows *windows,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
-% o nexus: Method XVisualDirectoryImage returns a visual image
-% directory if it can be created successfully. Otherwise a null image
-% is returned.
-%
% o display: Specifies a connection to an X server; returned from
% XOpenDisplay.
%
%
% o windows: Specifies a pointer to a XWindows structure.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static Image *XVisualDirectoryImage(Display *display,
- XResourceInfo *resource_info,XWindows *windows)
+ XResourceInfo *resource_info,XWindows *windows,ExceptionInfo *exception)
{
#define TileImageTag "Scale/Image"
#define XClientName "montage"
char
**filelist;
- ExceptionInfo
- *exception;
-
Image
*images,
*montage_image,
(void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
(void *) NULL);
images=NewImageList();
- exception=AcquireExceptionInfo();
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
for (i=0; i < (int) number_files; i++)
{
(void) DeleteImageProperty(next_image,"label");
(void) SetImageProperty(next_image,"label",InterpretImageProperties(
- read_info,next_image,DefaultTileLabel));
+ read_info,next_image,DefaultTileLabel,exception));
(void) ParseRegionGeometry(next_image,read_info->size,&geometry,
exception);
thumbnail_image=ThumbnailImage(next_image,geometry.width,
if (backdrop)
{
(void) XDisplayBackgroundImage(display,&background_resources,
- next_image);
+ next_image,exception);
XSetCursorState(display,windows,MagickTrue);
}
AppendImageToList(&images,next_image);
}
}
}
- exception=DestroyExceptionInfo(exception);
filelist=(char **) RelinquishMagickMemory(filelist);
if (images == (Image *) NULL)
{
(void) CloneString(&montage_info->font,resource_info->font);
(void) CopyMagickString(montage_info->filename,filename,MaxTextExtent);
montage_image=MontageImageList(read_info,montage_info,GetFirstImageInList(
- images),&images->exception);
+ images),exception);
images=DestroyImageList(images);
montage_info=DestroyMontageInfo(montage_info);
read_info=DestroyImageInfo(read_info);
% The format of the XDisplayBackgroundImage method is:
%
% MagickBooleanType XDisplayBackgroundImage(Display *display,
-% XResourceInfo *resource_info,Image *image)
+% XResourceInfo *resource_info,Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
MagickExport MagickBooleanType XDisplayBackgroundImage(Display *display,
- XResourceInfo *resource_info,Image *image)
+ XResourceInfo *resource_info,Image *image,ExceptionInfo *exception)
{
char
geometry[MaxTextExtent],
window_info.x=(int) geometry_info.x;
window_info.y=(int) geometry_info.y;
status=XMakeImage(display,&resources,&window_info,image,window_info.width,
- window_info.height);
+ window_info.height,exception);
if (status == MagickFalse)
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
image->filename);
% The format of the XDisplayImage method is:
%
% Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
-% char **argv,int argc,Image **image,size_t *state)
+% char **argv,int argc,Image **image,size_t *state,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: Specifies an address to an address of an Image structure;
%
+% o exception: return any errors or warnings in this structure.
+%
*/
MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
- char **argv,int argc,Image **image,size_t *state)
+ char **argv,int argc,Image **image,size_t *state,ExceptionInfo *exception)
{
#define MagnifySize 256 /* must be a power of 2 */
#define MagickMenus 10
status=chdir(working_directory);
if (status == -1)
- (void) ThrowMagickException(&(*image)->exception,GetMagickModule(),
- FileOpenError,"UnableToOpenFile","%s",working_directory);
+ (void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
+ "UnableToOpenFile","%s",working_directory);
warning_handler=resource_info->display_warnings ?
SetErrorHandler(XWarning) : SetErrorHandler((ErrorHandler) NULL);
warning_handler=resource_info->display_warnings ?
*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);
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
display_image->filename);
status=XMakeImage(display,resource_info,&windows->image,display_image,
- width,height);
+ width,height,exception);
if (status == MagickFalse)
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
display_image->filename);
status=XMakeImage(display,resource_info,&windows->magnify,(Image *) NULL,
- windows->magnify.width,windows->magnify.height);
+ windows->magnify.width,windows->magnify.height,exception);
if (status == MagickFalse)
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
display_image->filename);
(void) XMapRaised(display,windows->pan.id);
windows->image.window_changes.width=(int) display_image->columns;
windows->image.window_changes.height=(int) display_image->rows;
- (void) XConfigureImage(display,resource_info,windows,display_image);
+ (void) XConfigureImage(display,resource_info,windows,display_image,exception);
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
(void) XSync(display,MagickFalse);
/*
}
if (command_type != NullCommand)
nexus=XMagickCommand(display,resource_info,windows,command_type,
- &display_image);
+ &display_image,exception);
continue;
}
switch (event.type)
command);
if (entry >= 0)
nexus=XMagickCommand(display,resource_info,windows,
- VirtualCommands[entry],&display_image);
+ VirtualCommands[entry],&display_image,exception);
break;
}
/*
User pressed the image magnify button.
*/
(void) XMagickCommand(display,resource_info,windows,ZoomCommand,
- &display_image);
+ &display_image,exception);
XMagnifyImage(display,windows,&event);
break;
}
command);
if (entry >= 0)
nexus=XMagickCommand(display,resource_info,windows,
- VirtualCommands[entry],&display_image);
+ VirtualCommands[entry],&display_image,exception);
break;
}
if (display_image->montage != (char *) NULL)
Open or delete a tile from a visual image directory.
*/
nexus=XTileImage(display,resource_info,windows,
- display_image,&event);
+ display_image,&event,exception);
if (nexus != (Image *) NULL)
*state|=MontageImageState | NextImageState | ExitState;
vid_info.x=(short int) windows->image.x;
command);
if (entry >= 0)
nexus=XMagickCommand(display,resource_info,windows,
- ShortCutsCommands[entry],&display_image);
+ ShortCutsCommands[entry],&display_image,exception);
break;
}
case Button4:
windows->image.window_changes.width=windows->image.ximage->width;
windows->image.window_changes.height=windows->image.ximage->height;
(void) XConfigureImage(display,resource_info,windows,
- display_image);
+ display_image,exception);
}
break;
}
windows->image.window_changes.width=event.xconfigure.width;
windows->image.window_changes.height=event.xconfigure.height;
(void) XConfigureImage(display,resource_info,windows,
- display_image);
+ display_image,exception);
}
/*
Update pan window configuration.
(windows->magnify.stasis != MagickFalse))
{
status=XMakeImage(display,resource_info,&windows->magnify,
- display_image,windows->magnify.width,windows->magnify.height);
+ display_image,windows->magnify.width,windows->magnify.height,
+ exception);
XMakeMagnifyImage(display,windows);
}
break;
if (event.xkey.window == windows->image.id)
{
command_type=XImageWindowCommand(display,resource_info,windows,
- event.xkey.state,key_symbol,&display_image);
+ event.xkey.state,key_symbol,&display_image,exception);
if (command_type != NullCommand)
nexus=XMagickCommand(display,resource_info,windows,command_type,
- &display_image);
+ &display_image,exception);
}
if (event.xkey.window == windows->magnify.id)
XMagnifyWindowCommand(display,windows,event.xkey.state,key_symbol);
}
if (event.xmap.window == windows->pan.id)
{
- XMakePanImage(display,resource_info,windows,display_image);
+ XMakePanImage(display,resource_info,windows,display_image,
+ exception);
windows->pan.mapped=MagickTrue;
break;
}
XMakeStandardColormap(display,icon_visual,icon_resources,
display_image,icon_map,icon_pixel);
(void) XMakeImage(display,icon_resources,&windows->icon,
- display_image,windows->icon.width,windows->icon.height);
+ display_image,windows->icon.width,windows->icon.height,
+ exception);
display_image->taint=taint;
(void) XSetWindowBackgroundPixmap(display,windows->icon.id,
windows->icon.pixmap);
} while (!(*state & ExitState));
if ((*state & ExitState) == 0)
(void) XMagickCommand(display,resource_info,windows,FreeBuffersCommand,
- &display_image);
+ &display_image,exception);
else
if (resource_info->confirm_edit != MagickFalse)
{
else
if (status > 0)
(void) XMagickCommand(display,resource_info,windows,SaveCommand,
- &display_image);
+ &display_image,exception);
}
}
if ((windows->visual_info->klass == GrayScale) ||
% The format of the DisplayImages method is:
%
% MagickBooleanType DisplayImages(const ImageInfo *image_info,
-% Image *images)
+% Image *images,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
MagickExport MagickBooleanType DisplayImages(const ImageInfo *image_info,
- Image *image)
+ Image *image,ExceptionInfo *exception)
{
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (X11)",
- image->filename);
+ (void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
+ "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image->filename);
return(MagickFalse);
}
\f