% MagickCore Methods to Interactively Display and Edit an Image %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
*/
#include "MagickCore/studio.h"
#include "MagickCore/artifact.h"
+#include "MagickCore/attribute.h"
#include "MagickCore/blob.h"
#include "MagickCore/cache.h"
+#include "MagickCore/cache-private.h"
+#include "MagickCore/channel.h"
#include "MagickCore/client.h"
#include "MagickCore/color.h"
#include "MagickCore/colorspace.h"
#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"
#include "MagickCore/monitor.h"
#include "MagickCore/monitor-private.h"
#include "MagickCore/montage.h"
+#include "MagickCore/nt-base-private.h"
#include "MagickCore/option.h"
#include "MagickCore/paint.h"
#include "MagickCore/pixel.h"
#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"
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
/*
resource_info;
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
assert(images != (Image *) NULL);
- assert(images->signature == MagickSignature);
- if (images->debug != MagickFalse)
+ assert(images->signature == MagickCoreSignature);
+ if (IfMagickTrue(images->debug) )
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
display=XOpenDisplay(image_info->server_name);
if (display == (Display *) NULL)
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);
status;
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
assert(filename != (char *) NULL);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
display=XOpenDisplay(image_info->server_name);
%
*/
-static inline ssize_t MagickMax(const ssize_t x,const ssize_t y)
-{
- if (x > y)
- return(x);
- return(y);
-}
-
-static inline ssize_t MagickMin(const ssize_t x,const ssize_t y)
-{
- if (x < y)
- return(x);
- return(y);
-}
-
static MagickBooleanType XAnnotateEditImage(Display *display,
XResourceInfo *resource_info,XWindows *windows,Image *image,
ExceptionInfo *exception)
transparent_box = MagickTrue,
transparent_pen = MagickFalse;
- static MagickRealType
+ static double
degrees = 0.0;
static unsigned int
pen_id = 0;
char
- command[MaxTextExtent],
- text[MaxTextExtent];
+ command[MagickPathExtent],
+ text[MagickPathExtent];
const char
*ColorMenu[MaxNumberPens+1];
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+d%+d ",
x+windows->image.x,y+windows->image.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
if (font_number == (MaxNumberFonts-2))
{
static char
- font_name[MaxTextExtent] = "fixed";
+ font_name[MagickPathExtent] = "fixed";
/*
Select a font name from a browser.
break;
transparent_pen=pen_number == (MaxNumberPens-2) ? MagickTrue :
MagickFalse;
- if (transparent_pen != MagickFalse)
+ if (IfMagickTrue(transparent_pen) )
break;
if (pen_number == (MaxNumberPens-1))
{
static char
- color_name[MaxTextExtent] = "gray";
+ color_name[MagickPathExtent] = "gray";
/*
Select a pen color from a dialog.
break;
transparent_box=pen_number == (MaxNumberPens-2) ? MagickTrue :
MagickFalse;
- if (transparent_box != MagickFalse)
+ if (IfMagickTrue(transparent_box) )
break;
if (pen_number == (MaxNumberPens-1))
{
static char
- color_name[MaxTextExtent] = "gray";
+ color_name[MagickPathExtent] = "gray";
/*
Select a pen color from a dialog.
entry;
static char
- angle[MaxTextExtent] = "30.0";
+ angle[MagickPathExtent] = "30.0";
static const char
*RotateMenu[] =
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:
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
XGetAnnotateInfo(annotate_info);
annotate_info->x=x;
annotate_info->y=y;
- if ((transparent_box == MagickFalse) && (transparent_pen == MagickFalse))
+ if (IfMagickFalse(transparent_box) && IfMagickFalse(transparent_pen))
annotate_info->stencil=OpaqueStencil;
else
- if (transparent_box == MagickFalse)
+ if (IfMagickFalse(transparent_box) )
annotate_info->stencil=BackgroundStencil;
else
annotate_info->stencil=ForegroundStencil;
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
if (event.xselection.property == (Atom) None)
break;
status=XGetWindowProperty(display,event.xselection.requestor,
- event.xselection.property,0L,(long) MaxTextExtent,True,XA_STRING,
+ event.xselection.property,0L,(long) MagickPathExtent,True,XA_STRING,
&type,&format,&length,&after,&data);
if ((status != Success) || (type != XA_STRING) || (format == 32) ||
(length == 0))
width*(annotate_info->x+windows->image.x)/windows->image.ximage->width;
annotate_info->y=(int) height*(annotate_info->y-font_info->ascent+
windows->image.y)/windows->image.ximage->height;
- (void) FormatLocaleString(annotate_info->geometry,MaxTextExtent,
+ (void) FormatLocaleString(annotate_info->geometry,MagickPathExtent,
"%ux%u%+d%+d",width*annotate_info->width/windows->image.ximage->width,
height*annotate_info->height/windows->image.ximage->height,
annotate_info->x+x,annotate_info->y+y);
/*
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);
/*
/*
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);
}
status;
static char
- window_id[MaxTextExtent] = "root";
+ window_id[MagickPathExtent] = "root";
XResourceInfo
background_resources;
background_resources.backdrop=status != 0 ? MagickTrue : MagickFalse;
status=XDisplayBackgroundImage(display,&background_resources,*image,
exception);
- if (status != MagickFalse)
+ if (IfMagickTrue(status))
XClientMessage(display,windows->image.id,windows->im_protocols,
windows->im_retain_colors,CurrentTime);
XSetCursorState(display,windows,MagickFalse);
};
char
- text[MaxTextExtent];
+ text[MagickPathExtent];
Image
*chop_image;
x,
y;
- MagickRealType
+ double
scale_factor;
RectangleInfo
(void) XSelectInput(display,windows->image.id,
windows->image.attributes.event_mask | PointerMotionMask);
state=DefaultState;
+ (void) ResetMagickMemory(&segment_info,0,sizeof(segment_info));
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+d%+d ",
x+windows->image.x,y+windows->image.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
case ChopDirectionCommand:
{
char
- command[MaxTextExtent];
+ command[MagickPathExtent];
static const char
*Directions[] =
case KeyPress:
{
char
- command[MaxTextExtent];
+ command[MagickPathExtent];
KeySym
key_symbol;
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
/*
Display info and draw chopping line.
*/
- if (windows->info.mapped == MagickFalse)
+ if (IfMagickFalse(windows->info.mapped) )
(void) XMapWindow(display,windows->info.id);
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
" %.20gx%.20g%+.20g%+.20g",(double) chop_info.width,(double)
chop_info.height,(double) chop_info.x,(double) chop_info.y);
XInfoWidget(display,windows,text);
windows->image.highlight_context,&segment_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
/*
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);
y=0;
if (windows->image.crop_geometry != (char *) NULL)
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,&width,&height);
- scale_factor=(MagickRealType) width/windows->image.ximage->width;
+ scale_factor=(double) width/windows->image.ximage->width;
chop_info.x+=x;
chop_info.x=(ssize_t) (scale_factor*chop_info.x+0.5);
chop_info.width=(unsigned int) (scale_factor*chop_info.width+0.5);
- scale_factor=(MagickRealType) height/windows->image.ximage->height;
+ scale_factor=(double) height/windows->image.ximage->height;
chop_info.y+=y;
chop_info.y=(ssize_t) (scale_factor*chop_info.y+0.5);
chop_info.height=(unsigned int) (scale_factor*chop_info.height+0.5);
/*
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);
}
border_color = { 0, 0, 0, 0, 0, 0 };
char
- command[MaxTextExtent],
- text[MaxTextExtent];
+ command[MagickPathExtent],
+ text[MagickPathExtent];
Cursor
cursor;
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+d%+d ",
x+windows->image.x,y+windows->image.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
if (pen_number == (MaxNumberPens-2))
{
static char
- color_name[MaxTextExtent] = "gray";
+ color_name[MagickPathExtent] = "gray";
/*
Select a pen color from a dialog.
if (pen_number == (MaxNumberPens-2))
{
static char
- color_name[MaxTextExtent] = "gray";
+ color_name[MagickPathExtent] = "gray";
/*
Select a pen color from a dialog.
case ColorEditFuzzCommand:
{
static char
- fuzz[MaxTextExtent];
+ fuzz[MagickPathExtent];
static const char
*FuzzMenu[] =
break;
if (entry != 5)
{
- (*image)->fuzz=SiPrefixToDouble(FuzzMenu[entry],1.0*
+ (*image)->fuzz=StringToDoubleInterval(FuzzMenu[entry],(double)
QuantumRange+1.0);
break;
}
- (void) (void) CopyMagickString(fuzz,"20%",MaxTextExtent);
+ (void) (void) CopyMagickString(fuzz,"20%",MagickPathExtent);
(void) XDialogWidget(display,windows,"Ok",
"Enter fuzz factor (0.0 - 99.9%):",fuzz);
if (*fuzz == '\0')
break;
- (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent);
- (*image)->fuzz=SiPrefixToDouble(fuzz,1.0*QuantumRange+1.0);
+ (void) ConcatenateMagickString(fuzz,"%",MagickPathExtent);
+ (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+
+ 1.0);
break;
}
case ColorEditUndoCommand:
*/
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);
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
if ((x_offset >= (int) (*image)->columns) ||
(y_offset >= (int) (*image)->rows))
continue;
- image_view=AcquireCacheView(*image);
+ image_view=AcquireAuthenticCacheView(*image,exception);
switch (method)
{
case PointMethod:
/*
Update color information using point algorithm.
*/
- if (SetImageStorageClass(*image,DirectClass,exception) == MagickFalse)
+ if (IfMagickFalse(SetImageStorageClass(*image,DirectClass,exception)) )
return(MagickFalse);
q=GetCacheViewAuthenticPixels(image_view,(ssize_t)x_offset,
(ssize_t) y_offset,1,1,exception);
}
case ReplaceMethod:
{
- PixelPacket
+ PixelInfo
pixel,
target;
/*
Update color information using replace algorithm.
*/
- (void) GetOneCacheViewVirtualPixel(image_view,(ssize_t) x_offset,
- (ssize_t) y_offset,&target,exception);
+ (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++)
break;
for (x=0; x < (int) (*image)->columns; x++)
{
- GetPixelPacket(*image,q,&pixel);
- if (IsFuzzyEquivalencePixelPacket(*image,&pixel,&target))
+ GetPixelInfoPixel(*image,q,&pixel);
+ if (IsFuzzyEquivalencePixelInfo(&pixel,&target))
{
SetPixelRed(*image,ScaleShortToQuantum(
color.red),q);
}
q+=GetPixelChannels(*image);
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (IfMagickFalse(SyncCacheViewAuthenticPixels(image_view,exception)) )
break;
}
}
else
{
for (i=0; i < (ssize_t) (*image)->colors; i++)
- if (IsFuzzyEquivalencePixelPacket(*image,(*image)->colormap+i,&target))
+ 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);
+ (void) SyncImage(*image,exception);
}
break;
}
/*
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)
+ target.red=(double)
ScaleShortToQuantum(border_color.red);
- target.green=(MagickRealType)
+ target.green=(double)
ScaleShortToQuantum(border_color.green);
- target.blue=(MagickRealType)
+ target.blue=(double)
ScaleShortToQuantum(border_color.blue);
}
draw_info=CloneDrawInfo(resource_info->image_info,
(DrawInfo *) NULL);
- (void) QueryColorDatabase(resource_info->pen_colors[pen_id],
- &draw_info->fill,exception);
- (void) FloodfillPaintImage(*image,draw_info,&target,(ssize_t)
- x_offset,(ssize_t) y_offset,method == FloodfillMethod ?
- MagickFalse : MagickTrue,exception);
+ (void) QueryColorCompliance(resource_info->pen_colors[pen_id],
+ AllCompliance,&draw_info->fill,exception);
+ (void) FloodfillPaintImage(*image,draw_info,&target,
+ (ssize_t)x_offset,(ssize_t)y_offset,
+ method != FloodfillMethod ? MagickTrue : MagickFalse,exception);
draw_info=DestroyDrawInfo(draw_info);
break;
}
/*
Update color information using reset algorithm.
*/
- if (SetImageStorageClass(*image,DirectClass,exception) == MagickFalse)
+ if (IfMagickFalse(SetImageStorageClass(*image,DirectClass,exception)) )
return(MagickFalse);
for (y=0; y < (int) (*image)->rows; y++)
{
SetPixelBlue(*image,ScaleShortToQuantum(color.blue),q);
q+=GetPixelChannels(*image);
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (IfMagickFalse(SyncCacheViewAuthenticPixels(image_view,exception)) )
break;
}
break;
ExceptionInfo *exception)
{
static char
- displacement_geometry[MaxTextExtent] = "30x30",
- filename[MaxTextExtent] = "\0";
+ displacement_geometry[MagickPathExtent] = "30x30",
+ filename[MagickPathExtent] = "\0";
static const char
*CompositeMenu[] =
};
char
- text[MaxTextExtent];
+ text[MagickPathExtent];
Cursor
cursor;
x,
y;
- MagickRealType
+ double
blend,
scale_factor;
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) CopyMagickString(resource_info->image_info->filename,filename,
- MaxTextExtent);
+ MagickPathExtent);
composite_image=ReadImage(resource_info->image_info,exception);
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+ld%+ld ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+ld%+ld ",
(long) composite_info.x,(long) composite_info.y);
XInfoWidget(display,windows,text);
}
/*
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)
case CompositeOperatorsCommand:
{
char
- command[MaxTextExtent],
+ command[MagickPathExtent],
**operators;
/*
case CompositeDissolveCommand:
{
static char
- factor[MaxTextExtent] = "20.0";
+ factor[MagickPathExtent] = "20.0";
/*
Dissolve the two images a given percent.
GXinvert);
if (*factor == '\0')
break;
- blend=InterpretLocaleValue(factor,(char **) NULL);
+ blend=StringToDouble(factor,(char **) NULL);
compose=DissolveCompositeOp;
break;
}
{
case ButtonPress:
{
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Button Press: 0x%lx %u +%d+%d",event.xbutton.window,
event.xbutton.button,event.xbutton.x,event.xbutton.y);
}
case ButtonRelease:
{
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Button Release: 0x%lx %u +%d+%d",event.xbutton.window,
event.xbutton.button,event.xbutton.x,event.xbutton.y);
case KeyPress:
{
char
- command[MaxTextExtent];
+ command[MagickPathExtent];
KeySym
key_symbol;
length=XLookupString((XKeyEvent *) &event.xkey,command,(int)
sizeof(command),&key_symbol,(XComposeStatus *) NULL);
*(command+length)='\0';
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Key press: 0x%lx (%s)",(unsigned long) key_symbol,command);
switch ((int) key_symbol)
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
}
default:
{
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Event type: %d",
event.type);
break;
y=0;
if (windows->image.crop_geometry != (char *) NULL)
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,&width,&height);
- scale_factor=(MagickRealType) width/windows->image.ximage->width;
+ scale_factor=(double) width/windows->image.ximage->width;
composite_info.x+=x;
composite_info.x=(ssize_t) (scale_factor*composite_info.x+0.5);
composite_info.width=(unsigned int) (scale_factor*composite_info.width+0.5);
- scale_factor=(MagickRealType) height/windows->image.ximage->height;
+ scale_factor=(double) height/windows->image.ximage->height;
composite_info.y+=y;
composite_info.y=(ssize_t) (scale_factor*composite_info.y+0.5);
composite_info.height=(unsigned int) (scale_factor*composite_info.height+0.5);
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)
{
Create mattes for blending.
*/
(void) SetImageAlphaChannel(composite_image,OpaqueAlphaChannel,exception);
- opacity=(Quantum) (ScaleQuantumToChar((Quantum) QuantumRange)-
- ((ssize_t) ScaleQuantumToChar((Quantum) QuantumRange)*blend)/100);
- if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
+ opacity=(Quantum) (ScaleQuantumToChar(QuantumRange)-
+ ((ssize_t) ScaleQuantumToChar(QuantumRange)*blend)/100);
+ if (IfMagickFalse(SetImageStorageClass(image,DirectClass,exception)) )
return(MagickFalse);
- image->matte=MagickTrue;
- image_view=AcquireCacheView(image);
+ image->alpha_trait=BlendPixelTrait;
+ image_view=AcquireAuthenticCacheView(image,exception);
for (y=0; y < (int) image->rows; y++)
{
q=GetCacheViewAuthenticPixels(image_view,0,(ssize_t) y,image->columns,1,
SetPixelAlpha(image,opacity,q);
q+=GetPixelChannels(image);
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (IfMagickFalse(SyncCacheViewAuthenticPixels(image_view,exception)) )
break;
}
image_view=DestroyCacheView(image_view);
/*
Composite image with X Image window.
*/
- (void) CompositeImage(image,compose,composite_image,composite_info.x,
- composite_info.y);
+ (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);
}
ExceptionInfo *exception)
{
char
- geometry[MaxTextExtent];
+ geometry[MagickPathExtent];
MagickStatusType
status;
*/
width=(unsigned int) windows->image.window_changes.width;
height=(unsigned int) windows->image.window_changes.height;
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Configure Image: %dx%d=>%.20gx%.20g",windows->image.ximage->width,
windows->image.ximage->height,(double) width,(double) height);
(height*windows->image.y/windows->image.ximage->height);
status=XMakeImage(display,resource_info,&windows->image,image,
(unsigned int) width,(unsigned int) height,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
XNoticeWidget(display,windows,"Unable to configure X image:",
windows->image.name);
/*
Notify window manager of the new configuration.
*/
if (resource_info->image_geometry != (char *) NULL)
- (void) FormatLocaleString(geometry,MaxTextExtent,"%s>!",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%s>!",
resource_info->image_geometry);
else
- (void) FormatLocaleString(geometry,MaxTextExtent,"%ux%u+0+0>!",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%ux%u+0+0>!",
XDisplayWidth(display,windows->image.screen),
XDisplayHeight(display,windows->image.screen));
(void) ParseMetaGeometry(geometry,&x,&y,&width,&height);
/*
Update Magnify window configuration.
*/
- if (windows->magnify.mapped != MagickFalse)
- XMakeMagnifyImage(display,windows);
+ if (IfMagickTrue(windows->magnify.mapped) )
+ XMakeMagnifyImage(display,windows,exception);
windows->pan.crop_geometry=windows->image.crop_geometry;
XBestIconSize(display,&windows->pan,image);
while (((windows->pan.width << 1) < MaxIconSize) &&
*image_view;
char
- command[MaxTextExtent],
- text[MaxTextExtent];
+ command[MagickPathExtent],
+ text[MagickPathExtent];
Cursor
cursor;
Image
*crop_image;
- MagickRealType
+ double
scale_factor;
RectangleInfo
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+ld%+ld ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+ld%+ld ",
(long) crop_info.x,(long) crop_info.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
/*
Display info and draw cropping rectangle.
*/
- if (windows->info.mapped == MagickFalse)
+ if (IfMagickFalse(windows->info.mapped) )
(void) XMapWindow(display,windows->info.id);
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
" %.20gx%.20g%+.20g%+.20g",(double) crop_info.width,(double)
crop_info.height,(double) crop_info.x,(double) crop_info.y);
XInfoWidget(display,windows,text);
windows->image.highlight_context,&highlight_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
/*
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);
(void) XMapWindow(display,windows->info.id);
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
" %.20gx%.20g%+.20g%+.20g",(double) crop_info.width,(double)
crop_info.height,(double) crop_info.x,(double) crop_info.y);
XInfoWidget(display,windows,text);
}
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)
{
/*
case XK_Home:
case XK_KP_Home:
{
- crop_info.x=(ssize_t) (windows->image.width/2L-
- crop_info.width/2L);
- crop_info.y=(ssize_t) (windows->image.height/2L-
- crop_info.height/2L);
+ crop_info.x=(ssize_t) (windows->image.width/2L-crop_info.width/
+ 2L);
+ crop_info.y=(ssize_t) (windows->image.height/2L-crop_info.height/
+ 2L);
break;
}
case XK_Left:
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
/*
Set primary selection.
*/
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",(double) crop_info.width,(double)
crop_info.height,(double) crop_info.x,(double) crop_info.y);
request=(&(event.xselectionrequest));
y=0;
if (windows->image.crop_geometry != (char *) NULL)
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,&width,&height);
- scale_factor=(MagickRealType) width/windows->image.ximage->width;
+ scale_factor=(double) width/windows->image.ximage->width;
crop_info.x+=x;
crop_info.x=(ssize_t) (scale_factor*crop_info.x+0.5);
crop_info.width=(unsigned int) (scale_factor*crop_info.width+0.5);
- scale_factor=(MagickRealType) height/windows->image.ximage->height;
+ scale_factor=(double) height/windows->image.ximage->height;
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);
/*
Cut image.
*/
- if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
+ if (IfMagickFalse(SetImageStorageClass(image,DirectClass,exception)) )
return(MagickFalse);
- image->matte=MagickTrue;
- image_view=AcquireCacheView(image);
+ image->alpha_trait=BlendPixelTrait;
+ image_view=AcquireAuthenticCacheView(image,exception);
for (y=0; y < (int) crop_info.height; y++)
{
q=GetCacheViewAuthenticPixels(image_view,crop_info.x,y+crop_info.y,
SetPixelAlpha(image,TransparentAlpha,q);
q+=GetPixelChannels(image);
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (IfMagickFalse(SyncCacheViewAuthenticPixels(image_view,exception)) )
break;
}
image_view=DestroyCacheView(image_view);
/*
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);
}
line_width = 1;
char
- command[MaxTextExtent],
- text[MaxTextExtent];
+ command[MagickPathExtent],
+ text[MagickPathExtent];
Cursor
cursor;
x,
y;
- MagickRealType
+ double
degrees;
MagickStatusType
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+d%+d ",
x+windows->image.x,y+windows->image.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
break;
transparent=pen_number == (MaxNumberPens-2) ? MagickTrue :
MagickFalse;
- if (transparent != MagickFalse)
+ if (IfMagickTrue(transparent) )
{
draw_info.stencil=TransparentStencil;
break;
if (pen_number == (MaxNumberPens-1))
{
static char
- color_name[MaxTextExtent] = "gray";
+ color_name[MagickPathExtent] = "gray";
/*
Select a pen color from a dialog.
status;
static char
- filename[MaxTextExtent] = "\0";
+ filename[MagickPathExtent] = "\0";
static const char
*StipplesMenu[] =
XCheckRefreshWindows(display,windows);
image_info=AcquireImageInfo();
(void) CopyMagickString(image_info->filename,filename,
- MaxTextExtent);
+ MagickPathExtent);
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,
+ (void) FormatLocaleString(stipple_image->filename,MagickPathExtent,
"xbm:%s",filename);
(void) WriteImage(image_info,stipple_image,exception);
stipple_image=DestroyImage(stipple_image);
case DrawWidthCommand:
{
static char
- width[MaxTextExtent] = "0";
+ width[MagickPathExtent] = "0";
static const char
*WidthsMenu[] =
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
(void) XDrawLines(display,windows->image.id,
windows->image.highlight_context,coordinate_info,
number_coordinates,CoordModeOrigin);
- (void) FormatLocaleString(text,MaxTextExtent," %+d%+d",
+ (void) FormatLocaleString(text,MagickPathExtent," %+d%+d",
coordinate_info[number_coordinates-1].x,
coordinate_info[number_coordinates-1].y);
XInfoWidget(display,windows,text);
*/
degrees=RadiansToDegrees(-atan2((double) (line_info.y2-
line_info.y1),(double) (line_info.x2-line_info.x1)));
- (void) FormatLocaleString(text,MaxTextExtent," %g",
+ (void) FormatLocaleString(text,MagickPathExtent," %g",
(double) degrees);
XInfoWidget(display,windows,text);
XHighlightLine(display,windows->image.id,
windows->image.highlight_context,&line_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,
windows->info.screen);
break;
/*
Display info and draw drawing rectangle.
*/
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
" %.20gx%.20g%+.20g%+.20g",(double) rectangle_info.width,
(double) rectangle_info.height,(double) rectangle_info.x,
(double) rectangle_info.y);
windows->image.highlight_context,&rectangle_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,
windows->info.screen);
break;
/*
Display info and draw drawing rectangle.
*/
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
" %.20gx%.20g%+.20g%+.20g",(double) rectangle_info.width,
(double) rectangle_info.height,(double) rectangle_info.x,
(double) rectangle_info.y);
windows->image.highlight_context,&rectangle_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,
windows->info.screen);
break;
*/
degrees=RadiansToDegrees(-atan2((double) (line_info.y2-
line_info.y1),(double) (line_info.x2-line_info.x1)));
- (void) FormatLocaleString(text,MaxTextExtent," %g",
+ (void) FormatLocaleString(text,MagickPathExtent," %g",
(double) degrees);
XInfoWidget(display,windows,text);
XHighlightLine(display,windows->image.id,
windows->image.highlight_context,&line_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,
windows->info.screen);
break;
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
switch (element)
{
case PointElement:
draw_info.height=(unsigned int) rectangle_info.height+(line_width << 1);
if (draw_info.height > (unsigned int) (*image)->rows)
draw_info.height=(unsigned int) (*image)->rows;
- (void) FormatLocaleString(draw_info.geometry,MaxTextExtent,"%ux%u%+d%+d",
+ (void) FormatLocaleString(draw_info.geometry,MagickPathExtent,"%ux%u%+d%+d",
width*draw_info.width/windows->image.ximage->width,
height*draw_info.height/windows->image.ximage->height,
draw_info.x+x,draw_info.y+y);
*/
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);
*/
static void XDrawPanRectangle(Display *display,XWindows *windows)
{
- MagickRealType
+ double
scale_factor;
RectangleInfo
/*
Determine dimensions of the panning rectangle.
*/
- scale_factor=(MagickRealType) windows->pan.width/windows->image.ximage->width;
+ scale_factor=(double) windows->pan.width/windows->image.ximage->width;
highlight_info.x=(ssize_t) (scale_factor*windows->image.x+0.5);
highlight_info.width=(unsigned int) (scale_factor*windows->image.width+0.5);
- scale_factor=(MagickRealType)
+ scale_factor=(double)
windows->pan.height/windows->image.ximage->height;
highlight_info.y=(ssize_t) (scale_factor*windows->image.y+0.5);
highlight_info.height=(unsigned int) (scale_factor*windows->image.height+0.5);
case UndoCommand:
{
char
- image_geometry[MaxTextExtent];
+ image_geometry[MagickPathExtent];
/*
Undo the last image transformation.
undo_image=GetPreviousImageInList(undo_image);
windows->image.window_changes.width=(int) cache_image->columns;
windows->image.window_changes.height=(int) cache_image->rows;
- (void) FormatLocaleString(image_geometry,MaxTextExtent,"%dx%d!",
+ (void) FormatLocaleString(image_geometry,MagickPathExtent,"%dx%d!",
windows->image.ximage->width,windows->image.ximage->height);
- (void) TransformImage(image,windows->image.crop_geometry,image_geometry);
+ (void) TransformImage(image,windows->image.crop_geometry,image_geometry,
+ exception);
if (windows->image.crop_geometry != (char *) NULL)
- windows->image.crop_geometry=(char *)
- RelinquishMagickMemory(windows->image.crop_geometry);
+ windows->image.crop_geometry=(char *) RelinquishMagickMemory(
+ windows->image.crop_geometry);
windows->image.crop_geometry=cache_image->geometry;
if (redo_image != (Image *) NULL)
redo_image=DestroyImage(redo_image);
redo_image=(*image);
*image=cache_image->list;
cache_image=DestroyImage(cache_image);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
return;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
return;
}
ssize_t
bytes;
- bytes=(ssize_t) ((*image)->columns*(*image)->rows*sizeof(PixelPacket));
+ bytes=(ssize_t) ((*image)->columns*(*image)->rows*sizeof(PixelInfo));
if (undo_image != (Image *) NULL)
{
/*
while (previous_image != (Image *) NULL)
{
bytes+=previous_image->list->columns*previous_image->list->rows*
- sizeof(PixelPacket);
+ sizeof(PixelInfo);
if (bytes <= (ssize_t) (resource_info->undo_cache << 20))
{
previous_image=GetPreviousImageInList(previous_image);
continue;
}
bytes-=previous_image->list->columns*previous_image->list->rows*
- sizeof(PixelPacket);
+ sizeof(PixelInfo);
if (previous_image == undo_image)
undo_image=NewImageList();
else
/*
Save image before transformations are applied.
*/
- cache_image=AcquireImage((ImageInfo *) NULL);
+ cache_image=AcquireImage((ImageInfo *) NULL,exception);
if (cache_image == (Image *) NULL)
break;
XSetCursorState(display,windows,MagickTrue);
{
cache_image->geometry=AcquireString((char *) NULL);
(void) CopyMagickString(cache_image->geometry,
- windows->image.crop_geometry,MaxTextExtent);
+ windows->image.crop_geometry,MagickPathExtent);
}
if (undo_image == (Image *) NULL)
{
*image=DestroyImage(*image);
*image=redo_image;
redo_image=NewImageList();
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
return;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
return;
}
*/
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
KeySym key_symbol,Image **image,ExceptionInfo *exception)
{
static char
- delta[MaxTextExtent] = "";
+ delta[MagickPathExtent] = "";
static const char
Digits[] = "01234567890";
ExceptionInfo *exception)
{
char
- filename[MaxTextExtent],
- geometry[MaxTextExtent],
- modulate_factors[MaxTextExtent];
+ filename[MagickPathExtent],
+ geometry[MagickPathExtent],
+ modulate_factors[MagickPathExtent];
GeometryInfo
geometry_info;
i;
static char
- color[MaxTextExtent] = "gray";
+ color[MagickPathExtent] = "gray";
unsigned int
height,
/*
Select image.
*/
+ if (*resource_info->home_directory == '\0')
+ (void) CopyMagickString(resource_info->home_directory,".",
+ MagickPathExtent);
status=chdir(resource_info->home_directory);
if (status == -1)
(void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
Save image.
*/
status=XSaveImage(display,resource_info,windows,*image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
- XNoticeWidget(display,windows,"Unable to write X image:",
- (*image)->filename);
+ char
+ message[MagickPathExtent];
+
+ (void) FormatLocaleString(message,MagickPathExtent,"%s:%s",
+ exception->reason != (char *) NULL ? exception->reason : "",
+ exception->description != (char *) NULL ? exception->description :
+ "");
+ XNoticeWidget(display,windows,"Unable to save file:",message);
break;
}
break;
Print image.
*/
status=XPrintImage(display,resource_info,windows,*image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
- XNoticeWidget(display,windows,"Unable to print X image:",
- (*image)->filename);
+ char
+ message[MagickPathExtent];
+
+ (void) FormatLocaleString(message,MagickPathExtent,"%s:%s",
+ exception->reason != (char *) NULL ? exception->reason : "",
+ exception->description != (char *) NULL ? exception->description :
+ "");
+ XNoticeWidget(display,windows,"Unable to print file:",message);
break;
}
break;
case DeleteCommand:
{
static char
- filename[MaxTextExtent] = "\0";
+ filename[MagickPathExtent] = "\0";
/*
Delete image file.
XFileBrowserWidget(display,windows,"Delete",filename);
if (*filename == '\0')
break;
- status=remove(filename) != 0 ? MagickTrue : MagickFalse;
- if (status != MagickFalse)
+ status=ShredFile(filename);
+ if (IfMagickTrue(status) )
XNoticeWidget(display,windows,"Unable to delete image file:",filename);
break;
}
status;
static char
- color[MaxTextExtent] = "gray",
- geometry[MaxTextExtent] = "640x480";
+ color[MagickPathExtent] = "gray",
+ geometry[MagickPathExtent] = "640x480";
static const char
*format = "gradient";
/*
Create canvas.
*/
- (void) FormatLocaleString(image_info->filename,MaxTextExtent,
+ (void) FormatLocaleString(image_info->filename,MagickPathExtent,
"%s:%s",format,color);
(void) CloneString(&image_info->size,geometry);
nexus=ReadImage(image_info,exception);
/*
exit program.
*/
- if (resource_info->confirm_exit == MagickFalse)
+ if (IfMagickFalse(resource_info->confirm_exit) )
XClientMessage(display,windows->image.id,windows->im_protocols,
windows->im_exit,CurrentTime);
else
Paste image.
*/
status=XPasteImage(display,resource_info,windows,*image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to paste X image",
(*image)->filename);
height=(size_t) windows->image.ximage->height;
x=0;
y=0;
- (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g+0+0",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g+0+0",
(double) width,(double) height);
status=XDialogWidget(display,windows,"Resize",
"Enter resize geometry (e.g. 640x480, 200%):",geometry);
if (*geometry == '\0')
break;
if (status == 0)
- (void) ConcatenateMagickString(geometry,"!",MaxTextExtent);
+ (void) ConcatenateMagickString(geometry,"!",MagickPathExtent);
(void) ParseMetaGeometry(geometry,&x,&y,&width,&height);
windows->image.window_changes.width=(int) width;
windows->image.window_changes.height=(int) height;
case ApplyCommand:
{
char
- image_geometry[MaxTextExtent];
+ image_geometry[MagickPathExtent];
if ((windows->image.crop_geometry == (char *) NULL) &&
((int) (*image)->columns == windows->image.ximage->width) &&
/*
Crop and/or scale displayed image.
*/
- (void) FormatLocaleString(image_geometry,MaxTextExtent,"%dx%d!",
+ (void) FormatLocaleString(image_geometry,MagickPathExtent,"%dx%d!",
windows->image.ximage->width,windows->image.ximage->height);
- (void) TransformImage(image,windows->image.crop_geometry,image_geometry);
+ (void) TransformImage(image,windows->image.crop_geometry,image_geometry,
+ exception);
if (windows->image.crop_geometry != (char *) NULL)
- windows->image.crop_geometry=(char *)
- RelinquishMagickMemory(windows->image.crop_geometry);
+ windows->image.crop_geometry=(char *) RelinquishMagickMemory(
+ 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;
}
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;
}
Chop image.
*/
status=XChopImage(display,resource_info,windows,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to cut X image",
(*image)->filename);
height=(unsigned int) (*image)->rows;
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,
&width,&height);
- (void) FormatLocaleString(windows->image.crop_geometry,MaxTextExtent,
+ (void) FormatLocaleString(windows->image.crop_geometry,MagickPathExtent,
"%ux%u%+d%+d",width,height,(int) (*image)->columns-(int) width-x,y);
}
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
height=(unsigned int) (*image)->rows;
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,
&width,&height);
- (void) FormatLocaleString(windows->image.crop_geometry,MaxTextExtent,
+ (void) FormatLocaleString(windows->image.crop_geometry,MagickPathExtent,
"%ux%u%+d%+d",width,height,x,(int) (*image)->rows-(int) height-y);
}
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
Rotate image 90 degrees clockwise.
*/
status=XRotateImage(display,resource_info,windows,90.0,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to rotate X image",
(*image)->filename);
Rotate image 90 degrees counter-clockwise.
*/
status=XRotateImage(display,resource_info,windows,-90.0,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to rotate X image",
(*image)->filename);
Rotate image.
*/
status=XRotateImage(display,resource_info,windows,0.0,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to rotate X image",
(*image)->filename);
*shear_image;
static char
- geometry[MaxTextExtent] = "45.0x45.0";
+ geometry[MagickPathExtent] = "45.0x45.0";
/*
Query user for shear color and geometry.
exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) QueryColorDatabase(color,&(*image)->background_color,
- exception);
+ (void) QueryColorCompliance(color,AllCompliance,
+ &(*image)->background_color,exception);
flags=ParseGeometry(geometry,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=geometry_info.rho;
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
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;
}
*roll_image;
static char
- geometry[MaxTextExtent] = "+2+2";
+ geometry[MagickPathExtent] = "+2+2";
/*
Query user for the roll geometry.
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
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;
}
case TrimCommand:
{
static char
- fuzz[MaxTextExtent];
+ fuzz[MagickPathExtent];
/*
Query user for the fuzz factor.
*/
- (void) FormatLocaleString(fuzz,MaxTextExtent,"%g%%",100.0*
+ (void) FormatLocaleString(fuzz,MagickPathExtent,"%g%%",100.0*
(*image)->fuzz/(QuantumRange+1.0));
(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.
*/
status=XTrimImage(display,resource_info,windows,*image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to trim X image",
(*image)->filename);
case HueCommand:
{
static char
- hue_percent[MaxTextExtent] = "110";
+ hue_percent[MagickPathExtent] = "110";
/*
Query user for percent hue change.
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) CopyMagickString(modulate_factors,"100.0/100.0/",MaxTextExtent);
+ (void) CopyMagickString(modulate_factors,"100.0/100.0/",MagickPathExtent);
(void) ConcatenateMagickString(modulate_factors,hue_percent,
- MaxTextExtent);
+ MagickPathExtent);
(void) ModulateImage(*image,modulate_factors,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SaturationCommand:
{
static char
- saturation_percent[MaxTextExtent] = "110";
+ saturation_percent[MagickPathExtent] = "110";
/*
Query user for percent saturation change.
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) CopyMagickString(modulate_factors,"100.0/",MaxTextExtent);
+ (void) CopyMagickString(modulate_factors,"100.0/",MagickPathExtent);
(void) ConcatenateMagickString(modulate_factors,saturation_percent,
- MaxTextExtent);
+ MagickPathExtent);
(void) ModulateImage(*image,modulate_factors,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case BrightnessCommand:
{
static char
- brightness_percent[MaxTextExtent] = "110";
+ brightness_percent[MagickPathExtent] = "110";
/*
Query user for percent brightness change.
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) CopyMagickString(modulate_factors,brightness_percent,
- MaxTextExtent);
+ MagickPathExtent);
(void) ModulateImage(*image,modulate_factors,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case GammaCommand:
{
static char
- factor[MaxTextExtent] = "1.6";
+ factor[MagickPathExtent] = "1.6";
/*
Query user for gamma value.
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) GammaImage(*image,atof(factor),exception);
+ (void) GammaImage(*image,strtod(factor,(char **) NULL),exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
XCheckRefreshWindows(display,windows);
(void) ContrastImage(*image,MagickTrue,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
XCheckRefreshWindows(display,windows);
(void) ContrastImage(*image,MagickFalse,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
white_point;
static char
- levels[MaxTextExtent] = "1%";
+ levels[MagickPathExtent] = "1%";
/*
Query user for gamma value.
black_point*=(double) (*image)->columns*(*image)->rows/100.0;
white_point*=(double) (*image)->columns*(*image)->rows/100.0;
}
- white_point=(MagickRealType) (*image)->columns*(*image)->rows-white_point;
+ white_point=(double) (*image)->columns*(*image)->rows-white_point;
(void) ContrastStretchImage(*image,black_point,white_point,
exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
flags;
static char
- levels[MaxTextExtent] = "3x50%";
+ levels[MagickPathExtent] = "3x50%";
/*
Query user for gamma value.
(void) SigmoidalContrastImage(*image,MagickTrue,geometry_info.rho,
geometry_info.sigma,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
XCheckRefreshWindows(display,windows);
(void) NormalizeImage(*image,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
XCheckRefreshWindows(display,windows);
(void) EqualizeImage(*image,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
XCheckRefreshWindows(display,windows);
(void) NegateImage(*image,MagickFalse,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) SetImageType(*image,(*image)->matte == MagickFalse ?
- GrayscaleType : GrayscaleMatteType,exception);
+ (void) SetImageType(*image,(*image)->alpha_trait == UndefinedPixelTrait ?
+ GrayscaleType : GrayscaleAlphaType,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*affinity_image;
static char
- filename[MaxTextExtent] = "\0";
+ filename[MagickPathExtent] = "\0";
/*
Request image file name from user.
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
affinity_image=ReadImage(image_info,exception);
if (affinity_image != (Image *) NULL)
{
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
status;
static char
- colors[MaxTextExtent] = "256";
+ colors[MagickPathExtent] = "256";
/*
Query user for maximum number of colors.
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
quantize_info.number_colors=StringToUnsignedLong(colors);
- quantize_info.dither=status != 0 ? MagickTrue : MagickFalse;
+ quantize_info.dither_method=status != 0 ? RiemersmaDitherMethod :
+ NoDitherMethod;
(void) QuantizeImage(&quantize_info,*image,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*emboss_image;
static char
- radius[MaxTextExtent] = "0.0x1.0";
+ radius[MagickPathExtent] = "0.0x1.0";
/*
Query user for emboss radius.
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*noise_image;
static char
- radius[MaxTextExtent] = "0";
+ radius[MagickPathExtent] = "0";
/*
Query user for noise radius.
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*noise_image;
static char
- noise_type[MaxTextExtent] = "Gaussian";
+ noise_type[MagickPathExtent] = "Gaussian";
/*
Add noise to the image.
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
noise_image=AddNoiseImage(*image,(NoiseType) ParseCommandOption(
- MagickNoiseOptions,MagickFalse,noise_type),exception);
+ MagickNoiseOptions,MagickFalse,noise_type),1.0,exception);
if (noise_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*sharp_image;
static char
- radius[MaxTextExtent] = "0.0x1.0";
+ radius[MagickPathExtent] = "0.0x1.0";
/*
Query user for sharpen radius.
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*blur_image;
static char
- radius[MaxTextExtent] = "0.0x1.0";
+ radius[MagickPathExtent] = "0.0x1.0";
/*
Query user for blur radius.
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
threshold;
static char
- factor[MaxTextExtent] = "128";
+ factor[MagickPathExtent] = "128";
/*
Query user for threshold value.
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- threshold=SiPrefixToDouble(factor,QuantumRange);
- (void) BilevelImage(*image,threshold);
+ threshold=StringToDoubleInterval(factor,(double) QuantumRange+1.0);
+ (void) BilevelImage(*image,threshold,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*edge_image;
static char
- radius[MaxTextExtent] = "0";
+ radius[MagickPathExtent] = "0";
/*
Query user for edge factor.
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(radius,&geometry_info);
- edge_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
- exception);
+ edge_image=EdgeImage(*image,geometry_info.rho,exception);
if (edge_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*spread_image;
static char
- amount[MaxTextExtent] = "2";
+ amount[MagickPathExtent] = "2";
/*
Query user for spread amount.
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(amount,&geometry_info);
- spread_image=EdgeImage(*image,geometry_info.rho,geometry_info.sigma,
- exception);
+ spread_image=EdgeImage(*image,geometry_info.rho,exception);
if (spread_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
status;
static char
- geometry[MaxTextExtent] = "30x30";
+ geometry[MagickPathExtent] = "30x30";
/*
Query user for the shade geometry.
flags=ParseGeometry(geometry,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
- shade_image=ShadeImage(*image,status != 0 ? MagickFalse : MagickTrue,
+ shade_image=ShadeImage(*image,status != 0 ? MagickTrue : MagickFalse,
geometry_info.rho,geometry_info.sigma,exception);
if (shade_image != (Image *) NULL)
{
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case RaiseCommand:
{
static char
- bevel_width[MaxTextExtent] = "10";
+ bevel_width[MagickPathExtent] = "10";
/*
Query user for bevel width.
exception);
(void) RaiseImage(*image,&page_geometry,MagickTrue,exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
case SegmentCommand:
{
static char
- threshold[MaxTextExtent] = "1.0x1.5";
+ threshold[MagickPathExtent] = "1.0x1.5";
/*
Query user for smoothing threshold.
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)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*sepia_image;
static char
- factor[MaxTextExtent] = "80%";
+ factor[MagickPathExtent] = "80%";
/*
Query user for sepia-tone factor.
*/
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)
{
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
threshold;
static char
- factor[MaxTextExtent] = "60%";
+ factor[MagickPathExtent] = "60%";
/*
Query user for solarize factor.
*/
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)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*swirl_image;
static char
- degrees[MaxTextExtent] = "60";
+ degrees[MagickPathExtent] = "60";
/*
Query user for swirl angle.
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(degrees,&geometry_info);
- swirl_image=SwirlImage(*image,geometry_info.rho,exception);
+ swirl_image=SwirlImage(*image,geometry_info.rho,(*image)->interpolate,
+ exception);
if (swirl_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*implode_image;
static char
- factor[MaxTextExtent] = "0.3";
+ factor[MagickPathExtent] = "0.3";
/*
Query user for implode factor.
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
flags=ParseGeometry(factor,&geometry_info);
- implode_image=ImplodeImage(*image,geometry_info.rho,exception);
+ implode_image=ImplodeImage(*image,geometry_info.rho,(*image)->interpolate,
+ exception);
if (implode_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*vignette_image;
static char
- geometry[MaxTextExtent] = "0x20";
+ geometry[MagickPathExtent] = "0x20";
/*
Query user for the vignette geometry.
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);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*wave_image;
static char
- geometry[MaxTextExtent] = "25x150";
+ geometry[MagickPathExtent] = "25x150";
/*
Query user for the wave geometry.
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
wave_image=WaveImage(*image,geometry_info.rho,geometry_info.sigma,
- exception);
+ (*image)->interpolate,exception);
if (wave_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*paint_image;
static char
- radius[MaxTextExtent] = "0";
+ radius[MagickPathExtent] = "0";
/*
Query user for circular neighborhood radius.
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
*charcoal_image;
static char
- radius[MaxTextExtent] = "0x1";
+ radius[MagickPathExtent] = "0x1";
/*
Query user for charcoal radius.
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
break;
- XConfigureImageColormap(display,resource_info,windows,*image);
+ XConfigureImageColormap(display,resource_info,windows,*image,exception);
(void) XConfigureImage(display,resource_info,windows,*image,exception);
break;
}
Annotate the image with text.
*/
status=XAnnotateEditImage(display,resource_info,windows,*image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to annotate X image",
(*image)->filename);
Draw image.
*/
status=XDrawEditImage(display,resource_info,windows,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to draw on the X image",
(*image)->filename);
Color edit.
*/
status=XColorEditImage(display,resource_info,windows,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to pixel edit X image",
(*image)->filename);
Matte edit.
*/
status=XMatteEditImage(display,resource_info,windows,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to matte edit X image",
(*image)->filename);
*/
status=XCompositeImage(display,resource_info,windows,*image,
exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
{
XNoticeWidget(display,windows,"Unable to composite X image",
(*image)->filename);
*border_image;
static char
- geometry[MaxTextExtent] = "6x6";
+ geometry[MagickPathExtent] = "6x6";
/*
Query user for border color and geometry.
exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) QueryColorDatabase(color,&(*image)->border_color,
+ (void) QueryColorCompliance(color,AllCompliance,&(*image)->border_color,
exception);
(void) ParsePageGeometry(*image,geometry,&page_geometry,
exception);
- border_image=BorderImage(*image,&page_geometry,exception);
+ border_image=BorderImage(*image,&page_geometry,(*image)->compose,
+ exception);
if (border_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
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;
}
*frame_image;
static char
- geometry[MaxTextExtent] = "6x6";
+ geometry[MagickPathExtent] = "6x6";
/*
Query user for frame color and geometry.
exception);
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) QueryColorDatabase(color,&(*image)->matte_color,
+ (void) QueryColorCompliance(color,AllCompliance,&(*image)->matte_color,
exception);
(void) ParsePageGeometry(*image,geometry,&page_geometry,
exception);
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,exception);
+ frame_image=FrameImage(*image,&frame_info,(*image)->compose,exception);
if (frame_image != (Image *) NULL)
{
*image=DestroyImage(*image);
}
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
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;
}
if (unique_file == -1)
XNoticeWidget(display,windows,"Unable to edit image comment",
image_info->filename);
- value=GetImageProperty(*image,"comment");
+ value=GetImageProperty(*image,"comment",exception);
if (value == (char *) NULL)
unique_file=close(unique_file)-1;
else
XCheckRefreshWindows(display,windows);
status=InvokeDelegate(image_info,*image,"edit",(char *) NULL,
exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
XNoticeWidget(display,windows,"Unable to edit image comment",
(char *) NULL);
else
comment=FileToString(image_info->filename,~0UL,exception);
if (comment != (char *) NULL)
{
- (void) SetImageProperty(*image,"comment",comment);
+ (void) SetImageProperty(*image,"comment",comment,exception);
(*image)->taint=MagickTrue;
}
}
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
(void) AcquireUniqueFilename(filename);
- (void) FormatLocaleString((*image)->filename,MaxTextExtent,"launch:%s",
+ (void) FormatLocaleString((*image)->filename,MagickPathExtent,"launch:%s",
filename);
status=WriteImage(image_info,*image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
XNoticeWidget(display,windows,"Unable to launch image editor",
(char *) NULL);
else
/*
Zoom image.
*/
- if (windows->magnify.mapped != MagickFalse)
+ if (IfMagickTrue(windows->magnify.mapped) )
(void) XRaiseWindow(display,windows->magnify.id);
else
{
*preview_image;
static char
- preview_type[MaxTextExtent] = "Gamma";
+ preview_type[MagickPathExtent] = "Gamma";
/*
Select preview type from menu.
ParseCommandOption(MagickPreviewOptions,MagickFalse,preview_type);
image_info->group=(ssize_t) windows->image.id;
(void) DeleteImageProperty(*image,"label");
- (void) SetImageProperty(*image,"label","Preview");
+ (void) SetImageProperty(*image,"label","Preview",exception);
(void) AcquireUniqueFilename(filename);
- (void) FormatLocaleString((*image)->filename,MaxTextExtent,"preview:%s",
+ (void) FormatLocaleString((*image)->filename,MagickPathExtent,"preview:%s",
filename);
status=WriteImage(image_info,*image,exception);
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
preview_image=ReadImage(image_info,exception);
(void) RelinquishUniqueFileResource(filename);
if (preview_image == (Image *) NULL)
break;
- (void) FormatLocaleString(preview_image->filename,MaxTextExtent,"show:%s",
+ (void) FormatLocaleString(preview_image->filename,MagickPathExtent,"show:%s",
filename);
status=WriteImage(image_info,preview_image,exception);
preview_image=DestroyImage(preview_image);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
XNoticeWidget(display,windows,"Unable to show image preview",
(*image)->filename);
XDelay(display,1500);
XCheckRefreshWindows(display,windows);
image_info->group=(ssize_t) windows->image.id;
(void) DeleteImageProperty(*image,"label");
- (void) SetImageProperty(*image,"label","Histogram");
+ (void) SetImageProperty(*image,"label","Histogram",exception);
(void) AcquireUniqueFilename(filename);
- (void) FormatLocaleString((*image)->filename,MaxTextExtent,"histogram:%s",
+ (void) FormatLocaleString((*image)->filename,MagickPathExtent,"histogram:%s",
filename);
status=WriteImage(image_info,*image,exception);
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
histogram_image=ReadImage(image_info,exception);
(void) RelinquishUniqueFileResource(filename);
if (histogram_image == (Image *) NULL)
break;
- (void) FormatLocaleString(histogram_image->filename,MaxTextExtent,
+ (void) FormatLocaleString(histogram_image->filename,MagickPathExtent,
"show:%s",filename);
status=WriteImage(image_info,histogram_image,exception);
histogram_image=DestroyImage(histogram_image);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
XNoticeWidget(display,windows,"Unable to show histogram",
(*image)->filename);
XDelay(display,1500);
Image
*matte_image;
- if ((*image)->matte == MagickFalse)
+ if ((*image)->alpha_trait == UndefinedPixelTrait)
{
XNoticeWidget(display,windows,
"Image does not have any matte information",(*image)->filename);
XCheckRefreshWindows(display,windows);
image_info->group=(ssize_t) windows->image.id;
(void) DeleteImageProperty(*image,"label");
- (void) SetImageProperty(*image,"label","Matte");
+ (void) SetImageProperty(*image,"label","Matte",exception);
(void) AcquireUniqueFilename(filename);
- (void) FormatLocaleString((*image)->filename,MaxTextExtent,"matte:%s",
+ (void) FormatLocaleString((*image)->filename,MagickPathExtent,"matte:%s",
filename);
status=WriteImage(image_info,*image,exception);
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
matte_image=ReadImage(image_info,exception);
(void) RelinquishUniqueFileResource(filename);
if (matte_image == (Image *) NULL)
break;
- (void) FormatLocaleString(matte_image->filename,MaxTextExtent,"show:%s",
+ (void) FormatLocaleString(matte_image->filename,MagickPathExtent,"show:%s",
filename);
status=WriteImage(image_info,matte_image,exception);
matte_image=DestroyImage(matte_image);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
XNoticeWidget(display,windows,"Unable to show matte",
(*image)->filename);
XDelay(display,1500);
Background image.
*/
status=XBackgroundImage(display,resource_info,windows,image,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
break;
nexus=CloneImage(*image,0,0,MagickTrue,exception);
if (nexus != (Image *) NULL)
case SlideShowCommand:
{
static char
- delay[MaxTextExtent] = "5";
+ delay[MagickPathExtent] = "5";
/*
Display next image after pausing.
Set user preferences.
*/
status=XPreferencesWidget(display,resource_info,windows);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
break;
nexus=CloneImage(*image,0,0,MagickTrue,exception);
if (nexus != (Image *) NULL)
if (mozilla_window != (Window) NULL)
{
char
- command[MaxTextExtent],
+ command[MagickPathExtent],
*url;
/*
Display documentation using Netscape remote control.
*/
url=GetMagickHomeURL();
- (void) FormatLocaleString(command,MaxTextExtent,
+ (void) FormatLocaleString(command,MagickPathExtent,
"openurl(%s,new-tab)",url);
url=DestroyString(url);
mozilla_atom=XInternAtom(display,"_MOZILLA_COMMAND",MagickFalse);
XCheckRefreshWindows(display,windows);
status=InvokeDelegate(image_info,*image,"browse",(char *) NULL,
exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
XNoticeWidget(display,windows,"Unable to browse documentation",
(char *) NULL);
XDelay(display,1500);
%
% 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:
%
% 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];
+ text[MagickPathExtent];
register int
x,
/*
Map and unmap Info widget as text cursor crosses its boundaries.
*/
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
if ((x > (int) (windows->info.x+windows->info.width)) ||
(y > (int) (windows->info.y+windows->info.height)))
(void) XMapWindow(display,windows->info.id);
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+d%+d ",
windows->magnify.x,windows->magnify.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,event);
+ XScreenEvent(display,windows,event,exception);
switch (event->type)
{
case ButtonPress:
% 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:
%
% 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;
default:
break;
}
- XMakeMagnifyImage(display,windows);
+ XMakeMagnifyImage(display,windows,exception);
}
\f
/*
windows->pan.y=(int) windows->image.y;
status=XMakeImage(display,resource_info,&windows->pan,image,
windows->pan.width,windows->pan.height,exception);
- if (status == MagickFalse)
- ThrowXWindowFatalException(ResourceLimitError,
+ if (IfMagickFalse(status) )
+ ThrowXWindowException(ResourceLimitError,
"MemoryAllocationFailed",image->filename);
(void) XSetWindowBackgroundPixmap(display,windows->pan.id,
windows->pan.pixmap);
ExceptionInfo *exception)
{
static char
- matte[MaxTextExtent] = "0";
+ matte[MagickPathExtent] = "0";
static const char
*MatteEditMenu[] =
border_color = { 0, 0, 0, 0, 0, 0 };
char
- command[MaxTextExtent],
- text[MaxTextExtent];
+ command[MagickPathExtent],
+ text[MagickPathExtent];
Cursor
cursor;
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+d%+d ",
x+windows->image.x,y+windows->image.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
if (pen_number == (MaxNumberPens-2))
{
static char
- color_name[MaxTextExtent] = "gray";
+ color_name[MagickPathExtent] = "gray";
/*
Select a pen color from a dialog.
case MatteEditFuzzCommand:
{
static char
- fuzz[MaxTextExtent];
+ fuzz[MagickPathExtent];
static const char
*FuzzMenu[] =
break;
if (entry != 5)
{
- (*image)->fuzz=SiPrefixToDouble(FuzzMenu[entry],1.0*
+ (*image)->fuzz=StringToDoubleInterval(FuzzMenu[entry],(double)
QuantumRange+1.0);
break;
}
- (void) CopyMagickString(fuzz,"20%",MaxTextExtent);
+ (void) CopyMagickString(fuzz,"20%",MagickPathExtent);
(void) XDialogWidget(display,windows,"Ok",
"Enter fuzz factor (0.0 - 99.9%):",fuzz);
if (*fuzz == '\0')
break;
- (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent);
- (*image)->fuzz=SiPrefixToDouble(fuzz,1.0*QuantumRange+1.0);
+ (void) ConcatenateMagickString(fuzz,"%",MagickPathExtent);
+ (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+
+ 1.0);
break;
}
case MatteEditValueCommand:
{
static char
- message[MaxTextExtent];
+ message[MagickPathExtent];
static const char
*MatteMenu[] =
break;
if (entry != 2)
{
- (void) FormatLocaleString(matte,MaxTextExtent,QuantumFormat,
+ (void) FormatLocaleString(matte,MagickPathExtent,QuantumFormat,
OpaqueAlpha);
if (LocaleCompare(MatteMenu[entry],"Transparent") == 0)
- (void) FormatLocaleString(matte,MaxTextExtent,QuantumFormat,
+ (void) FormatLocaleString(matte,MagickPathExtent,QuantumFormat,
(Quantum) TransparentAlpha);
break;
}
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
"Enter matte value (0 - " QuantumFormat "):",(Quantum)
QuantumRange);
(void) XDialogWidget(display,windows,"Matte",message,matte);
*/
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);
case KeyPress:
{
char
- command[MaxTextExtent];
+ command[MagickPathExtent];
KeySym
key_symbol;
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
if ((x_offset >= (int) (*image)->columns) ||
(y_offset >= (int) (*image)->rows))
continue;
- if (SetImageStorageClass(*image,DirectClass,exception) == MagickFalse)
+ if (IfMagickFalse(SetImageStorageClass(*image,DirectClass,exception)) )
return(MagickFalse);
- (*image)->matte=MagickTrue;
- image_view=AcquireCacheView(*image);
+ if ((*image)->alpha_trait == UndefinedPixelTrait)
+ (void) SetImageAlphaChannel(*image,OpaqueAlphaChannel,exception);
+ image_view=AcquireAuthenticCacheView(*image,exception);
switch (method)
{
case PointMethod:
}
case ReplaceMethod:
{
- PixelPacket
+ PixelInfo
pixel,
target;
/*
Update matte information using replace algorithm.
*/
- (void) GetOneCacheViewVirtualPixel(image_view,(ssize_t) x_offset,
- (ssize_t) y_offset,&target,exception);
+ (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,
break;
for (x=0; x < (int) (*image)->columns; x++)
{
- GetPixelPacket(*image,q,&pixel);
- if (IsFuzzyEquivalencePixelPacket(*image,&pixel,&target))
+ GetPixelInfoPixel(*image,q,&pixel);
+ if (IsFuzzyEquivalencePixelInfo(&pixel,&target))
SetPixelAlpha(*image,(Quantum) StringToLong(matte),q);
q+=GetPixelChannels(*image);
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (IfMagickFalse(SyncCacheViewAuthenticPixels(image_view,exception)) )
break;
}
break;
/*
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(
+ target.red=(double) ScaleShortToQuantum(
border_color.red);
- target.green=(MagickRealType) ScaleShortToQuantum(
+ target.green=(double) ScaleShortToQuantum(
border_color.green);
- target.blue=(MagickRealType) ScaleShortToQuantum(
+ target.blue=(double) ScaleShortToQuantum(
border_color.blue);
}
draw_info=CloneDrawInfo(resource_info->image_info,
(DrawInfo *) NULL);
- draw_info->fill.alpha=ClampToQuantum(InterpretLocaleValue(matte,
- (char **) NULL));
- channel_mask=SetPixelChannelMask(*image,AlphaChannel);
+ draw_info->fill.alpha=(double) ClampToQuantum(
+ StringToDouble(matte,(char **) NULL));
+ channel_mask=SetImageChannelMask(*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);
+ x_offset,(ssize_t) y_offset,
+ method != FloodfillMethod ? MagickTrue : MagickFalse,exception);
+ (void) SetPixelChannelMask(*image,channel_mask);
draw_info=DestroyDrawInfo(draw_info);
break;
}
/*
Update matte information using reset algorithm.
*/
- if (SetImageStorageClass(*image,DirectClass,exception) == MagickFalse)
+ if (IfMagickFalse(SetImageStorageClass(*image,DirectClass,exception)) )
return(MagickFalse);
for (y=0; y < (int) (*image)->rows; y++)
{
SetPixelAlpha(*image,(Quantum) StringToLong(matte),q);
q+=GetPixelChannels(*image);
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (IfMagickFalse(SyncCacheViewAuthenticPixels(image_view,exception)) )
break;
}
if (StringToLong(matte) == (long) OpaqueAlpha)
- (*image)->matte=MagickFalse;
+ (*image)->alpha_trait=UndefinedPixelTrait;
break;
}
}
*image_info;
static char
- filename[MaxTextExtent] = "\0";
+ filename[MagickPathExtent] = "\0";
/*
Request file name from user.
*/
- if (command == MagickFalse)
+ if (IfMagickFalse(command) )
XFileBrowserWidget(display,windows,"Open",filename);
else
{
status=XGetCommand(display,windows->image.id,&files,&count);
if (status == 0)
{
- ThrowXWindowFatalException(XServerError,"UnableToGetProperty","...");
+ ThrowXWindowException(XServerError,"UnableToGetProperty","...");
return((Image *) NULL);
}
filelist=(char **) AcquireQuantumMemory((size_t) count,sizeof(*filelist));
if (filelist == (char **) NULL)
{
- ThrowXWindowFatalException(ResourceLimitError,
+ ThrowXWindowException(ResourceLimitError,
"MemoryAllocationFailed","...");
(void) XFreeStringList(files);
return((Image *) NULL);
image_info=CloneImageInfo(resource_info->image_info);
(void) SetImageInfoProgressMonitor(image_info,(MagickProgressMonitor) NULL,
(void *) NULL);
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
exception=AcquireExceptionInfo();
(void) SetImageInfo(image_info,0,exception);
if (LocaleCompare(image_info->magick,"X") == 0)
{
char
- seconds[MaxTextExtent];
+ seconds[MagickPathExtent];
/*
User may want to delay the X server screen grab.
*/
- (void) CopyMagickString(seconds,"0",MaxTextExtent);
+ (void) CopyMagickString(seconds,"0",MagickPathExtent);
(void) XDialogWidget(display,windows,"Grab","Enter any delay in seconds:",
seconds);
if (*seconds == '\0')
}
magick_info=GetMagickInfo(image_info->magick,exception);
if ((magick_info != (const MagickInfo *) NULL) &&
- (magick_info->raw != MagickFalse))
+ GetMagickRawSupport(magick_info) == MagickTrue)
{
char
- geometry[MaxTextExtent];
+ geometry[MagickPathExtent];
/*
Request image size from the user.
*/
- (void) CopyMagickString(geometry,"512x512",MaxTextExtent);
+ (void) CopyMagickString(geometry,"512x512",MagickPathExtent);
if (image_info->size != (char *) NULL)
- (void) CopyMagickString(geometry,image_info->size,MaxTextExtent);
+ (void) CopyMagickString(geometry,image_info->size,MagickPathExtent);
(void) XDialogWidget(display,windows,"Load","Enter the image geometry:",
geometry);
(void) CloneString(&image_info->size,geometry);
*/
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
nexus=ReadImage(image_info,exception);
CatchException(exception);
XSetCursorState(display,windows,MagickFalse);
/*
Unknown image format.
*/
- text=FileToString(filename,~0,exception);
+ text=FileToString(filename,~0UL,exception);
if (text == (char *) NULL)
return((Image *) NULL);
textlist=StringToList(text);
if (textlist != (char **) NULL)
{
char
- title[MaxTextExtent];
+ title[MagickPathExtent];
register int
i;
- (void) FormatLocaleString(title,MaxTextExtent,
+ (void) FormatLocaleString(title,MagickPathExtent,
"Unknown format: %s",filename);
XTextViewWidget(display,resource_info,windows,MagickTrue,title,
(const char **) textlist);
%
% 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:
%
% 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];
+ text[MagickPathExtent];
Cursor
cursor;
- MagickRealType
+ double
x_factor,
y_factor;
/*
Pan image as pointer moves until the mouse button is released.
*/
- x_factor=(MagickRealType) windows->image.ximage->width/windows->pan.width;
- y_factor=(MagickRealType) windows->image.ximage->height/windows->pan.height;
+ x_factor=(double) windows->image.ximage->width/windows->pan.width;
+ y_factor=(double) windows->image.ximage->height/windows->pan.height;
pan_info.width=windows->pan.width*windows->image.width/
windows->image.ximage->width;
pan_info.height=windows->pan.height*windows->image.height/
*/
windows->image.x=(int) pan_info.x;
windows->image.y=(int) pan_info.y;
- (void) FormatLocaleString(text,MaxTextExtent," %ux%u%+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %ux%u%+d%+d ",
windows->image.width,windows->image.height,windows->image.x,
windows->image.y);
XInfoWidget(display,windows,text);
Wait for next event.
*/
if ((state & ExitState) == 0)
- XScreenEvent(display,windows,event);
+ XScreenEvent(display,windows,event,exception);
} while ((state & ExitState) == 0);
/*
Restore cursor.
compose = CopyCompositeOp;
char
- text[MaxTextExtent];
+ text[MagickPathExtent];
Cursor
cursor;
x,
y;
- MagickRealType
+ double
scale_factor;
RectangleInfo
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+ld%+ld ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+ld%+ld ",
(long) paste_info.x,(long) paste_info.y);
XInfoWidget(display,windows,text);
}
/*
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)
case PasteOperatorsCommand:
{
char
- command[MaxTextExtent],
+ command[MagickPathExtent],
**operators;
/*
{
case ButtonPress:
{
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Button Press: 0x%lx %u +%d+%d",event.xbutton.window,
event.xbutton.button,event.xbutton.x,event.xbutton.y);
if (windows->image.crop_geometry != (char *) NULL)
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,
&width,&height);
- scale_factor=(MagickRealType) windows->image.ximage->width/width;
+ scale_factor=(double) windows->image.ximage->width/width;
paste_info.width=(unsigned int) (scale_factor*paste_image->columns+0.5);
- scale_factor=(MagickRealType) windows->image.ximage->height/height;
+ scale_factor=(double) windows->image.ximage->height/height;
paste_info.height=(unsigned int) (scale_factor*paste_image->rows+0.5);
(void) XCheckDefineCursor(display,windows->image.id,cursor);
paste_info.x=(ssize_t) windows->image.x+event.xbutton.x;
}
case ButtonRelease:
{
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Button Release: 0x%lx %u +%d+%d",event.xbutton.window,
event.xbutton.button,event.xbutton.x,event.xbutton.y);
case KeyPress:
{
char
- command[MaxTextExtent];
+ command[MagickPathExtent];
KeySym
key_symbol;
length=XLookupString((XKeyEvent *) &event.xkey,command,(int)
sizeof(command),&key_symbol,(XComposeStatus *) NULL);
*(command+length)='\0';
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Key press: 0x%lx (%s)",(long) key_symbol,command);
switch ((int) key_symbol)
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
}
default:
{
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Event type: %d",
event.type);
break;
y=0;
if (windows->image.crop_geometry != (char *) NULL)
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,&width,&height);
- scale_factor=(MagickRealType) width/windows->image.ximage->width;
+ scale_factor=(double) width/windows->image.ximage->width;
paste_info.x+=x;
paste_info.x=(ssize_t) (scale_factor*paste_info.x+0.5);
paste_info.width=(unsigned int) (scale_factor*paste_info.width+0.5);
- scale_factor=(MagickRealType) height/windows->image.ximage->height;
+ scale_factor=(double) height/windows->image.ximage->height;
paste_info.y+=y;
paste_info.y=(ssize_t) (scale_factor*paste_info.y*scale_factor+0.5);
paste_info.height=(unsigned int) (scale_factor*paste_info.height+0.5);
/*
Paste image with X Image window.
*/
- (void) CompositeImage(image,compose,paste_image,paste_info.x,paste_info.y);
+ (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);
}
ExceptionInfo *exception)
{
char
- filename[MaxTextExtent],
- geometry[MaxTextExtent];
+ filename[MagickPathExtent],
+ geometry[MagickPathExtent];
Image
*print_image;
Request Postscript page geometry from user.
*/
image_info=CloneImageInfo(resource_info->image_info);
- (void) FormatLocaleString(geometry,MaxTextExtent,"Letter");
+ (void) FormatLocaleString(geometry,MagickPathExtent,"Letter");
if (image_info->page != (char *) NULL)
- (void) CopyMagickString(geometry,image_info->page,MaxTextExtent);
+ (void) CopyMagickString(geometry,image_info->page,MagickPathExtent);
XListBrowserWidget(display,windows,&windows->widget,PageSizes,"Select",
"Select Postscript Page Geometry:",geometry);
if (*geometry == '\0')
print_image=CloneImage(image,0,0,MagickTrue,exception);
if (print_image == (Image *) NULL)
return(MagickFalse);
- (void) FormatLocaleString(geometry,MaxTextExtent,"%dx%d!",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%dx%d!",
windows->image.ximage->width,windows->image.ximage->height);
- (void) TransformImage(&print_image,windows->image.crop_geometry,geometry);
+ (void) TransformImage(&print_image,windows->image.crop_geometry,geometry,
+ exception);
/*
Print image.
*/
(void) AcquireUniqueFilename(filename);
- (void) FormatLocaleString(print_image->filename,MaxTextExtent,"print:%s",
+ (void) FormatLocaleString(print_image->filename,MagickPathExtent,"print:%s",
filename);
status=WriteImage(image_info,print_image,exception);
(void) RelinquishUniqueFileResource(filename);
};
char
- command[MaxTextExtent],
- text[MaxTextExtent];
+ command[MagickPathExtent],
+ text[MagickPathExtent];
CommandType
command_type;
x,
y;
- MagickRealType
+ double
scale_factor;
MagickProgressMonitor
state=DefaultState;
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %+ld%+ld ",
+ (void) FormatLocaleString(text,MagickPathExtent," %+ld%+ld ",
(long) roi_info.x,(long) roi_info.y);
XInfoWidget(display,windows,text);
}
/*
Wait for next event.
*/
- XScreenEvent(display,windows,&event);
+ XScreenEvent(display,windows,&event,exception);
if (event.xany.window == windows->command.id)
{
/*
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
/*
Display info and draw region of interest rectangle.
*/
- if (windows->info.mapped == MagickFalse)
+ if (IfMagickFalse(windows->info.mapped) )
(void) XMapWindow(display,windows->info.id);
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
" %.20gx%.20g%+.20g%+.20g",(double) roi_info.width,(double)
roi_info.height,(double) roi_info.x,(double) roi_info.y);
XInfoWidget(display,windows,text);
windows->image.highlight_context,&highlight_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
/*
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);
*/
state=DefaultState;
command_type=NullCommand;
+ crop_info.x=0;
+ crop_info.y=0;
(void) XMapWindow(display,windows->info.id);
do
{
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display pointer position.
*/
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
" %.20gx%.20g%+.20g%+.20g",(double) roi_info.width,(double)
roi_info.height,(double) roi_info.x,(double) roi_info.y);
XInfoWidget(display,windows,text);
if (windows->image.crop_geometry != (char *) NULL)
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,
&width,&height);
- scale_factor=(MagickRealType) width/windows->image.ximage->width;
+ scale_factor=(double) width/windows->image.ximage->width;
crop_info.x+=x;
crop_info.x=(ssize_t) (scale_factor*crop_info.x+0.5);
crop_info.width=(unsigned int) (scale_factor*crop_info.width+0.5);
- scale_factor=(MagickRealType)
+ scale_factor=(double)
height/windows->image.ximage->height;
crop_info.y+=y;
crop_info.y=(ssize_t) (scale_factor*crop_info.y+0.5);
(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);
+ (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);
}
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);
}
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)
{
/*
id=XCommandWidget(display,windows,ApplyMenu,&event);
if (id >= 0)
{
- (void) CopyMagickString(command,ApplyMenu[id],MaxTextExtent);
+ (void) CopyMagickString(command,ApplyMenu[id],MagickPathExtent);
command_type=ApplyCommands[id];
if (id < ApplyMenus)
{
if (entry >= 0)
{
(void) CopyMagickString(command,Menus[id][entry],
- MaxTextExtent);
+ MagickPathExtent);
command_type=Commands[id][entry];
}
}
*/
x=event.xmotion.x;
y=event.xmotion.y;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
if ((x < (int) (windows->info.x+windows->info.width)) &&
(y < (int) (windows->info.y+windows->info.height)))
/*
Set primary selection.
*/
- (void) FormatLocaleString(text,MaxTextExtent,
+ (void) FormatLocaleString(text,MagickPathExtent,
"%.20gx%.20g%+.20g%+.20g",(double) roi_info.width,(double)
roi_info.height,(double) roi_info.x,(double) roi_info.y);
request=(&(event.xselectionrequest));
pen_id = 0;
char
- command[MaxTextExtent],
- text[MaxTextExtent];
+ command[MagickPathExtent],
+ text[MagickPathExtent];
Image
*rotate_image;
x,
y;
- MagickRealType
+ double
normalized_degrees;
register int
/*
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)
if (pen_number == (MaxNumberPens-2))
{
static char
- color_name[MaxTextExtent] = "gray";
+ color_name[MagickPathExtent] = "gray";
/*
Select a pen color from a dialog.
case KeyPress:
{
char
- command[MaxTextExtent];
+ command[MagickPathExtent];
KeySym
key_symbol;
/*
Display info and draw rotation line.
*/
- if (windows->info.mapped == MagickFalse)
+ if (IfMagickFalse(windows->info.mapped) )
(void) XMapWindow(display,windows->info.id);
- (void) FormatLocaleString(text,MaxTextExtent," %g",
+ (void) FormatLocaleString(text,MagickPathExtent," %g",
direction == VerticalRotateCommand ? degrees-90.0 : degrees);
XInfoWidget(display,windows,text);
XHighlightLine(display,windows->image.id,
windows->image.highlight_context,&rotate_info);
}
else
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,
windows->info.screen);
/*
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);
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);
/*
Rotate 90 degrees.
*/
- (void) FormatLocaleString(windows->image.crop_geometry,MaxTextExtent,
+ (void) FormatLocaleString(windows->image.crop_geometry,MagickPathExtent,
"%ux%u%+d%+d",height,width,(int) (*image)->columns-
(int) height-y,x);
break;
/*
Rotate 180 degrees.
*/
- (void) FormatLocaleString(windows->image.crop_geometry,MaxTextExtent,
+ (void) FormatLocaleString(windows->image.crop_geometry,MagickPathExtent,
"%ux%u%+d%+d",width,height,(int) width-x,(int) height-y);
break;
}
/*
Rotate 270 degrees.
*/
- (void) FormatLocaleString(windows->image.crop_geometry,MaxTextExtent,
+ (void) FormatLocaleString(windows->image.crop_geometry,MagickPathExtent,
"%ux%u%+d%+d",height,width,y,(int) (*image)->rows-(int) width-x);
break;
}
}
}
- if (windows->image.orphan != MagickFalse)
+ if (IfMagickTrue(windows->image.orphan) )
return(MagickTrue);
if (normalized_degrees != 0.0)
{
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))
ExceptionInfo *exception)
{
char
- filename[MaxTextExtent],
- geometry[MaxTextExtent];
+ filename[MagickPathExtent],
+ geometry[MagickPathExtent];
Image
*save_image;
*/
if (resource_info->write_filename != (char *) NULL)
(void) CopyMagickString(filename,resource_info->write_filename,
- MaxTextExtent);
+ MagickPathExtent);
else
{
char
- path[MaxTextExtent];
+ path[MagickPathExtent];
int
status;
XFileBrowserWidget(display,windows,"Save",filename);
if (*filename == '\0')
return(MagickTrue);
- if (IsPathAccessible(filename) != MagickFalse)
+ if (IfMagickTrue(IsPathAccessible(filename)) )
{
int
status;
return(MagickTrue);
}
image_info=CloneImageInfo(resource_info->image_info);
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
(void) SetImageInfo(image_info,1,exception);
if ((LocaleCompare(image_info->magick,"JPEG") == 0) ||
(LocaleCompare(image_info->magick,"JPG") == 0))
{
char
- quality[MaxTextExtent];
+ quality[MagickPathExtent];
int
status;
/*
Request JPEG quality from user.
*/
- (void) FormatLocaleString(quality,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(quality,MagickPathExtent,"%.20g",(double)
image->quality);
status=XDialogWidget(display,windows,"Save","Enter JPEG quality:",
quality);
(LocaleCompare(image_info->magick,"PS2") == 0))
{
char
- geometry[MaxTextExtent];
+ geometry[MagickPathExtent];
/*
Request page geometry from user.
*/
- (void) CopyMagickString(geometry,PSPageGeometry,MaxTextExtent);
+ (void) CopyMagickString(geometry,PSPageGeometry,MagickPathExtent);
if (LocaleCompare(image_info->magick,"PDF") == 0)
- (void) CopyMagickString(geometry,PSPageGeometry,MaxTextExtent);
+ (void) CopyMagickString(geometry,PSPageGeometry,MagickPathExtent);
if (image_info->page != (char *) NULL)
- (void) CopyMagickString(geometry,image_info->page,MaxTextExtent);
+ (void) CopyMagickString(geometry,image_info->page,MagickPathExtent);
XListBrowserWidget(display,windows,&windows->widget,PageSizes,"Select",
"Select page geometry:",geometry);
if (*geometry != '\0')
save_image=CloneImage(image,0,0,MagickTrue,exception);
if (save_image == (Image *) NULL)
return(MagickFalse);
- (void) FormatLocaleString(geometry,MaxTextExtent,"%dx%d!",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%dx%d!",
windows->image.ximage->width,windows->image.ximage->height);
- (void) TransformImage(&save_image,windows->image.crop_geometry,geometry);
+ (void) TransformImage(&save_image,windows->image.crop_geometry,geometry,
+ exception);
/*
Write image.
*/
- (void) CopyMagickString(save_image->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(save_image->filename,filename,MagickPathExtent);
status=WriteImage(image_info,save_image,exception);
- if (status != MagickFalse)
+ if (IfMagickTrue(status) )
image->taint=MagickFalse;
save_image=DestroyImage(save_image);
image_info=DestroyImageInfo(image_info);
%
% 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:
%
%
% o event: Specifies a pointer to a X11 XEvent structure.
%
+% o exception: return any errors or warnings in this structure.
%
*/
}
#endif
-static void XScreenEvent(Display *display,XWindows *windows,XEvent *event)
+static void XScreenEvent(Display *display,XWindows *windows,XEvent *event,
+ ExceptionInfo *exception)
{
register int
x,
}
if (event->xbutton.window == windows->pan.id)
{
- XPanImage(display,windows,event);
+ XPanImage(display,windows,event,exception);
break;
}
if (event->xbutton.window == windows->image.id)
if (y >= (int) windows->image.height)
y=(int) (windows->image.height-1);
windows->magnify.y=windows->image.y+y;
- if (windows->magnify.mapped == MagickFalse)
+ if (IfMagickFalse(windows->magnify.mapped) )
(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);
*/
windows->magnify.width=(unsigned int) event->xconfigure.width;
windows->magnify.height=(unsigned int) event->xconfigure.height;
- if (windows->magnify.mapped == MagickFalse)
+ if (IfMagickFalse(windows->magnify.mapped) )
break;
magnify=1;
while ((int) magnify <= event->xconfigure.width)
&window_changes);
break;
}
- XMakeMagnifyImage(display,windows);
+ XMakeMagnifyImage(display,windows,exception);
break;
}
break;
if (event->xexpose.window == windows->magnify.id)
if (event->xexpose.count == 0)
{
- XMakeMagnifyImage(display,windows);
+ XMakeMagnifyImage(display,windows,exception);
break;
}
break;
case KeyPress:
{
char
- command[MaxTextExtent];
+ command[MagickPathExtent];
KeySym
key_symbol;
*/
(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:
{
while (XCheckMaskEvent(display,ButtonMotionMask,event)) ;
if (event->xmotion.window == windows->image.id)
- if (windows->magnify.mapped != MagickFalse)
+ if (IfMagickTrue(windows->magnify.mapped) )
{
/*
Update magnified image.
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;
}
RectangleInfo *crop_info,Image *image)
{
char
- text[MaxTextExtent];
+ text[MagickPathExtent];
int
x,
y;
- MagickRealType
+ double
scale_factor;
unsigned int
height,
width;
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
{
/*
Display info on cropping rectangle.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %.20gx%.20g%+.20g%+.20g",
+ (void) FormatLocaleString(text,MagickPathExtent," %.20gx%.20g%+.20g%+.20g",
(double) crop_info->width,(double) crop_info->height,(double)
crop_info->x,(double) crop_info->y);
XInfoWidget(display,windows,text);
/*
Define the crop geometry string from the cropping rectangle.
*/
- scale_factor=(MagickRealType) width/windows->image.ximage->width;
+ scale_factor=(double) width/windows->image.ximage->width;
if (crop_info->x > 0)
x+=(int) (scale_factor*crop_info->x+0.5);
width=(unsigned int) (scale_factor*crop_info->width+0.5);
if (width == 0)
width=1;
- scale_factor=(MagickRealType) height/windows->image.ximage->height;
+ scale_factor=(double) height/windows->image.ximage->height;
if (crop_info->y > 0)
y+=(int) (scale_factor*crop_info->y+0.5);
height=(unsigned int) (scale_factor*crop_info->height+0.5);
if (height == 0)
height=1;
- (void) FormatLocaleString(windows->image.crop_geometry,MaxTextExtent,
+ (void) FormatLocaleString(windows->image.crop_geometry,MagickPathExtent,
"%ux%u%+d%+d",width,height,x,y);
}
\f
};
char
- command[MaxTextExtent],
- filename[MaxTextExtent];
+ command[MagickPathExtent],
+ filename[MagickPathExtent];
Image
*tile_image;
x,
y;
- MagickRealType
+ double
scale_factor;
register char
height=(unsigned int) image->rows;
if (windows->image.crop_geometry != (char *) NULL)
(void) XParseGeometry(windows->image.crop_geometry,&x,&y,&width,&height);
- scale_factor=(MagickRealType) width/windows->image.ximage->width;
+ scale_factor=(double) width/windows->image.ximage->width;
event->xbutton.x+=windows->image.x;
event->xbutton.x=(int) (scale_factor*event->xbutton.x+x+0.5);
- scale_factor=(MagickRealType) height/windows->image.ximage->height;
+ scale_factor=(double) height/windows->image.ximage->height;
event->xbutton.y+=windows->image.y;
event->xbutton.y=(int) (scale_factor*event->xbutton.y+y+0.5);
/*
*/
XCheckRefreshWindows(display,windows);
(void) CopyMagickString(resource_info->image_info->magick,"MIFF",
- MaxTextExtent);
+ MagickPathExtent);
(void) CopyMagickString(resource_info->image_info->filename,filename,
- MaxTextExtent);
+ MagickPathExtent);
tile_image=ReadImage(resource_info->image_info,exception);
CatchException(exception);
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
/*
Delete tile image.
*/
- if (IsPathAccessible(filename) == MagickFalse)
+ if (IfMagickFalse(IsPathAccessible(filename)) )
{
XNoticeWidget(display,windows,"Image file does not exist:",filename);
break;
status=XConfirmWidget(display,windows,"Really delete tile",filename);
if (status <= 0)
break;
- status=remove(filename) != 0 ? MagickTrue : MagickFalse;
- if (status != MagickFalse)
+ status=ShredFile(filename);
+ if (IfMagickTrue(status) )
{
XNoticeWidget(display,windows,"Unable to delete image file:",
filename);
x_offset,
y_offset;
- PixelPacket
+ PixelInfo
pixel;
register int
Ensure all the images exist.
*/
tile=0;
+ GetPixelInfo(image,&pixel);
for (p=image->directory; *p != '\0'; p++)
{
CacheView
q++;
(void) CopyMagickString(filename,p,(size_t) (q-p+1));
p=q;
- if (IsPathAccessible(filename) != MagickFalse)
+ if (IfMagickTrue(IsPathAccessible(filename)) )
{
tile++;
continue;
*/
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,&pixel,exception);
+ image_view=AcquireAuthenticCacheView(image,exception);
+ (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)
break;
for (j=0; j < (int) width; j++)
{
- SetPixelPacket(image,&pixel,s);
+ SetPixelViaPixelInfo(image,&pixel,s);
s+=GetPixelChannels(image);
}
- if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
+ if (IfMagickFalse(SyncCacheViewAuthenticPixels(image_view,exception)) )
break;
}
image_view=DestroyCacheView(image_view);
}
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;
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% XTranslateImage() translates the image within an Image window by one pixel
-% as specified by the key symbol. If the image has a `montage string the
+% as specified by the key symbol. If the image has a montage string the
% translation is respect to the width and height contained within the string.
%
% The format of the XTranslateImage method is:
Image *image,const KeySym key_symbol)
{
char
- text[MaxTextExtent];
+ text[MagickPathExtent];
int
x,
/*
Refresh Image window.
*/
- (void) FormatLocaleString(text,MaxTextExtent," %ux%u%+d%+d ",
+ (void) FormatLocaleString(text,MagickPathExtent," %ux%u%+d%+d ",
windows->image.width,windows->image.height,windows->image.x,
windows->image.y);
XInfoWidget(display,windows,text);
i;
static char
- filename[MaxTextExtent] = "\0",
- filenames[MaxTextExtent] = "*";
+ filename[MagickPathExtent] = "\0",
+ filenames[MagickPathExtent] = "*";
XResourceInfo
background_resources;
filelist=(char **) AcquireMagickMemory(sizeof(*filelist));
if (filelist == (char **) NULL)
{
- ThrowXWindowFatalException(ResourceLimitError,"MemoryAllocationFailed",
+ ThrowXWindowException(ResourceLimitError,"MemoryAllocationFailed",
filenames);
return((Image *) NULL);
}
number_files=1;
filelist[0]=filenames;
status=ExpandFilenames(&number_files,&filelist);
- if ((status == MagickFalse) || (number_files == 0))
+ if (IfMagickFalse(status) || (number_files == 0))
{
if (number_files == 0)
- ThrowXWindowFatalException(ImageError,"NoImagesWereFound",filenames)
+ ThrowXWindowException(ImageError,"NoImagesWereFound",filenames)
else
- ThrowXWindowFatalException(ResourceLimitError,"MemoryAllocationFailed",
+ ThrowXWindowException(ResourceLimitError,"MemoryAllocationFailed",
filenames);
return((Image *) NULL);
}
*/
background_resources=(*resource_info);
background_resources.window_id=AcquireString("");
- (void) FormatLocaleString(background_resources.window_id,MaxTextExtent,
+ (void) FormatLocaleString(background_resources.window_id,MagickPathExtent,
"0x%lx",windows->image.id);
background_resources.backdrop=MagickTrue;
/*
Read each image and convert them to a tile.
*/
- backdrop=(windows->visual_info->klass == TrueColor) ||
- (windows->visual_info->klass == DirectColor) ? MagickTrue : MagickFalse;
+ backdrop=((windows->visual_info->klass == TrueColor) ||
+ (windows->visual_info->klass == DirectColor)) ? MagickTrue : MagickFalse;
read_info=CloneImageInfo(resource_info->image_info);
(void) SetImageOption(read_info,"jpeg:size","120x120");
(void) CloneString(&read_info->size,DefaultTileGeometry);
XCheckRefreshWindows(display,windows);
for (i=0; i < (int) number_files; i++)
{
- (void) CopyMagickString(read_info->filename,filelist[i],MaxTextExtent);
+ (void) CopyMagickString(read_info->filename,filelist[i],MagickPathExtent);
filelist[i]=DestroyString(filelist[i]);
*read_info->magick='\0';
next_image=ReadImage(read_info,exception);
{
(void) DeleteImageProperty(next_image,"label");
(void) SetImageProperty(next_image,"label",InterpretImageProperties(
- read_info,next_image,DefaultTileLabel,exception));
+ read_info,next_image,DefaultTileLabel,exception),exception);
(void) ParseRegionGeometry(next_image,read_info->size,&geometry,
exception);
thumbnail_image=ThumbnailImage(next_image,geometry.width,
proceed=SetImageProgress(images,LoadImageTag,(MagickOffsetType) i,
(MagickSizeType) number_files);
- if (proceed == MagickFalse)
+ if (IfMagickFalse(proceed) )
break;
}
}
{
read_info=DestroyImageInfo(read_info);
XSetCursorState(display,windows,MagickFalse);
- ThrowXWindowFatalException(ImageError,"NoImagesWereLoaded",filenames);
+ ThrowXWindowException(ImageError,"NoImagesWereLoaded",filenames);
return((Image *) NULL);
}
/*
montage_info->pointsize=10;
if (resource_info->font != (char *) NULL)
(void) CloneString(&montage_info->font,resource_info->font);
- (void) CopyMagickString(montage_info->filename,filename,MaxTextExtent);
+ (void) CopyMagickString(montage_info->filename,filename,MagickPathExtent);
montage_image=MontageImageList(read_info,montage_info,GetFirstImageInList(
images),exception);
images=DestroyImageList(images);
XResourceInfo *resource_info,Image *image,ExceptionInfo *exception)
{
char
- geometry[MaxTextExtent],
- visual_type[MaxTextExtent];
+ geometry[MagickPathExtent],
+ visual_type[MagickPathExtent];
int
height,
Determine target window.
*/
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
+ assert(image->signature == MagickCoreSignature);
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
resources=(*resource_info);
window_info.id=(Window) NULL;
window_info.id=root_window;
else
{
- if (isdigit((unsigned char) *resources.window_id) != 0)
+ if (isdigit((int) ((unsigned char) *resources.window_id)) != 0)
window_info.id=XWindowByID(display,root_window,
(Window) strtol((char *) resources.window_id,(char **) NULL,0));
if (window_info.id == (Window) NULL)
}
if (window_info.id == (Window) NULL)
{
- ThrowXWindowFatalException(XServerError,"NoWindowWithSpecifiedIDExists",
+ ThrowXWindowException(XServerError,"NoWindowWithSpecifiedIDExists",
resources.window_id);
return(MagickFalse);
}
*/
window_attributes.width=XDisplayWidth(display,XDefaultScreen(display));
window_attributes.height=XDisplayHeight(display,XDefaultScreen(display));
- (void) CopyMagickString(visual_type,"default",MaxTextExtent);
+ (void) CopyMagickString(visual_type,"default",MagickPathExtent);
status=XGetWindowAttributes(display,window_info.id,&window_attributes);
if (status != 0)
- (void) FormatLocaleString(visual_type,MaxTextExtent,"0x%lx",
+ (void) FormatLocaleString(visual_type,MagickPathExtent,"0x%lx",
XVisualIDFromVisual(window_attributes.visual));
if (visual_info == (XVisualInfo *) NULL)
{
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.
*/
(image->rows != window_info.height))
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
image->filename);
- (void) FormatLocaleString(geometry,MaxTextExtent,"%ux%u+0+0>",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%ux%u+0+0>",
window_attributes.width,window_attributes.height);
geometry_info.width=window_info.width;
geometry_info.height=window_info.height;
window_info.y=(int) geometry_info.y;
status=XMakeImage(display,&resources,&window_info,image,window_info.width,
window_info.height,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
image->filename);
window_info.x=0;
window_info.y=0;
- if (image->debug != MagickFalse)
+ if (IfMagickTrue(image->debug) )
{
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Image: %s[%.20g] %.20gx%.20g ",image->filename,(double) image->scene,
*/
width=(int) window_info.width;
height=(int) window_info.height;
- if (resources.backdrop != MagickFalse)
+ if (IfMagickTrue(resources.backdrop) )
{
/*
Center image on window.
(*resources.image_geometry != '\0'))
{
char
- default_geometry[MaxTextExtent];
+ default_geometry[MagickPathExtent];
int
flags,
ThrowXWindowFatalException(ResourceLimitFatalError,
"MemoryAllocationFailed",image->filename);
size_hints->flags=0L;
- (void) FormatLocaleString(default_geometry,MaxTextExtent,"%dx%d",
+ (void) FormatLocaleString(default_geometry,MagickPathExtent,"%dx%d",
width,height);
flags=XWMGeometry(display,visual_info->screen,resources.image_geometry,
default_geometry,window_info.border_width,size_hints,&window_info.x,
};
char
- command[MaxTextExtent],
+ command[MagickPathExtent],
*directory,
- geometry[MaxTextExtent],
- resource_name[MaxTextExtent];
+ geometry[MagickPathExtent],
+ resource_name[MagickPathExtent];
CommandType
command_type;
i;
static char
- working_directory[MaxTextExtent];
+ working_directory[MagickPathExtent];
static XPoint
vid_info;
*manager_hints;
assert(image != (Image **) NULL);
- assert((*image)->signature == MagickSignature);
- if ((*image)->debug != MagickFalse)
+ assert((*image)->signature == MagickCoreSignature);
+ if (IfMagickTrue((*image)->debug) )
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",(*image)->filename);
display_image=(*image);
warning_handler=(WarningHandler) NULL;
int
status;
+ if (*working_directory == '\0')
+ (void) CopyMagickString(working_directory,".",MagickPathExtent);
status=chdir(working_directory);
if (status == -1)
(void) ThrowMagickException(exception,GetMagickModule(),FileOpenError,
manager_hints=windows->manager_hints;
root_window=XRootWindow(display,visual_info->screen);
nexus=NewImageList();
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
{
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Image: %s[%.20g] %.20gx%.20g ",display_image->filename,
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.
manager_hints->initial_state=WithdrawnState;
XMakeWindow(display,root_window,argv,argc,class_hints,manager_hints,
&windows->context);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Window id: 0x%lx (context)",windows->context.id);
context_values.background=pixel->background_color.pixel;
manager_hints->initial_state=IconicState;
XMakeWindow(display,root_window,argv,argc,class_hints,manager_hints,
&windows->icon);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Window id: 0x%lx (icon)",
windows->icon.id);
/*
XGetWindowInfo(display,visual_info,map_info,pixel,font_info,resource_info,
&windows->image);
windows->image.shape=MagickTrue; /* non-rectangular shape hint */
- if (resource_info->use_shared_memory == MagickFalse)
+ if (IfMagickFalse(resource_info->use_shared_memory) )
windows->image.shared_memory=MagickFalse;
if ((resource_info->title != (char *) NULL) && !(*state & MontageImageState))
{
title=InterpretImageProperties(resource_info->image_info,display_image,
resource_info->title,exception);
- (void) CopyMagickString(windows->image.name,title,MaxTextExtent);
- (void) CopyMagickString(windows->image.icon_name,title,MaxTextExtent);
+ (void) CopyMagickString(windows->image.name,title,MagickPathExtent);
+ (void) CopyMagickString(windows->image.icon_name,title,MagickPathExtent);
title=DestroyString(title);
}
else
{
char
- filename[MaxTextExtent];
+ filename[MagickPathExtent];
/*
Window name is the base of the filename.
*/
GetPathComponent(display_image->magick_filename,TailPath,filename);
- if (GetImageListLength(display_image) == 1)
- (void) FormatLocaleString(windows->image.name,MaxTextExtent,
+ if (display_image->scene == 0)
+ (void) FormatLocaleString(windows->image.name,MagickPathExtent,
"%s: %s",MagickPackageName,filename);
else
- (void) FormatLocaleString(windows->image.name,MaxTextExtent,
+ (void) FormatLocaleString(windows->image.name,MagickPathExtent,
"%s: %s[scene: %.20g frames: %.20g]",MagickPackageName,filename,
(double) display_image->scene,(double) GetImageListLength(
display_image));
- (void) CopyMagickString(windows->image.icon_name,filename,MaxTextExtent);
+ (void) CopyMagickString(windows->image.icon_name,filename,MagickPathExtent);
}
if (resource_info->immutable)
windows->image.immutable=MagickTrue;
windows->image.use_pixmap=resource_info->use_pixmap;
windows->image.geometry=resource_info->image_geometry;
- (void) FormatLocaleString(geometry,MaxTextExtent,"%ux%u+0+0>!",
+ (void) FormatLocaleString(geometry,MagickPathExtent,"%ux%u+0+0>!",
XDisplayWidth(display,visual_info->screen),
XDisplayHeight(display,visual_info->screen));
geometry_info.width=display_image->columns;
NormalState;
XMakeWindow(display,root_window,argv,argc,class_hints,manager_hints,
&windows->backdrop);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Window id: 0x%lx (backdrop)",windows->backdrop.id);
(void) XMapWindow(display,windows->backdrop.id);
manager_hints->flags|=WindowGroupHint;
manager_hints->window_group=windows->group_leader.id;
(void) XSelectInput(display,windows->group_leader.id,StructureNotifyMask);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Window id: 0x%lx (group leader)",windows->group_leader.id);
}
if (windows->group_leader.id != (Window) NULL)
(void) XSetTransientForHint(display,windows->image.id,
windows->group_leader.id);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Window id: 0x%lx (image)",
windows->image.id);
/*
windows->info.shadow_stipple=XCreateBitmapFromData(display,
windows->info.id,(char *) ShadowBitmap,ShadowWidth,ShadowHeight);
(void) XSetTransientForHint(display,windows->info.id,windows->image.id);
- if (windows->image.mapped != MagickFalse)
+ if (IfMagickTrue(windows->image.mapped) )
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Window id: 0x%lx (info)",
windows->info.id);
/*
resource_info,&windows->command);
windows->command.data=MagickMenus;
(void) XCommandWidget(display,windows,CommandMenu,(XEvent *) NULL);
- (void) FormatLocaleString(resource_name,MaxTextExtent,"%s.command",
+ (void) FormatLocaleString(resource_name,MagickPathExtent,"%s.command",
resource_info->client_name);
windows->command.geometry=XGetResourceClass(resource_info->resource_database,
resource_name,"geometry",(char *) NULL);
windows->command.shadow_stipple=XCreateBitmapFromData(display,
windows->command.id,(char *) ShadowBitmap,ShadowWidth,ShadowHeight);
(void) XSetTransientForHint(display,windows->command.id,windows->image.id);
- if (windows->command.mapped != MagickFalse)
+ if (IfMagickTrue(windows->command.mapped) )
(void) XMapRaised(display,windows->command.id);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Window id: 0x%lx (command)",windows->command.id);
/*
*/
XGetWindowInfo(display,visual_info,map_info,pixel,font_info,
resource_info,&windows->widget);
- (void) FormatLocaleString(resource_name,MaxTextExtent,"%s.widget",
+ (void) FormatLocaleString(resource_name,MagickPathExtent,"%s.widget",
resource_info->client_name);
windows->widget.geometry=XGetResourceClass(resource_info->resource_database,
resource_name,"geometry",(char *) NULL);
windows->widget.shadow_stipple=XCreateBitmapFromData(display,
windows->widget.id,(char *) ShadowBitmap,ShadowWidth,ShadowHeight);
(void) XSetTransientForHint(display,windows->widget.id,windows->image.id);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Window id: 0x%lx (widget)",windows->widget.id);
/*
windows->popup.shadow_stipple=XCreateBitmapFromData(display,
windows->popup.id,(char *) ShadowBitmap,ShadowWidth,ShadowHeight);
(void) XSetTransientForHint(display,windows->popup.id,windows->image.id);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Window id: 0x%lx (pop up)",windows->popup.id);
/*
*/
XGetWindowInfo(display,visual_info,map_info,pixel,font_info,
resource_info,&windows->magnify);
- if (resource_info->use_shared_memory == MagickFalse)
+ if (IfMagickFalse(resource_info->use_shared_memory) )
windows->magnify.shared_memory=MagickFalse;
- (void) FormatLocaleString(resource_name,MaxTextExtent,"%s.magnify",
+ (void) FormatLocaleString(resource_name,MagickPathExtent,"%s.magnify",
resource_info->client_name);
windows->magnify.geometry=XGetResourceClass(resource_info->resource_database,
resource_name,"geometry",(char *) NULL);
- (void) FormatLocaleString(windows->magnify.name,MaxTextExtent,"Magnify %uX",
+ (void) FormatLocaleString(windows->magnify.name,MagickPathExtent,"Magnify %uX",
resource_info->magnify);
if (windows->magnify.cursor != (Cursor) NULL)
(void) XFreeCursor(display,windows->magnify.cursor);
manager_hints->window_group=windows->image.id;
XMakeWindow(display,root_window,argv,argc,class_hints,manager_hints,
&windows->magnify);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Window id: 0x%lx (magnify)",windows->magnify.id);
(void) XSetTransientForHint(display,windows->magnify.id,windows->image.id);
(void) CloneString(&windows->pan.name,"Pan Icon");
windows->pan.width=windows->icon.width;
windows->pan.height=windows->icon.height;
- (void) FormatLocaleString(resource_name,MaxTextExtent,"%s.pan",
+ (void) FormatLocaleString(resource_name,MagickPathExtent,"%s.pan",
resource_info->client_name);
windows->pan.geometry=XGetResourceClass(resource_info->resource_database,
resource_name,"geometry",(char *) NULL);
manager_hints->window_group=windows->image.id;
XMakeWindow(display,root_window,argv,argc,class_hints,manager_hints,
&windows->pan);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Window id: 0x%lx (pan)",
windows->pan.id);
(void) XSetTransientForHint(display,windows->pan.id,windows->image.id);
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
- if ((windows->image.mapped == MagickFalse) ||
+ if (IfMagickFalse(windows->image.mapped) ||
(windows->backdrop.id != (Window) NULL))
(void) XMapWindow(display,windows->image.id);
/*
display_image->filename);
status=XMakeImage(display,resource_info,&windows->image,display_image,
width,height,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status) )
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
display_image->filename);
status=XMakeImage(display,resource_info,&windows->magnify,(Image *) NULL,
windows->magnify.width,windows->magnify.height,exception);
- if (status == MagickFalse)
+ if (IfMagickFalse(status))
ThrowXWindowFatalException(XServerFatalError,"UnableToCreateXImage",
display_image->filename);
- if (windows->magnify.mapped != MagickFalse)
+ if (IfMagickTrue(windows->magnify.mapped) )
(void) XMapRaised(display,windows->magnify.id);
- if (windows->pan.mapped != MagickFalse)
+ if (IfMagickTrue(windows->pan.mapped) )
(void) XMapRaised(display,windows->pan.id);
windows->image.window_changes.width=(int) display_image->columns;
windows->image.window_changes.height=(int) display_image->rows;
delay=display_image->delay/MagickMax(display_image->ticks_per_second,1L);
timer=time((time_t *) NULL)+(delay == 0 ? 1 : delay)+1;
update_time=0;
- if (resource_info->update != MagickFalse)
+ if (IfMagickTrue(resource_info->update) )
{
MagickBooleanType
status;
Determine when file data was last modified.
*/
status=GetPathAttributes(display_image->filename,&attributes);
- if (status != MagickFalse)
+ if (IfMagickTrue(status) )
update_time=attributes.st_mtime;
}
*state&=(~FormerImageState);
/*
Handle a window event.
*/
- if (windows->image.mapped != MagickFalse)
+ if (IfMagickTrue(windows->image.mapped) )
if ((display_image->delay != 0) || (resource_info->update != 0))
{
if (timer < time((time_t *) NULL))
{
- if (resource_info->update == MagickFalse)
+ if (IfMagickFalse(resource_info->update) )
*state|=NextImageState | ExitState;
else
{
Determine if image file was modified.
*/
status=GetPathAttributes(display_image->filename,&attributes);
- if (status != MagickFalse)
+ if (IfMagickTrue(status) )
if (update_time != attributes.st_mtime)
{
/*
Redisplay image.
*/
(void) FormatLocaleString(
- resource_info->image_info->filename,MaxTextExtent,
+ resource_info->image_info->filename,MagickPathExtent,
"%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);
- *state|=NextImageState | ExitState;
- }
+ *state|=NextImageState | ExitState;
}
delay=display_image->delay/MagickMax(
display_image->ticks_per_second,1L);
}
timestamp=time((time_t *) NULL);
(void) XNextEvent(display,&event);
- if (windows->image.stasis == MagickFalse)
- windows->image.stasis=(time((time_t *) NULL)-timestamp) > 0 ?
- MagickTrue : MagickFalse;
- if (windows->magnify.stasis == MagickFalse)
- windows->magnify.stasis=(time((time_t *) NULL)-timestamp) > 0 ?
- MagickTrue : MagickFalse;
+ if ((windows->image.stasis == MagickFalse) ||
+ (windows->magnify.stasis == MagickFalse))
+ {
+ if ((time((time_t *) NULL)-timestamp) > 0)
+ {
+ windows->image.stasis=MagickTrue;
+ windows->magnify.stasis=MagickTrue;
+ }
+ }
if (event.xany.window == windows->command.id)
{
/*
id=XCommandWidget(display,windows,CommandMenu,&event);
if (id < 0)
continue;
- (void) CopyMagickString(command,CommandMenu[id],MaxTextExtent);
+ (void) CopyMagickString(command,CommandMenu[id],MagickPathExtent);
command_type=CommandMenus[id];
if (id < MagickMenus)
{
command);
if (entry < 0)
continue;
- (void) CopyMagickString(command,Menus[id][entry],MaxTextExtent);
+ (void) CopyMagickString(command,Menus[id][entry],MagickPathExtent);
command_type=Commands[id][entry];
}
if (command_type != NullCommand)
{
case ButtonPress:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Button Press: 0x%lx %u +%d+%d",event.xbutton.window,
event.xbutton.button,event.xbutton.x,event.xbutton.y);
/*
Map/unmap Command widget.
*/
- if (windows->command.mapped != MagickFalse)
+ if (IfMagickTrue(windows->command.mapped) )
(void) XWithdrawWindow(display,windows->command.id,
windows->command.screen);
else
*/
(void) XMagickCommand(display,resource_info,windows,ZoomCommand,
&display_image,exception);
- XMagnifyImage(display,windows,&event);
+ XMagnifyImage(display,windows,&event,exception);
break;
}
case Button3:
*/
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)
}
default:
{
- XPanImage(display,windows,&event);
+ XPanImage(display,windows,&event,exception);
break;
}
}
}
case ButtonRelease:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Button Release: 0x%lx %u +%d+%d",event.xbutton.window,
event.xbutton.button,event.xbutton.x,event.xbutton.y);
}
case ClientMessage:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Client Message: 0x%lx 0x%lx %d 0x%lx",event.xclient.window,
event.xclient.message_type,event.xclient.format,(unsigned long)
(unsigned long) magick_windows[i]->mask,
&magick_windows[i]->attributes);
}
- if (windows->pan.mapped != MagickFalse)
+ if (IfMagickTrue(windows->pan.mapped) )
{
(void) XSetWindowBackgroundPixmap(display,windows->pan.id,
windows->pan.pixmap);
break;
selection=XInternAtom(display,"DndSelection",MagickFalse);
status=XGetWindowProperty(display,root_window,selection,0L,(long)
- MaxTextExtent,MagickFalse,(Atom) AnyPropertyType,&type,&format,
+ MagickPathExtent,MagickFalse,(Atom) AnyPropertyType,&type,&format,
&length,&after,&data);
if ((status != Success) || (length == 0))
break;
Offix DND.
*/
(void) CopyMagickString(resource_info->image_info->filename,
- (char *) data,MaxTextExtent);
+ (char *) data,MagickPathExtent);
}
else
{
break;
}
(void) CopyMagickString(resource_info->image_info->filename,
- ((char *) data)+5,MaxTextExtent);
+ ((char *) data)+5,MagickPathExtent);
}
- 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);
}
case ConfigureNotify:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Configure Notify: 0x%lx %dx%d+%d+%d %d",event.xconfigure.window,
event.xconfigure.width,event.xconfigure.height,event.xconfigure.x,
Position the transient windows relative of the Image window.
*/
if (windows->command.geometry == (char *) NULL)
- if (windows->command.mapped == MagickFalse)
+ if (IfMagickFalse(windows->command.mapped) )
{
windows->command.x=event.xconfigure.x-
windows->command.width-25;
&window_changes);
}
if (windows->widget.geometry == (char *) NULL)
- if (windows->widget.mapped == MagickFalse)
+ if (IfMagickFalse(windows->widget.mapped) )
{
windows->widget.x=event.xconfigure.x+
event.xconfigure.width/10;
&window_changes);
}
if (windows->magnify.geometry == (char *) NULL)
- if (windows->magnify.mapped == MagickFalse)
+ if (IfMagickFalse(windows->magnify.mapped) )
{
windows->magnify.x=event.xconfigure.x+
event.xconfigure.width+25;
&window_changes);
}
if (windows->pan.geometry == (char *) NULL)
- if (windows->pan.mapped == MagickFalse)
+ if (IfMagickFalse(windows->pan.mapped) )
{
windows->pan.x=event.xconfigure.x+
event.xconfigure.width+25;
windows->image.x=vid_info.x;
windows->image.y=vid_info.y;
}
- if ((windows->image.mapped != MagickFalse) &&
- (windows->image.stasis != MagickFalse))
+ if (IfMagickTrue(windows->image.mapped) &&
+ IfMagickTrue(windows->image.stasis) )
{
/*
Update image window configuration.
XDrawPanRectangle(display,windows);
}
else
- if (windows->pan.mapped != MagickFalse)
+ if (IfMagickTrue(windows->pan.mapped) )
(void) XWithdrawWindow(display,windows->pan.id,
windows->pan.screen);
break;
*/
windows->magnify.width=(unsigned int) event.xconfigure.width;
windows->magnify.height=(unsigned int) event.xconfigure.height;
- if (windows->magnify.mapped == MagickFalse)
+ if (IfMagickFalse(windows->magnify.mapped) )
break;
magnify=1;
while ((int) magnify <= event.xconfigure.width)
&window_changes);
break;
}
- if ((windows->magnify.mapped != MagickFalse) &&
- (windows->magnify.stasis != MagickFalse))
+ if (IfMagickTrue(windows->magnify.mapped) &&
+ IfMagickTrue(windows->magnify.stasis) )
{
status=XMakeImage(display,resource_info,&windows->magnify,
display_image,windows->magnify.width,windows->magnify.height,
exception);
- XMakeMagnifyImage(display,windows);
+ XMakeMagnifyImage(display,windows,exception);
}
break;
}
- if ((windows->magnify.mapped != MagickFalse) &&
+ if (IfMagickTrue(windows->magnify.mapped) &&
(event.xconfigure.window == windows->pan.id))
{
/*
/*
Group leader has exited.
*/
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Destroy Notify: 0x%lx",event.xdestroywindow.window);
if (event.xdestroywindow.window == windows->group_leader.id)
}
case Expose:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Expose: 0x%lx %dx%d+%d+%d",event.xexpose.window,
event.xexpose.width,event.xexpose.height,event.xexpose.x,
Refresh windows that are now exposed.
*/
if ((event.xexpose.window == windows->image.id) &&
- (windows->image.mapped != MagickFalse))
+ IfMagickTrue(windows->image.mapped) )
{
XRefreshWindow(display,&windows->image,&event);
delay=display_image->delay/MagickMax(
break;
}
if ((event.xexpose.window == windows->magnify.id) &&
- (windows->magnify.mapped != MagickFalse))
+ IfMagickTrue(windows->magnify.mapped))
{
- XMakeMagnifyImage(display,windows);
+ XMakeMagnifyImage(display,windows,exception);
break;
}
if (event.xexpose.window == windows->pan.id)
length=XLookupString((XKeyEvent *) &event.xkey,command,(int)
sizeof(command),&key_symbol,(XComposeStatus *) NULL);
*(command+length)='\0';
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Key press: %d 0x%lx (%s)",event.xkey.state,(unsigned long)
key_symbol,command);
&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))
*/
(void) XLookupString((XKeyEvent *) &event.xkey,command,(int)
sizeof(command),&key_symbol,(XComposeStatus *) NULL);
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Key release: 0x%lx (%c)",(unsigned long) key_symbol,*command);
break;
}
case MapNotify:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Map Notify: 0x%lx",
event.xmap.window);
if (event.xmap.window == windows->backdrop.id)
}
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);
*/
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);
after,
length;
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Property Notify: 0x%lx 0x%lx %d",event.xproperty.window,
event.xproperty.atom,event.xproperty.state);
Display image named by the remote command protocol.
*/
status=XGetWindowProperty(display,event.xproperty.window,
- event.xproperty.atom,0L,(long) MaxTextExtent,MagickFalse,(Atom)
+ event.xproperty.atom,0L,(long) MagickPathExtent,MagickFalse,(Atom)
AnyPropertyType,&type,&format,&length,&after,&data);
if ((status != Success) || (length == 0))
break;
break;
}
(void) CopyMagickString(resource_info->image_info->filename,
- (char *) data,MaxTextExtent);
+ (char *) data,MagickPathExtent);
(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;
}
case ReparentNotify:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Reparent Notify: 0x%lx=>0x%lx",event.xreparent.parent,
event.xreparent.window);
}
case UnmapNotify:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),
"Unmap Notify: 0x%lx",event.xunmap.window);
if (event.xunmap.window == windows->backdrop.id)
{
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;
}
default:
{
- if (display_image->debug != MagickFalse)
+ if (IfMagickTrue(display_image->debug) )
(void) LogMagickEvent(X11Event,GetMagickModule(),"Event type: %d",
event.type);
break;
(void) XMagickCommand(display,resource_info,windows,FreeBuffersCommand,
&display_image,exception);
else
- if (resource_info->confirm_edit != MagickFalse)
+ if (IfMagickTrue(resource_info->confirm_edit) )
{
/*
Query user if image has changed.
*/
- if ((resource_info->immutable == MagickFalse) &&
- (display_image->taint != MagickFalse))
+ if (IfMagickFalse(resource_info->immutable) &&
+ IfMagickTrue(display_image->taint))
{
int
status;
/*
Withdraw pan and Magnify window.
*/
- if (windows->info.mapped != MagickFalse)
+ if (IfMagickTrue(windows->info.mapped) )
(void) XWithdrawWindow(display,windows->info.id,windows->info.screen);
- if (windows->magnify.mapped != MagickFalse)
+ if (IfMagickTrue(windows->magnify.mapped) )
(void) XWithdrawWindow(display,windows->magnify.id,
windows->magnify.screen);
- if (windows->command.mapped != MagickFalse)
+ if (IfMagickTrue(windows->command.mapped) )
(void) XWithdrawWindow(display,windows->command.id,
windows->command.screen);
}
- if (windows->pan.mapped != MagickFalse)
+ if (IfMagickTrue(windows->pan.mapped) )
(void) XWithdrawWindow(display,windows->pan.id,windows->pan.screen);
- if (resource_info->backdrop == MagickFalse)
+ if (IfMagickFalse(resource_info->backdrop) )
if (windows->backdrop.mapped)
{
(void) XWithdrawWindow(display,windows->backdrop.id,
/*
Change to home directory.
*/
- directory=getcwd(working_directory,MaxTextExtent);
+ directory=getcwd(working_directory,MagickPathExtent);
(void) directory;
{
int
status;
+ if (*resource_info->home_directory == '\0')
+ (void) CopyMagickString(resource_info->home_directory,".",MagickPathExtent);
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);
Image *image,ExceptionInfo *exception)
{
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
+ assert(image->signature == MagickCoreSignature);
+ (void) image_info;
+ if (IfMagickTrue(image->debug) )
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
(void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
- "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image->filename);
+ "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image->filename);
return(MagickFalse);
}
\f
const char *window,const char *filename,ExceptionInfo *exception)
{
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
assert(filename != (char *) NULL);
(void) window;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",filename);
(void) ThrowMagickException(exception,GetMagickModule(),MissingDelegateError,
- "DelegateLibrarySupportNotBuiltIn","`%s' (X11)",image_info->filename);
+ "DelegateLibrarySupportNotBuiltIn","'%s' (X11)",image_info->filename);
return(MagickFalse);
}
#endif