% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
#include "MagickCore/color-private.h"
#include "MagickCore/colormap.h"
#include "MagickCore/composite.h"
+#include "MagickCore/constitute.h"
#include "MagickCore/display.h"
+#include "MagickCore/distort.h"
#include "MagickCore/exception.h"
#include "MagickCore/exception-private.h"
#include "MagickCore/geometry.h"
#include "MagickCore/magick.h"
#include "MagickCore/memory_.h"
#include "MagickCore/monitor.h"
+#include "MagickCore/nt-base-private.h"
#include "MagickCore/option.h"
#include "MagickCore/pixel-accessor.h"
#include "MagickCore/PreRvIcccm.h"
#include "MagickCore/quantum-private.h"
#include "MagickCore/resource_.h"
#include "MagickCore/resize.h"
-#include "MagickCore/shear.h"
#include "MagickCore/statistic.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/transform.h"
+#include "MagickCore/token.h"
#include "MagickCore/utility.h"
+#include "MagickCore/utility-private.h"
#include "MagickCore/widget.h"
+#include "MagickCore/widget-private.h"
#include "MagickCore/xwindow.h"
#include "MagickCore/xwindow-private.h"
#include "MagickCore/version.h"
static const char
*XVisualClassName(const int);
-static MagickRealType
+static double
blue_gamma = 1.0,
green_gamma = 1.0,
red_gamma = 1.0;
static void
XMakeImageLSBFirst(const XResourceInfo *,const XWindowInfo *,Image *,
- XImage *,XImage *),
+ XImage *,XImage *,ExceptionInfo *),
XMakeImageMSBFirst(const XResourceInfo *,const XWindowInfo *,Image *,
- XImage *,XImage *);
+ XImage *,XImage *,ExceptionInfo *);
static Window
XSelectWindow(Display *,RectangleInfo *);
if (windows->class_hints != (XClassHint *) NULL)
{
if (windows->class_hints->res_name != (char *) NULL)
- XFree(windows->class_hints->res_name);
+ windows->class_hints->res_name=DestroyString(
+ windows->class_hints->res_name);
if (windows->class_hints->res_class != (char *) NULL)
- XFree(windows->class_hints->res_class);
+ windows->class_hints->res_class=DestroyString(
+ windows->class_hints->res_class);
XFree(windows->class_hints);
windows->class_hints=(XClassHint *) NULL;
}
% The format of the XAnnotateImage method is:
%
% MagickBooleanType XAnnotateImage(Display *display,
-% const XPixelInfo *pixel,XAnnotateInfo *annotate_info,Image *image)
+% const XPixelInfo *pixel,XAnnotateInfo *annotate_info,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport MagickBooleanType XAnnotateImage(Display *display,
- const XPixelInfo *pixel,XAnnotateInfo *annotate_info,Image *image)
+MagickPrivate MagickBooleanType XAnnotateImage(Display *display,
+ const XPixelInfo *pixel,XAnnotateInfo *annotate_info,Image *image,
+ ExceptionInfo *exception)
{
CacheView
*annotate_view;
GC
annotate_context;
- ExceptionInfo
- *exception;
-
Image
*annotate_image;
x,
y;
- MagickBooleanType
- matte;
+ PixelTrait
+ alpha_trait;
Pixmap
annotate_pixmap;
/*
Initialize annotated image.
*/
- annotate_image=AcquireImage((ImageInfo *) NULL);
+ annotate_image=AcquireImage((ImageInfo *) NULL,exception);
if (annotate_image == (Image *) NULL)
return(MagickFalse);
annotate_image->columns=annotate_info->width;
x=0;
y=0;
(void) XParseGeometry(annotate_info->geometry,&x,&y,&width,&height);
- (void) GetOneVirtualPixel(image,(ssize_t) x,(ssize_t) y,
- &annotate_image->background_color,&image->exception);
+ (void) GetOneVirtualPixelInfo(image,UndefinedVirtualPixelMethod,(ssize_t) x,
+ (ssize_t) y,&annotate_image->background_color,exception);
if (annotate_info->stencil == ForegroundStencil)
- annotate_image->matte=MagickTrue;
- exception=(&image->exception);
- annotate_view=AcquireCacheView(annotate_image);
+ annotate_image->alpha_trait=BlendPixelTrait;
+ annotate_view=AcquireAuthenticCacheView(annotate_image,exception);
for (y=0; y < (int) annotate_image->rows; y++)
{
register int
q=GetCacheViewAuthenticPixels(annotate_view,0,(ssize_t) y,
annotate_image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (int) annotate_image->columns; x++)
{
*/
(void) FormatLocaleString(image_geometry,MaxTextExtent,"%ux%u",
width,height);
- (void) TransformImage(&annotate_image,(char *) NULL,image_geometry);
+ (void) TransformImage(&annotate_image,(char *) NULL,image_geometry,
+ exception);
}
if (annotate_info->degrees != 0.0)
{
int
rotations;
- MagickRealType
+ double
normalized_degrees;
/*
Rotate image.
*/
- rotate_image=
- RotateImage(annotate_image,annotate_info->degrees,&image->exception);
+ rotate_image=RotateImage(annotate_image,annotate_info->degrees,exception);
if (rotate_image == (Image *) NULL)
return(MagickFalse);
annotate_image=DestroyImage(annotate_image);
Composite text onto the image.
*/
(void) XParseGeometry(annotate_info->geometry,&x,&y,&width,&height);
- matte=image->matte;
- (void) CompositeImage(image,annotate_image->matte != MagickFalse ?
- OverCompositeOp : CopyCompositeOp,annotate_image,(ssize_t) x,(ssize_t) y);
- image->matte=matte;
+ alpha_trait=image->alpha_trait;
+ (void) CompositeImage(image,annotate_image,
+ annotate_image->alpha_trait == BlendPixelTrait ? OverCompositeOp :
+ CopyCompositeOp,MagickTrue,(ssize_t) x,(ssize_t) y,exception);
+ image->alpha_trait=alpha_trait;
annotate_image=DestroyImage(annotate_image);
return(MagickTrue);
}
return(fontlist);
}
-MagickExport XFontStruct *XBestFont(Display *display,
+MagickPrivate XFontStruct *XBestFont(Display *display,
const XResourceInfo *resource_info,const MagickBooleanType text_font)
{
static const char
% o image: the image.
%
*/
-MagickExport void XBestIconSize(Display *display,XWindowInfo *window,
+MagickPrivate void XBestIconSize(Display *display,XWindowInfo *window,
Image *image)
{
int
i,
number_sizes;
- MagickRealType
+ double
scale_factor;
unsigned int
/*
Look for an icon size that maintains the aspect ratio of image.
*/
- scale_factor=(MagickRealType) icon_size->max_width/width;
- if (scale_factor > ((MagickRealType) icon_size->max_height/height))
- scale_factor=(MagickRealType) icon_size->max_height/height;
+ scale_factor=(double) icon_size->max_width/width;
+ if (scale_factor > ((double) icon_size->max_height/height))
+ scale_factor=(double) icon_size->max_height/height;
icon_width=(unsigned int) icon_size->min_width;
while ((int) icon_width < icon_size->max_width)
{
% o color: Specifies the desired RGB value to find in the colors array.
%
*/
-MagickExport void XBestPixel(Display *display,const Colormap colormap,
+MagickPrivate void XBestPixel(Display *display,const Colormap colormap,
XColor *colors,unsigned int number_colors,XColor *color)
{
MagickBooleanType
PixelInfo
pixel;
- MagickRealType
+ double
min_distance;
- register MagickRealType
+ register double
distance;
register int
number_colors=256;
(void) XQueryColors(display,colormap,colors,(int) number_colors);
}
- min_distance=3.0*((MagickRealType) QuantumRange+1.0)*((MagickRealType)
+ min_distance=3.0*((double) QuantumRange+1.0)*((double)
QuantumRange+1.0);
j=0;
for (i=0; i < (int) number_colors; i++)
{
- pixel.red=colors[i].red-(MagickRealType) color->red;
+ pixel.red=colors[i].red-(double) color->red;
distance=pixel.red*pixel.red;
if (distance > min_distance)
continue;
- pixel.green=colors[i].green-(MagickRealType) color->green;
+ pixel.green=colors[i].green-(double) color->green;
distance+=pixel.green*pixel.green;
if (distance > min_distance)
continue;
- pixel.blue=colors[i].blue-(MagickRealType) color->blue;
+ pixel.blue=colors[i].blue-(double) color->blue;
distance+=pixel.blue*pixel.blue;
if (distance > min_distance)
continue;
return(y);
}
-MagickExport XVisualInfo *XBestVisualInfo(Display *display,
+MagickPrivate XVisualInfo *XBestVisualInfo(Display *display,
XStandardColormap *map_info,XResourceInfo *resource_info)
{
#define MaxStandardColormaps 7
% o cursor: the cursor.
%
*/
-MagickExport int XCheckDefineCursor(Display *display,Window window,
+MagickPrivate int XCheckDefineCursor(Display *display,Window window,
Cursor cursor)
{
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
% o windows: Specifies a pointer to a XWindows structure.
%
*/
-MagickExport void XCheckRefreshWindows(Display *display,XWindows *windows)
+MagickPrivate void XCheckRefreshWindows(Display *display,XWindows *windows)
{
Window
id;
% o timestamp: Specifies a value of type Time.
%
*/
-MagickExport void XClientMessage(Display *display,const Window window,
+MagickPrivate void XClientMessage(Display *display,const Window window,
const Atom protocol,const Atom reason,const Time timestamp)
{
XClientMessageEvent
% XComponentTerminus(void)
%
*/
-MagickExport void XComponentTerminus(void)
+MagickPrivate void XComponentTerminus(void)
{
DestroyXResources();
}
% The format of the XConfigureImageColormap method is:
%
% void XConfigureImageColormap(Display *display,
-% XResourceInfo *resource_info,XWindows *windows,Image *image)
+% XResourceInfo *resource_info,XWindows *windows,Image *image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport void XConfigureImageColormap(Display *display,
- XResourceInfo *resource_info,XWindows *windows,Image *image)
+MagickPrivate void XConfigureImageColormap(Display *display,
+ XResourceInfo *resource_info,XWindows *windows,Image *image,
+ ExceptionInfo *exception)
{
Colormap
colormap;
XSetCursorState(display,windows,MagickTrue);
XCheckRefreshWindows(display,windows);
XMakeStandardColormap(display,windows->visual_info,resource_info,image,
- windows->map_info,windows->pixel_info);
+ windows->map_info,windows->pixel_info,exception);
colormap=windows->map_info->colormap;
(void) XSetWindowColormap(display,windows->image.id,colormap);
(void) XSetWindowColormap(display,windows->command.id,colormap);
% o window_info: Specifies a pointer to a XWindowInfo structure.
%
*/
-MagickExport void XConstrainWindowPosition(Display *display,
+MagickPrivate void XConstrainWindowPosition(Display *display,
XWindowInfo *window_info)
{
int
% returning.
%
*/
-MagickExport void XDelay(Display *display,const size_t milliseconds)
+MagickPrivate void XDelay(Display *display,const size_t milliseconds)
{
assert(display != (Display *) NULL);
(void) XFlush(display);
% o window: Specifies a pointer to a Window structure.
%
*/
-MagickExport void XDestroyWindowColors(Display *display,Window window)
+MagickPrivate void XDestroyWindowColors(Display *display,Window window)
{
Atom
property,
%
% void XDisplayImageInfo(Display *display,
% const XResourceInfo *resource_info,XWindows *windows,Image *undo_image,
-% Image *image)
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport void XDisplayImageInfo(Display *display,
+MagickPrivate void XDisplayImageInfo(Display *display,
const XResourceInfo *resource_info,XWindows *windows,Image *undo_image,
- Image *image)
+ Image *image,ExceptionInfo *exception)
{
char
filename[MaxTextExtent],
for (levels=0; undo_image != (Image *) NULL; levels++)
{
number_pixels=undo_image->list->columns*undo_image->list->rows;
- bytes+=number_pixels*sizeof(PixelPacket);
+ bytes+=number_pixels*sizeof(PixelInfo);
undo_image=GetPreviousImageInList(undo_image);
}
(void) FormatLocaleFile(file,"Undo Edit Cache\n levels: %u\n",levels);
/*
Write info about the image to a file.
*/
- (void) IdentifyImage(image,file,MagickTrue,&image->exception);
+ (void) IdentifyImage(image,file,MagickTrue,exception);
(void) fclose(file);
- text=FileToString(filename,~0,&image->exception);
+ text=FileToString(filename,~0,exception);
(void) RelinquishUniqueFileResource(filename);
if (text == (char *) NULL)
{
%
% The format of the XDitherImage method is:
%
-% void XDitherImage(Image *image,XImage *ximage)
+% void XDitherImage(Image *image,XImage *ximage,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o ximage: Specifies a pointer to a XImage structure; returned from
% XCreateImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-static void XDitherImage(Image *image,XImage *ximage)
+static void XDitherImage(Image *image,XImage *ximage,ExceptionInfo *exception)
{
static const short int
dither_red[2][16]=
value,
y;
- PixelPacket
+ PixelInfo
color;
register char
i=0;
j=0;
q=ximage->data;
- image_view=AcquireCacheView(image);
+ image_view=AcquireVirtualCacheView(image,exception);
for (y=0; y < (int) image->rows; y++)
{
p=GetCacheViewVirtualPixels(image_view,0,(ssize_t) y,image->columns,1,
- &image->exception);
+ exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) image->columns; x++)
{
- color.red=ClampToQuantum((MagickRealType) (red_map[i][j][(int)
- ScaleQuantumToChar(GetPixelRed(image,p))] << 8));
- color.green=ClampToQuantum((MagickRealType) (green_map[i][j][(int)
- ScaleQuantumToChar(GetPixelGreen(image,p))] << 8));
- color.blue=ClampToQuantum((MagickRealType) (blue_map[i][j][(int)
- ScaleQuantumToChar(GetPixelBlue(image,p))] << 8));
+ color.red=(double) ClampToQuantum((double) (red_map[i][j][
+ (int) ScaleQuantumToChar(GetPixelRed(image,p))] << 8));
+ color.green=(double) ClampToQuantum((double) (green_map[i][j][
+ (int) ScaleQuantumToChar(GetPixelGreen(image,p))] << 8));
+ color.blue=(double) ClampToQuantum((double) (blue_map[i][j][
+ (int) ScaleQuantumToChar(GetPixelBlue(image,p))] << 8));
pixel=(size_t) (((size_t) color.red & 0xe0) |
(((size_t) color.green & 0xe0) >> 3) |
(((size_t) color.blue & 0xc0) >> 6));
%
% The format of the XDrawImage method is:
%
-% MagickBooleanType XDrawImage(display,pixel,draw_info,image)
+% MagickBooleanType XDrawImage(Display *display,const XPixelInfo *pixel,
+% XDrawInfo *draw_info,Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport MagickBooleanType XDrawImage(Display *display,
- const XPixelInfo *pixel,XDrawInfo *draw_info,Image *image)
+MagickPrivate MagickBooleanType XDrawImage(Display *display,
+ const XPixelInfo *pixel,XDrawInfo *draw_info,Image *image,
+ ExceptionInfo *exception)
{
CacheView
*draw_view;
- ExceptionInfo
- *exception;
-
GC
draw_context;
x,
y;
- MagickBooleanType
- matte;
+ PixelTrait
+ alpha_trait;
Pixmap
draw_pixmap;
/*
Initialize draw image.
*/
- draw_image=AcquireImage((ImageInfo *) NULL);
+ draw_image=AcquireImage((ImageInfo *) NULL,exception);
if (draw_image == (Image *) NULL)
return(MagickFalse);
draw_image->columns=draw_info->width;
x=0;
y=0;
(void) XParseGeometry(draw_info->geometry,&x,&y,&width,&height);
- (void) GetOneVirtualPixel(image,(ssize_t) x,(ssize_t) y,
- &draw_image->background_color,&image->exception);
- if (SetImageStorageClass(draw_image,DirectClass,&image->exception) == MagickFalse)
+ (void) GetOneVirtualPixelInfo(image,UndefinedVirtualPixelMethod,(ssize_t) x,
+ (ssize_t) y,&draw_image->background_color,exception);
+ if (SetImageStorageClass(draw_image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
- draw_image->matte=MagickTrue;
- exception=(&image->exception);
- draw_view=AcquireCacheView(draw_image);
+ draw_image->alpha_trait=BlendPixelTrait;
+ draw_view=AcquireAuthenticCacheView(draw_image,exception);
for (y=0; y < (int) draw_image->rows; y++)
{
register int
q=QueueCacheViewAuthenticPixels(draw_view,0,(ssize_t) y,draw_image->columns,
1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (int) draw_image->columns; x++)
{
/*
Set this pixel to the background color.
*/
- SetPixelPacket(draw_image,&draw_image->background_color,q);
- SetPixelAlpha(draw_image,(Quantum) (draw_info->stencil ==
+ SetPixelInfoPixel(draw_image,&draw_image->background_color,q);
+ SetPixelAlpha(draw_image,(Quantum) (draw_info->stencil ==
OpaqueStencil ? TransparentAlpha : OpaqueAlpha),q);
}
else
*/
(void) FormatLocaleString(image_geometry,MaxTextExtent,"%ux%u",
width,height);
- (void) TransformImage(&draw_image,(char *) NULL,image_geometry);
+ (void) TransformImage(&draw_image,(char *) NULL,image_geometry,
+ exception);
}
if (draw_info->degrees != 0.0)
{
int
rotations;
- MagickRealType
+ double
normalized_degrees;
/*
Rotate image.
*/
- rotate_image=RotateImage(draw_image,draw_info->degrees,&image->exception);
+ rotate_image=RotateImage(draw_image,draw_info->degrees,exception);
if (rotate_image == (Image *) NULL)
return(MagickFalse);
draw_image=DestroyImage(draw_image);
/*
Composite text onto the image.
*/
- draw_view=AcquireCacheView(draw_image);
+ draw_view=AcquireAuthenticCacheView(draw_image,exception);
for (y=0; y < (int) draw_image->rows; y++)
{
register int
q=GetCacheViewAuthenticPixels(draw_view,0,(ssize_t) y,draw_image->columns,1,
exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (int) draw_image->columns; x++)
{
draw_view=DestroyCacheView(draw_view);
(void) XParseGeometry(draw_info->geometry,&x,&y,&width,&height);
if (draw_info->stencil == TransparentStencil)
- (void) CompositeImage(image,CopyOpacityCompositeOp,draw_image,(ssize_t) x,
- (ssize_t) y);
+ (void) CompositeImage(image,draw_image,CopyAlphaCompositeOp,MagickTrue,
+ (ssize_t) x,(ssize_t) y,exception);
else
{
- matte=image->matte;
- (void) CompositeImage(image,OverCompositeOp,draw_image,(ssize_t) x,
- (ssize_t) y);
- image->matte=matte;
+ alpha_trait=image->alpha_trait;
+ (void) CompositeImage(image,draw_image,OverCompositeOp,MagickTrue,
+ (ssize_t) x,(ssize_t) y,exception);
+ image->alpha_trait=alpha_trait;
}
draw_image=DestroyImage(draw_image);
return(MagickTrue);
%
% XError() ignores BadWindow errors for XQueryTree and XGetWindowAttributes,
% and ignores BadDrawable errors for XGetGeometry, and ignores BadValue errors
-% for XQueryColor. It returns MagickFalse in those cases. Otherwise it returns
-% True.
+% for XQueryColor. It returns MagickFalse in those cases. Otherwise it
+% returns True.
%
% The format of the XError function is:
%
-% XError(display,error)
+% int XError(display,error)
%
% A description of each parameter follows:
%
% o window_info: Specifies a pointer to a X11 XWindowInfo structure.
%
*/
-MagickExport void XFreeResources(Display *display,XVisualInfo *visual_info,
+MagickPrivate void XFreeResources(Display *display,XVisualInfo *visual_info,
XStandardColormap *map_info,XPixelInfo *pixel,XFontStruct *font_info,
XResourceInfo *resource_info,XWindowInfo *window_info)
{
% o pixel: Specifies a pointer to a XPixelInfo structure.
%
*/
-MagickExport void XFreeStandardColormap(Display *display,
+MagickPrivate void XFreeStandardColormap(Display *display,
const XVisualInfo *visual_info,XStandardColormap *map_info,XPixelInfo *pixel)
{
/*
% o annotate_info: Specifies a pointer to a XAnnotateInfo structure.
%
*/
-MagickExport void XGetAnnotateInfo(XAnnotateInfo *annotate_info)
+MagickPrivate void XGetAnnotateInfo(XAnnotateInfo *annotate_info)
{
/*
Initialize annotate structure.
% o map_info: Specifies a pointer to a X11 XStandardColormap structure.
%
*/
-MagickExport void XGetMapInfo(const XVisualInfo *visual_info,
+MagickPrivate void XGetMapInfo(const XVisualInfo *visual_info,
const Colormap colormap,XStandardColormap *map_info)
{
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% XGetPixelInfo() initializes the PixelPacket structure.
+% XGetPixelInfo() initializes the PixelInfo structure.
%
% The format of the XGetPixelInfo method is:
%
% o pixel: Specifies a pointer to a XPixelInfo structure.
%
*/
-MagickExport void XGetPixelInfo(Display *display,
+MagickPrivate void XGetPixelInfo(Display *display,
const XVisualInfo *visual_info,const XStandardColormap *map_info,
const XResourceInfo *resource_info,Image *image,XPixelInfo *pixel)
{
Colormap
colormap;
+ extern const char
+ BorderColor[],
+ ForegroundColor[];
+
register ssize_t
i;
/*
Set shadow color.
*/
- pixel->shadow_color.red=(unsigned short) (((MagickRealType)
+ pixel->shadow_color.red=(unsigned short) (((double)
pixel->matte_color.red*ScaleQuantumToShort(ShadowModulate))/65535L);
- pixel->shadow_color.green=(unsigned short) (((MagickRealType)
+ pixel->shadow_color.green=(unsigned short) (((double)
pixel->matte_color.green*ScaleQuantumToShort(ShadowModulate))/65535L);
- pixel->shadow_color.blue=(unsigned short) (((MagickRealType)
+ pixel->shadow_color.blue=(unsigned short) (((double)
pixel->matte_color.blue*ScaleQuantumToShort(ShadowModulate))/65535L);
pixel->shadow_color.pixel=XStandardPixel(map_info,&pixel->shadow_color);
pixel->shadow_color.flags=(char) (DoRed | DoGreen | DoBlue);
/*
Set depth color.
*/
- pixel->depth_color.red=(unsigned short) (((MagickRealType)
+ pixel->depth_color.red=(unsigned short) (((double)
pixel->matte_color.red*ScaleQuantumToShort(DepthModulate))/65535L);
- pixel->depth_color.green=(unsigned short) (((MagickRealType)
+ pixel->depth_color.green=(unsigned short) (((double)
pixel->matte_color.green*ScaleQuantumToShort(DepthModulate))/65535L);
- pixel->depth_color.blue=(unsigned short) (((MagickRealType)
+ pixel->depth_color.blue=(unsigned short) (((double)
pixel->matte_color.blue*ScaleQuantumToShort(DepthModulate))/65535L);
pixel->depth_color.pixel=XStandardPixel(map_info,&pixel->depth_color);
pixel->depth_color.flags=(char) (DoRed | DoGreen | DoBlue);
/*
Set trough color.
*/
- pixel->trough_color.red=(unsigned short) (((MagickRealType)
+ pixel->trough_color.red=(unsigned short) (((double)
pixel->matte_color.red*ScaleQuantumToShort(TroughModulate))/65535L);
- pixel->trough_color.green=(unsigned short) (((MagickRealType)
+ pixel->trough_color.green=(unsigned short) (((double)
pixel->matte_color.green*ScaleQuantumToShort(TroughModulate))/65535L);
- pixel->trough_color.blue=(unsigned short) (((MagickRealType)
+ pixel->trough_color.blue=(unsigned short) (((double)
pixel->matte_color.blue*ScaleQuantumToShort(TroughModulate))/65535L);
pixel->trough_color.pixel=XStandardPixel(map_info,&pixel->trough_color);
pixel->trough_color.flags=(char) (DoRed | DoGreen | DoBlue);
*directory,
*resource_value;
+ extern const char
+ BorderColor[],
+ ForegroundColor[];
+
/*
Initialize resource info fields.
*/
resource_info->client_name=AcquireString(client_name);
resource_value=XGetResourceClass(database,client_name,"backdrop",
(char *) "False");
- resource_info->backdrop=IsMagickTrue(resource_value);
+ resource_info->backdrop=IsStringTrue(resource_value);
resource_info->background_color=XGetResourceInstance(database,client_name,
"background",(char *) "#d6d6d6d6d6d6");
resource_info->border_color=XGetResourceInstance(database,client_name,
resource_value);
resource_value=XGetResourceClass(database,client_name,
"colorRecovery",(char *) "False");
- resource_info->color_recovery=IsMagickTrue(resource_value);
+ resource_info->color_recovery=IsStringTrue(resource_value);
resource_value=XGetResourceClass(database,client_name,"confirmExit",
(char *) "False");
- resource_info->confirm_exit=IsMagickTrue(resource_value);
+ resource_info->confirm_exit=IsStringTrue(resource_value);
resource_value=XGetResourceClass(database,client_name,"confirmEdit",
(char *) "False");
- resource_info->confirm_edit=IsMagickTrue(resource_value);
+ resource_info->confirm_edit=IsStringTrue(resource_value);
resource_value=XGetResourceClass(database,client_name,"delay",(char *) "1");
resource_info->delay=(unsigned int) StringToUnsignedLong(resource_value);
resource_info->display_gamma=XGetResourceClass(database,client_name,
"displayGamma",(char *) "2.2");
resource_value=XGetResourceClass(database,client_name,"displayWarnings",
(char *) "True");
- resource_info->display_warnings=IsMagickTrue(resource_value);
+ resource_info->display_warnings=IsStringTrue(resource_value);
resource_info->font=XGetResourceClass(database,client_name,"font",
(char *) NULL);
resource_info->font=XGetResourceClass(database,client_name,"fontList",
resource_info->foreground_color=XGetResourceInstance(database,client_name,
"foreground",ForegroundColor);
resource_value=XGetResourceClass(database,client_name,"gammaCorrect",
- (char *) "True");
- resource_info->gamma_correct=IsMagickTrue(resource_value);
+ (char *) "False");
+ resource_info->gamma_correct=IsStringTrue(resource_value);
resource_info->image_geometry=ConstantString(XGetResourceClass(database,
client_name,"geometry",(char *) NULL));
resource_value=XGetResourceClass(database,client_name,"gravity",
"iconGeometry",(char *) NULL);
resource_value=XGetResourceClass(database,client_name,"iconic",
(char *) "False");
- resource_info->iconic=IsMagickTrue(resource_value);
+ resource_info->iconic=IsStringTrue(resource_value);
resource_value=XGetResourceClass(database,client_name,"immutable",
LocaleCompare(client_name,"PerlMagick") == 0 ? (char *) "True" :
(char *) "False");
- resource_info->immutable=IsMagickTrue(resource_value);
+ resource_info->immutable=IsStringTrue(resource_value);
resource_value=XGetResourceClass(database,client_name,"magnify",
(char *) "3");
resource_info->magnify=(unsigned int) StringToUnsignedLong(resource_value);
resource_info->title=XGetResourceClass(database,client_name,"title",
(char *) NULL);
resource_value=XGetResourceClass(database,client_name,"undoCache",
- (char *) "16");
+ (char *) "256");
resource_info->undo_cache=(unsigned int) StringToUnsignedLong(resource_value);
resource_value=XGetResourceClass(database,client_name,"update",
(char *) "False");
- resource_info->update=IsMagickTrue(resource_value);
+ resource_info->update=IsStringTrue(resource_value);
resource_value=XGetResourceClass(database,client_name,"usePixmap",
(char *) "True");
- resource_info->use_pixmap=IsMagickTrue(resource_value);
+ resource_info->use_pixmap=IsStringTrue(resource_value);
resource_value=XGetResourceClass(database,client_name,"sharedMemory",
(char *) "True");
- resource_info->use_shared_memory=IsMagickTrue(resource_value);
+ resource_info->use_shared_memory=IsStringTrue(resource_value);
resource_info->visual_type=XGetResourceClass(database,client_name,"visual",
(char *) NULL);
resource_info->window_group=XGetResourceClass(database,client_name,
% The format of the XGetWindowColor method is:
%
% MagickBooleanType XGetWindowColor(Display *display,XWindows *windows,
-% char *name)
+% char *name,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o name: the name of the color if found in the X Color Database is
% returned in this character string.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport MagickBooleanType XGetWindowColor(Display *display,
- XWindows *windows,char *name)
+MagickPrivate MagickBooleanType XGetWindowColor(Display *display,
+ XWindows *windows,char *name,ExceptionInfo *exception)
{
int
x,
y;
- PixelPacket
+ PixelInfo
pixel;
RectangleInfo
Match color against the color database.
*/
(void) XQueryColor(display,window_attributes.colormap,&color);
- pixel.red=ScaleShortToQuantum(color.red);
- pixel.green=ScaleShortToQuantum(color.green);
- pixel.blue=ScaleShortToQuantum(color.blue);
+ pixel.red=(double) ScaleShortToQuantum(color.red);
+ pixel.green=(double) ScaleShortToQuantum(color.green);
+ pixel.blue=(double) ScaleShortToQuantum(color.blue);
pixel.alpha=OpaqueAlpha;
(void) QueryColorname(windows->image.image,&pixel,X11Compliance,name,
- &windows->image.image->exception);
+ exception);
return(MagickTrue);
}
\f
% The format of the XGetWindowImage method is:
%
% Image *XGetWindowImage(Display *display,const Window window,
-% const unsigned int borders,const unsigned int level)
+% const unsigned int borders,const unsigned int level,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% one call. A value of one causes the function to descend the window
% hierarchy and overlay the target image with each subwindow image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static Image *XGetWindowImage(Display *display,const Window window,
- const unsigned int borders,const unsigned int level)
+ const unsigned int borders,const unsigned int level,ExceptionInfo *exception)
{
typedef struct _ColormapInfo
{
if ((status == True) && (number_children != 0))
{
for (i=0; i < (int) number_children; i++)
- (void) XGetWindowImage(display,children[i],MagickFalse,level+1);
+ (void) XGetWindowImage(display,children[i],MagickFalse,level+1,
+ exception);
(void) XFree((void *) children);
}
}
ColormapInfo
*next;
- ExceptionInfo
- *exception;
-
Image
*composite_image,
*image;
/*
Allocate image structure.
*/
- composite_image=AcquireImage((ImageInfo *) NULL);
+ composite_image=AcquireImage((ImageInfo *) NULL,exception);
if (composite_image == (Image *) NULL)
{
XDestroyImage(ximage);
composite_image->storage_class=PseudoClass;
composite_image->columns=(size_t) ximage->width;
composite_image->rows=(size_t) ximage->height;
- exception=(&composite_image->exception);
- composite_view=AcquireCacheView(composite_image);
+ composite_view=AcquireAuthenticCacheView(composite_image,exception);
switch (composite_image->storage_class)
{
case DirectClass:
{
q=QueueCacheViewAuthenticPixels(composite_view,0,(ssize_t) y,
composite_image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (int) composite_image->columns; x++)
{
ScaleShortToQuantum(colors[index].blue),q);
q+=GetPixelChannels(composite_image);
}
- if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
+ status=SyncCacheViewAuthenticPixels(composite_view,exception);
+ if (status == MagickFalse)
break;
}
else
{
q=QueueCacheViewAuthenticPixels(composite_view,0,(ssize_t) y,
composite_image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (int) composite_image->columns; x++)
{
ScaleShortToQuantum((unsigned short) color),q);
q+=GetPixelChannels(composite_image);
}
- if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
+ status=SyncCacheViewAuthenticPixels(composite_view,exception);
+ if (status == MagickFalse)
break;
}
break;
/*
Create colormap.
*/
- if (AcquireImageColormap(composite_image,number_colors) == MagickFalse)
+ status=AcquireImageColormap(composite_image,number_colors,
+ exception);
+ if (status == MagickFalse)
{
XDestroyImage(ximage);
composite_image=DestroyImage(composite_image);
}
for (i=0; i < (int) composite_image->colors; i++)
{
- composite_image->colormap[colors[i].pixel].red=
+ composite_image->colormap[colors[i].pixel].red=(double)
ScaleShortToQuantum(colors[i].red);
- composite_image->colormap[colors[i].pixel].green=
+ composite_image->colormap[colors[i].pixel].green=(double)
ScaleShortToQuantum(colors[i].green);
- composite_image->colormap[colors[i].pixel].blue=
+ composite_image->colormap[colors[i].pixel].blue=(double)
ScaleShortToQuantum(colors[i].blue);
}
/*
{
q=QueueCacheViewAuthenticPixels(composite_view,0,(ssize_t) y,
composite_image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (int) composite_image->columns; x++)
{
index=(Quantum) XGetPixel(ximage,x,y);
SetPixelIndex(composite_image,index,q);
- SetPixelPacket(composite_image,
+ SetPixelInfoPixel(composite_image,
composite_image->colormap+(ssize_t) index,q);
q+=GetPixelChannels(composite_image);
}
- if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
+ status=SyncCacheViewAuthenticPixels(composite_view,exception);
+ if (status == MagickFalse)
break;
}
break;
y_offset-=(int) crop_info.y;
if (y_offset < 0)
y_offset=0;
- (void) CompositeImage(image,CopyCompositeOp,composite_image,(ssize_t)
- x_offset,(ssize_t) y_offset);
+ (void) CompositeImage(image,composite_image,CopyCompositeOp,MagickTrue,
+ (ssize_t) x_offset,(ssize_t) y_offset,exception);
+ composite_image=DestroyImage(composite_image);
}
/*
Relinquish resources.
while (colormap_info != (ColormapInfo *) NULL)
{
next=colormap_info->next;
- colormap_info->colors=(XColor *)
- RelinquishMagickMemory(colormap_info->colors);
+ colormap_info->colors=(XColor *) RelinquishMagickMemory(
+ colormap_info->colors);
colormap_info=(ColormapInfo *) RelinquishMagickMemory(colormap_info);
colormap_info=next;
}
% o resource_info: Specifies a pointer to a X11 XResourceInfo structure.
%
*/
-MagickExport void XGetWindowInfo(Display *display,XVisualInfo *visual_info,
+MagickPrivate void XGetWindowInfo(Display *display,XVisualInfo *visual_info,
XStandardColormap *map_info,XPixelInfo *pixel,XFontStruct *font_info,
XResourceInfo *resource_info,XWindowInfo *window)
{
% contains the extents of any highlighting rectangle.
%
*/
-MagickExport void XHighlightEllipse(Display *display,Window window,
+MagickPrivate void XHighlightEllipse(Display *display,Window window,
GC annotate_context,const RectangleInfo *highlight_info)
{
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
% contains the extents of any highlighting rectangle.
%
*/
-MagickExport void XHighlightLine(Display *display,Window window,
+MagickPrivate void XHighlightLine(Display *display,Window window,
GC annotate_context,const XSegment *highlight_info)
{
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
% contains the extents of any highlighting rectangle.
%
*/
-MagickExport void XHighlightRectangle(Display *display,Window window,
+MagickPrivate void XHighlightRectangle(Display *display,Window window,
GC annotate_context,const RectangleInfo *highlight_info)
{
assert(display != (Display *) NULL);
%
% The format of the XImportImage method is:
%
-% Image *XImportImage(const ImageInfo *image_info,XImportInfo *ximage_info)
+% Image *XImportImage(const ImageInfo *image_info,XImportInfo *ximage_info,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o ximage_info: Specifies a pointer to an XImportInfo structure.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
MagickExport Image *XImportImage(const ImageInfo *image_info,
- XImportInfo *ximage_info)
+ XImportInfo *ximage_info,ExceptionInfo *exception)
{
Colormap
*colormaps;
if ((ximage_info->frame == MagickFalse) &&
(prior_target != MagickFalse))
target=prior_target;
- XDelay(display,SuspendTime << 4);
}
}
if (ximage_info->screen)
*/
(void) XGrabServer(display);
image=XGetWindowImage(display,target,ximage_info->borders,
- ximage_info->descend ? 1U : 0U);
+ ximage_info->descend ? 1U : 0U,exception);
(void) XUngrabServer(display);
if (image == (Image *) NULL)
ThrowXWindowFatalException(XServerError,"UnableToReadXWindowImage",
/*
Crop image as defined by the cropping rectangle.
*/
- clone_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ clone_image=CloneImage(image,0,0,MagickTrue,exception);
if (clone_image != (Image *) NULL)
{
- crop_image=CropImage(clone_image,&crop_info,&image->exception);
+ crop_image=CropImage(clone_image,&crop_info,exception);
if (crop_image != (Image *) NULL)
{
image=DestroyImage(image);
% o resource_info: Specifies a pointer to a X11 XResourceInfo structure.
%
*/
-MagickExport XWindows *XInitializeWindows(Display *display,
+MagickPrivate XWindows *XInitializeWindows(Display *display,
XResourceInfo *resource_info)
{
Window
% o foreground_color: Specifies the color to use for the cursor foreground.
%
*/
-MagickExport Cursor XMakeCursor(Display *display,Window window,
+MagickPrivate Cursor XMakeCursor(Display *display,Window window,
Colormap colormap,char *background_color,char *foreground_color)
{
#define scope_height 17
%
% MagickBooleanType XMakeImage(Display *display,
% const XResourceInfo *resource_info,XWindowInfo *window,Image *image,
-% unsigned int width,unsigned int height)
+% unsigned int width,unsigned int height,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o height: Specifies the height in pixels of the rectangular area to
% display.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport MagickBooleanType XMakeImage(Display *display,
+MagickPrivate MagickBooleanType XMakeImage(Display *display,
const XResourceInfo *resource_info,XWindowInfo *window,Image *image,
- unsigned int width,unsigned int height)
+ unsigned int width,unsigned int height,ExceptionInfo *exception)
{
#define CheckOverflowException(length,width,height) \
(((height) != 0) && ((length)/((size_t) height) != ((size_t) width)))
window->image->page.x=0;
window->image->page.y=0;
(void) ParsePageGeometry(window->image,window->crop_geometry,
- &crop_info,&image->exception);
- crop_image=CropImage(window->image,&crop_info,&image->exception);
+ &crop_info,exception);
+ crop_image=CropImage(window->image,&crop_info,exception);
if (crop_image != (Image *) NULL)
{
if (window->image != image)
*/
resize_image=NewImageList();
if (window->pixel_info->colors != 0)
- resize_image=SampleImage(window->image,width,height,
- &image->exception);
+ resize_image=SampleImage(window->image,width,height,exception);
else
- resize_image=ThumbnailImage(window->image,width,height,
- &image->exception);
+ resize_image=ThumbnailImage(window->image,width,height,exception);
if (resize_image != (Image *) NULL)
{
if (window->image != image)
window->ximage=ximage;
matte_image=(XImage *) NULL;
if ((window->shape != MagickFalse) && (window->image != (Image *) NULL))
- if ((window->image->matte != MagickFalse) &&
+ if ((window->image->alpha_trait == BlendPixelTrait) &&
((int) width <= XDisplayWidth(display,window->screen)) &&
((int) height <= XDisplayHeight(display,window->screen)))
{
if ((ximage->byte_order == LSBFirst) || ((ximage->format == XYBitmap) &&
(ximage->bitmap_bit_order == LSBFirst)))
XMakeImageLSBFirst(resource_info,window,window->image,ximage,
- matte_image);
+ matte_image,exception);
else
XMakeImageMSBFirst(resource_info,window,window->image,ximage,
- matte_image);
+ matte_image,exception);
}
if (window->matte_image != (XImage *) NULL)
{
%
% The format of the XMakeImageLSBFirst method is:
%
-% void XMakeImageLSBFirst(Display *display,XWindows *windows)
+% void XMakeImageLSBFirst(Display *display,XWindows *windows,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o matte_image: Specifies a pointer to a XImage structure; returned from
% XCreateImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static void XMakeImageLSBFirst(const XResourceInfo *resource_info,
- const XWindowInfo *window,Image *image,XImage *ximage,XImage *matte_image)
+ const XWindowInfo *window,Image *image,XImage *ximage,XImage *matte_image,
+ ExceptionInfo *exception)
{
CacheView
*canvas_view;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
canvas=image;
if ((window->immutable == MagickFalse) &&
- (image->storage_class == DirectClass) && (image->matte != MagickFalse))
+ (image->storage_class == DirectClass) && (image->alpha_trait == BlendPixelTrait))
{
char
size[MaxTextExtent];
(void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",(double)
image->columns,(double) image->rows);
image_info->size=ConstantString(size);
- pattern=ReadImage(image_info,&image->exception);
+ pattern=ReadImage(image_info,exception);
image_info=DestroyImageInfo(image_info);
if (pattern != (Image *) NULL)
{
- canvas=CloneImage(image,0,0,MagickTrue,&image->exception);
+ canvas=CloneImage(image,0,0,MagickTrue,exception);
if (canvas != (Image *) NULL)
- (void) CompositeImage(canvas,DstOverCompositeOp,pattern,0,0);
+ (void) CompositeImage(canvas,pattern,DstOverCompositeOp,MagickTrue,
+ 0,0,exception);
pattern=DestroyImage(pattern);
}
}
pixels=window->pixel_info->pixels;
q=(unsigned char *) ximage->data;
x=0;
- canvas_view=AcquireCacheView(canvas);
+ canvas_view=AcquireVirtualCacheView(canvas,exception);
if (ximage->format == XYBitmap)
{
register unsigned short
foreground=(unsigned char)
(XPixelIntensity(&window->pixel_info->background_color) <
XPixelIntensity(&window->pixel_info->foreground_color) ? 0x80 : 0x00);
- polarity=(unsigned short) ((GetPixelPacketIntensity(
- &canvas->colormap[0])) < ((Quantum) QuantumRange/2) ? 1 : 0);
+ polarity=(unsigned short) ((GetPixelInfoIntensity(
+ &canvas->colormap[0])) < (QuantumRange/2) ? 1 : 0);
if (canvas->colors == 2)
- polarity=GetPixelPacketIntensity(&canvas->colormap[0]) <
- GetPixelPacketIntensity(&canvas->colormap[1]);
+ polarity=GetPixelInfoIntensity(&canvas->colormap[0]) <
+ GetPixelInfoIntensity(&canvas->colormap[1]);
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
- &canvas->exception);
+ exception);
if (p == (const Quantum *) NULL)
break;
bit=0;
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
nibble=0;
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
nibble=0;
Convert to 8 bit color-mapped X canvas.
*/
if (resource_info->color_recovery &&
- resource_info->quantize_info->dither)
+ resource_info->quantize_info->dither_method != NoDitherMethod)
{
- XDitherImage(canvas,ximage);
+ XDitherImage(canvas,ximage,exception);
break;
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
{
nibble=0;
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
nibble=0;
Convert to contiguous 8 bit continuous-tone X canvas.
*/
if (resource_info->color_recovery &&
- resource_info->quantize_info->dither)
+ resource_info->quantize_info->dither_method != NoDitherMethod)
{
- XDitherImage(canvas,ximage);
+ XDitherImage(canvas,ximage,exception);
break;
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
}
for (x=(int) canvas->columns-1; x >= 0; x--)
{
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelBlue(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelGreen(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelRed(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelBlue(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelGreen(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelRed(canvas,p));
*q++=0;
p+=GetPixelChannels(canvas);
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
}
for (x=(int) canvas->columns-1; x >= 0; x--)
{
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelRed(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelGreen(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelBlue(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelRed(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelGreen(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelBlue(canvas,p));
*q++=0;
p+=GetPixelChannels(canvas);
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
- &canvas->exception);
+ exception);
if (p == (const Quantum *) NULL)
break;
bit=0;
%
% The format of the XMakeImageMSBFirst method is:
%
-% XMakeImageMSBFirst(resource_info,window,image,ximage,matte_image)
+% XMakeImageMSBFirst(resource_info,window,image,ximage,matte_image,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o matte_image: Specifies a pointer to a XImage structure; returned from
% XCreateImage.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static void XMakeImageMSBFirst(const XResourceInfo *resource_info,
- const XWindowInfo *window,Image *image,XImage *ximage,XImage *matte_image)
+ const XWindowInfo *window,Image *image,XImage *ximage,XImage *matte_image,
+ ExceptionInfo *exception)
{
CacheView
*canvas_view;
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
canvas=image;
if ((window->immutable != MagickFalse) &&
- (image->storage_class == DirectClass) && (image->matte != MagickFalse))
+ (image->storage_class == DirectClass) && (image->alpha_trait == BlendPixelTrait))
{
char
size[MaxTextExtent];
(void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",(double)
image->columns,(double) image->rows);
image_info->size=ConstantString(size);
- pattern=ReadImage(image_info,&image->exception);
+ pattern=ReadImage(image_info,exception);
image_info=DestroyImageInfo(image_info);
if (pattern != (Image *) NULL)
{
- canvas=CloneImage(image,0,0,MagickTrue,&image->exception);
+ canvas=CloneImage(image,0,0,MagickTrue,exception);
if (canvas != (Image *) NULL)
- (void) CompositeImage(canvas,DstOverCompositeOp,pattern,0,0);
+ (void) CompositeImage(canvas,pattern,DstOverCompositeOp,MagickFalse,
+ 0,0,exception);
pattern=DestroyImage(pattern);
}
}
pixels=window->pixel_info->pixels;
q=(unsigned char *) ximage->data;
x=0;
- canvas_view=AcquireCacheView(canvas);
+ canvas_view=AcquireVirtualCacheView(canvas,exception);
if (ximage->format == XYBitmap)
{
register unsigned short
foreground=(unsigned char)
(XPixelIntensity(&window->pixel_info->background_color) <
XPixelIntensity(&window->pixel_info->foreground_color) ? 0x01 : 0x00);
- polarity=(unsigned short) ((GetPixelPacketIntensity(
- &canvas->colormap[0])) < ((Quantum) QuantumRange/2) ? 1 : 0);
+ polarity=(unsigned short) ((GetPixelInfoIntensity(
+ &canvas->colormap[0])) < (QuantumRange/2) ? 1 : 0);
if (canvas->colors == 2)
- polarity=GetPixelPacketIntensity(&canvas->colormap[0]) <
- GetPixelPacketIntensity(&canvas->colormap[1]);
+ polarity=GetPixelInfoIntensity(&canvas->colormap[0]) <
+ GetPixelInfoIntensity(&canvas->colormap[1]);
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
- &canvas->exception);
+ exception);
if (p == (const Quantum *) NULL)
break;
bit=0;
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
nibble=0;
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
nibble=0;
Convert to 8 bit color-mapped X canvas.
*/
if (resource_info->color_recovery &&
- resource_info->quantize_info->dither)
+ resource_info->quantize_info->dither_method != NoDitherMethod)
{
- XDitherImage(canvas,ximage);
+ XDitherImage(canvas,ximage,exception);
break;
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
{
- pixel=pixels[(ssize_t)
- GetPixelIndex(canvas,p)];
+ pixel=pixels[(ssize_t) GetPixelIndex(canvas,p)];
*q++=(unsigned char) pixel;
p+=GetPixelChannels(canvas);
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
nibble=0;
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
nibble=0;
Convert to 8 bit continuous-tone X canvas.
*/
if (resource_info->color_recovery &&
- resource_info->quantize_info->dither)
+ resource_info->quantize_info->dither_method != NoDitherMethod)
{
- XDitherImage(canvas,ximage);
+ XDitherImage(canvas,ximage,exception);
break;
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=(int) canvas->columns-1; x >= 0; x--)
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
for (x=(int) canvas->columns-1; x >= 0; x--)
{
*q++=0;
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelRed(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelGreen(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelBlue(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelRed(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelGreen(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelBlue(canvas,p));
p+=GetPixelChannels(canvas);
}
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
for (x=(int) canvas->columns-1; x >= 0; x--)
{
*q++=0;
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelBlue(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelGreen(canvas,p));
- *q++=ScaleQuantumToChar((Quantum)
- GetPixelRed(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelBlue(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelGreen(canvas,p));
+ *q++=ScaleQuantumToChar((Quantum) GetPixelRed(canvas,p));
p+=GetPixelChannels(canvas);
}
}
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
- canvas->columns,1,&canvas->exception);
+ canvas->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=(int) canvas->columns-1; x >= 0; x--)
for (y=0; y < (int) canvas->rows; y++)
{
p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
- &canvas->exception);
+ exception);
if (p == (const Quantum *) NULL)
break;
bit=0;
%
% The format of the XMakeMagnifyImage method is:
%
-% void XMakeMagnifyImage(display,windows)
+% void XMakeMagnifyImage(Display *display,XWindows *windows,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o windows: Specifies a pointer to a XWindows structure.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport void XMakeMagnifyImage(Display *display,XWindows *windows)
+MagickPrivate void XMakeMagnifyImage(Display *display,XWindows *windows,
+ ExceptionInfo *exception)
{
char
tuple[MaxTextExtent];
/*
Show center pixel color.
*/
- (void) GetOneVirtualMagickPixel(windows->image.image,(ssize_t)
- windows->magnify.x,(ssize_t) windows->magnify.y,&pixel,
- &windows->image.image->exception);
+ (void) GetOneVirtualPixelInfo(windows->image.image,TileVirtualPixelMethod,
+ (ssize_t) windows->magnify.x,(ssize_t) windows->magnify.y,&pixel,exception);
(void) FormatLocaleString(tuple,MaxTextExtent,"%d,%d: ",
windows->magnify.x,windows->magnify.y);
(void) ConcatenateMagickString(tuple,"(",MaxTextExtent);
(void) ConcatenateMagickString(tuple,",",MaxTextExtent);
ConcatenateColorComponent(&pixel,BlackPixelChannel,X11Compliance,tuple);
}
- if (pixel.matte != MagickFalse)
+ if (pixel.alpha_trait == BlendPixelTrait)
{
(void) ConcatenateMagickString(tuple,",",MaxTextExtent);
ConcatenateColorComponent(&pixel,AlphaPixelChannel,X11Compliance,tuple);
y+=height;
(void) XDrawImageString(display,windows->magnify.pixmap,
windows->magnify.annotate_context,x,y,tuple,(int) strlen(tuple));
- (void) QueryMagickColorname(windows->image.image,&pixel,SVGCompliance,tuple,
- &windows->image.image->exception);
+ (void) QueryColorname(windows->image.image,&pixel,SVGCompliance,tuple,
+ exception);
y+=height;
(void) XDrawImageString(display,windows->magnify.pixmap,
windows->magnify.annotate_context,x,y,tuple,(int) strlen(tuple));
%
% The format of the XMakeStandardColormap method is:
%
-% XMakeStandardColormap(display,visual_info,resource_info,image,
-% map_info,pixel)
+% void XMakeStandardColormap(Display *display,XVisualInfo *visual_info,
+% XResourceInfo *resource_info,Image *image,XStandardColormap *map_info,
+% XPixelInfo *pixel,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o pixel: Specifies a pointer to a XPixelInfo structure.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
-static inline MagickRealType DiversityPixelIntensity(
+static inline double DiversityPixelIntensity(
const DiversityPacket *pixel)
{
- MagickRealType
+ double
intensity;
- intensity=0.299*pixel->red+0.587*pixel->green+0.114*pixel->blue;
+ intensity=0.298839*pixel->red+0.586811*pixel->green+0.114350*pixel->blue;
return(intensity);
}
static inline Quantum ScaleXToQuantum(const size_t x,
const size_t scale)
{
- return((Quantum) (((MagickRealType) QuantumRange*x)/scale+0.5));
+ return((Quantum) (((double) QuantumRange*x)/scale+0.5));
}
-MagickExport void XMakeStandardColormap(Display *display,
+MagickPrivate void XMakeStandardColormap(Display *display,
XVisualInfo *visual_info,XResourceInfo *resource_info,Image *image,
- XStandardColormap *map_info,XPixelInfo *pixel)
+ XStandardColormap *map_info,XPixelInfo *pixel,ExceptionInfo *exception)
{
Colormap
colormap;
- ExceptionInfo
- *exception;
-
register ssize_t
i;
assert(map_info != (XStandardColormap *) NULL);
assert(resource_info != (XResourceInfo *) NULL);
assert(pixel != (XPixelInfo *) NULL);
- exception=(&image->exception);
if (resource_info->map_type != (char *) NULL)
{
/*
number_colors=(unsigned int) (map_info->base_pixel+
(map_info->red_max+1)*(map_info->green_max+1)*(map_info->blue_max+1));
if ((map_info->red_max*map_info->green_max*map_info->blue_max) != 0)
- if ((image->matte == MagickFalse) &&
+ if ((image->alpha_trait != BlendPixelTrait) &&
(resource_info->color_recovery == MagickFalse) &&
- resource_info->quantize_info->dither &&
+ (resource_info->quantize_info->dither_method != NoDitherMethod) &&
(number_colors < MaxColormapSize))
{
Image
/*
Improve image appearance with error diffusion.
*/
- affinity_image=AcquireImage((ImageInfo *) NULL);
+ affinity_image=AcquireImage((ImageInfo *) NULL,exception);
if (affinity_image == (Image *) NULL)
ThrowXWindowFatalException(ResourceLimitFatalError,
"UnableToDitherImage",image->filename);
}
(void) SyncAuthenticPixels(affinity_image,exception);
(void) RemapImage(resource_info->quantize_info,image,
- affinity_image);
+ affinity_image,exception);
}
XGetPixelInfo(display,visual_info,map_info,resource_info,image,
pixel);
*/
quantize_info=(*resource_info->quantize_info);
quantize_info.number_colors=(size_t) visual_info->colormap_size;
- (void) QuantizeImage(&quantize_info,image);
+ (void) QuantizeImage(&quantize_info,image,exception);
}
/*
Free previous and create new colormap.
"UnableToCreateColormap",image->filename);
for (i=0; i < (ssize_t) image->colors; i++)
{
- diversity[i].red=image->colormap[i].red;
- diversity[i].green=image->colormap[i].green;
- diversity[i].blue=image->colormap[i].blue;
+ diversity[i].red=ClampToQuantum(image->colormap[i].red);
+ diversity[i].green=ClampToQuantum(image->colormap[i].green);
+ diversity[i].blue=ClampToQuantum(image->colormap[i].blue);
diversity[i].index=(unsigned short) i;
diversity[i].count=0;
}
- image_view=AcquireCacheView(image);
+ image_view=AcquireAuthenticCacheView(image,exception);
for (y=0; y < (int) image->rows; y++)
{
register int
% o window_info: Specifies a pointer to a X11 XWindowInfo structure.
%
*/
-MagickExport void XMakeWindow(Display *display,Window parent,char **argv,
+MagickPrivate void XMakeWindow(Display *display,Window parent,char **argv,
int argc,XClassHint *class_hint,XWMHints *manager_hints,
XWindowInfo *window_info)
{
return(locale_message);
}
-MagickExport MagickBooleanType XMagickProgressMonitor(const char *tag,
+MagickPrivate MagickBooleanType XMagickProgressMonitor(const char *tag,
const MagickOffsetType quantum,const MagickSizeType span,
void *magick_unused(client_data))
{
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% XQueryColorDatabase() looks up a RGB values for a color given in the target
+% XQueryColorCompliance() looks up a RGB values for a color given in the target
% string.
%
% The format of the XQueryColorDatabase method is:
%
-% MagickBooleanType XQueryColorDatabase(const char *target,XColor *color)
+% MagickBooleanType XQueryColorCompliance(const char *target,XColor *color)
%
% A description of each parameter follows:
%
% o target: Specifies the color to lookup in the X color database.
%
-% o color: A pointer to an PixelPacket structure. The RGB value of the target
+% o color: A pointer to an PixelInfo structure. The RGB value of the target
% color is returned as this value.
%
*/
-MagickExport MagickBooleanType XQueryColorDatabase(const char *target,
+MagickPrivate MagickBooleanType XQueryColorCompliance(const char *target,
XColor *color)
{
Colormap
% window.
%
*/
-MagickExport void XQueryPosition(Display *display,const Window window,int *x,int *y)
+MagickPrivate void XQueryPosition(Display *display,const Window window,int *x,int *y)
{
int
x_root,
% the entire image is refreshed.
%
*/
-MagickExport void XRefreshWindow(Display *display,const XWindowInfo *window,
+MagickPrivate void XRefreshWindow(Display *display,const XWindowInfo *window,
const XEvent *event)
{
int
% to busy, otherwise the cursor are reset to their default.
%
*/
-MagickExport void XSetCursorState(Display *display,XWindows *windows,
+MagickPrivate void XSetCursorState(Display *display,XWindows *windows,
const MagickStatusType state)
{
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
% o windows_info: Initialize the Windows structure with this information.
%
*/
-MagickExport XWindows *XSetWindows(XWindows *windows_info)
+MagickPrivate XWindows *XSetWindows(XWindows *windows_info)
{
static XWindows
*windows = (XWindows *) NULL;
% o resource_info: Specifies a pointer to a X11 XResourceInfo structure.
%
*/
-MagickExport void XUserPreferences(XResourceInfo *resource_info)
+MagickPrivate void XUserPreferences(XResourceInfo *resource_info)
{
#if defined(X11_PREFERENCES_PATH)
char
value=resource_info->display_warnings ? "True" : "False";
XrmPutStringResource(&preferences_database,specifier,(char *) value);
(void) FormatLocaleString(specifier,MaxTextExtent,"%s.dither",client_name);
- value=resource_info->quantize_info->dither ? "True" : "False";
+ value=resource_info->quantize_info->dither_method != NoDitherMethod ?
+ "True" : "False";
XrmPutStringResource(&preferences_database,specifier,(char *) value);
(void) FormatLocaleString(specifier,MaxTextExtent,"%s.gammaCorrect",
client_name);
% o description: Specifies any description to the reason.
%
*/
-MagickExport void XWarning(const ExceptionType magick_unused(warning),
+MagickPrivate void XWarning(const ExceptionType magick_unused(warning),
const char *reason,const char *description)
{
char
% o id: Specifies the id of the window to locate.
%
*/
-MagickExport Window XWindowByID(Display *display,const Window root_window,
+MagickPrivate Window XWindowByID(Display *display,const Window root_window,
const size_t id)
{
RectangleInfo
% o name: Specifies the name of the window to locate.
%
*/
-MagickExport Window XWindowByName(Display *display,const Window root_window,
+MagickPrivate Window XWindowByName(Display *display,const Window root_window,
const char *name)
{
register int
% o property: Specifies the property of the window to locate.
%
*/
-MagickExport Window XWindowByProperty(Display *display,const Window window,
+MagickPrivate Window XWindowByProperty(Display *display,const Window window,
const Atom property)
{
Atom
%
% The format of the XImportImage method is:
%
-% Image *XImportImage(const ImageInfo *image_info,XImportInfo *ximage_info)
+% Image *XImportImage(const ImageInfo *image_info,XImportInfo *ximage_info,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o ximage_info: Specifies a pointer to an XImportInfo structure.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-MagickExport Image *XImportImage(const ImageInfo *image_info,
- XImportInfo *ximage_info)
+MagickPrivate Image *XImportImage(const ImageInfo *image_info,
+ XImportInfo *ximage_info,ExceptionInfo *exception)
{
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(ximage_info != (XImportInfo *) NULL);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
return((Image *) NULL);
}
#endif
% MagickBooleanType XComponentGenesis(void)
%
*/
-MagickExport MagickBooleanType XComponentGenesis(void)
+MagickPrivate MagickBooleanType XComponentGenesis(void)
{
return(MagickTrue);
}