% July 1992 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2011 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 %
MagickExport MagickBooleanType XAnnotateImage(Display *display,
const XPixelInfo *pixel,XAnnotateInfo *annotate_info,Image *image)
{
+ CacheView
+ *annotate_view;
+
GC
annotate_context;
context_values.background=0;
context_values.foreground=(size_t) (~0);
context_values.font=annotate_info->font_info->fid;
- annotate_context=XCreateGC(display,root_window,(size_t)
- GCBackground | GCFont | GCForeground,&context_values);
+ annotate_context=XCreateGC(display,root_window,(unsigned long)
+ (GCBackground | GCFont | GCForeground),&context_values);
if (annotate_context == (GC) NULL)
return(MagickFalse);
/*
x=0;
y=0;
(void) XParseGeometry(annotate_info->geometry,&x,&y,&width,&height);
- (void) GetOneVirtualPixel(image,x,y,&annotate_image->background_color,
- &image->exception);
+ (void) GetOneVirtualPixel(image,(ssize_t) x,(ssize_t) y,
+ &annotate_image->background_color,&image->exception);
if (annotate_info->stencil == ForegroundStencil)
annotate_image->matte=MagickTrue;
exception=(&image->exception);
+ annotate_view=AcquireCacheView(annotate_image);
for (y=0; y < (int) annotate_image->rows; y++)
{
- register ssize_t
+ register int
x;
register PixelPacket
*restrict q;
- q=GetAuthenticPixels(annotate_image,0,y,annotate_image->columns,1,
- exception);
+ q=GetCacheViewAuthenticPixels(annotate_view,0,(ssize_t) y,
+ annotate_image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (ssize_t) annotate_image->columns; x++)
+ for (x=0; x < (int) annotate_image->columns; x++)
{
SetOpacityPixelComponent(q,OpaqueOpacity);
if (XGetPixel(annotate_ximage,x,y) == 0)
}
q++;
}
- if (SyncAuthenticPixels(annotate_image,exception) == MagickFalse)
+ if (SyncCacheViewAuthenticPixels(annotate_view,exception) == MagickFalse)
break;
}
+ annotate_view=DestroyCacheView(annotate_view);
XDestroyImage(annotate_ximage);
/*
Determine annotate geometry.
(void) XParseGeometry(annotate_info->geometry,&x,&y,&width,&height);
matte=image->matte;
(void) CompositeImage(image,annotate_image->matte != MagickFalse ?
- OverCompositeOp : CopyCompositeOp,annotate_image,x,y);
+ OverCompositeOp : CopyCompositeOp,annotate_image,(ssize_t) x,(ssize_t) y);
image->matte=matte;
annotate_image=DestroyImage(annotate_image);
return(MagickTrue);
*map_type,
*visual_type;
+ int
+ visual_mask;
+
register int
i;
size_t
one;
- ssize_t
- visual_mask;
-
static int
number_visuals;
client_event.window=window;
client_event.message_type=protocol;
client_event.format=32;
- client_event.data.l[0]=(ssize_t) reason;
- client_event.data.l[1]=(ssize_t) timestamp;
+ client_event.data.l[0]=(long) reason;
+ client_event.data.l[1]=(long) timestamp;
(void) XSendEvent(display,window,MagickFalse,NoEventMask,(XEvent *) &client_event);
}
\f
{
assert(display != (Display *) NULL);
(void) XFlush(display);
- if (milliseconds == 0)
- return;
-#if defined(MAGICKCORE_WINDOWS_SUPPORT)
- Sleep((long) milliseconds);
-#elif defined(vms)
- {
- float
- timer;
-
- timer=milliseconds/1000.0;
- lib$wait(&timer);
- }
-#elif defined(MAGICKCORE_HAVE_USLEEP)
- usleep(1000*milliseconds);
-#elif defined(MAGICKCORE_HAVE_SELECT)
- {
- struct timeval
- timer;
-
- timer.tv_sec=(ssize_t) milliseconds/1000;
- timer.tv_usec=(ssize_t) (milliseconds % 1000)*1000;
- (void) select(0,(XFD_SET *) NULL,(XFD_SET *) NULL,(XFD_SET *) NULL,&timer);
- }
-#elif defined(MAGICKCORE_HAVE_POLL)
- (void) poll((struct pollfd *) NULL,0,(int) milliseconds);
-#elif defined(__BEOS__)
- snooze(1000*milliseconds);
-#else
-# error "Time delay method not defined."
-#endif
+ MagickDelay(milliseconds);
}
\f
/*
int
unique_file;
- ssize_t
- bytes;
-
register ssize_t
i;
- unsigned int
- levels;
-
size_t
number_pixels;
+ ssize_t
+ bytes;
+
+ unsigned int
+ levels;
+
/*
Write info about the X server to a file.
*/
{ 2,-10, 12, -8, 0,-12, 14, -6, 3, -9, 13, -7, 1,-11, 15, -5}
};
- PixelPacket
- color;
+ CacheView
+ *image_view;
int
+ value,
y;
- ssize_t
- value;
+ PixelPacket
+ color;
register char
*q;
i=0;
j=0;
q=ximage->data;
+ image_view=AcquireCacheView(image);
for (y=0; y < (int) image->rows; y++)
{
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+ p=GetCacheViewVirtualPixels(image_view,0,(ssize_t) y,image->columns,1,
+ &image->exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=0; x < (int) image->columns; x++)
if (i == 2)
i=0;
}
+ image_view=DestroyCacheView(image_view);
/*
Free allocated memory.
*/
MagickExport MagickBooleanType XDrawImage(Display *display,
const XPixelInfo *pixel,XDrawInfo *draw_info,Image *image)
{
+ CacheView
+ *draw_view;
+
ExceptionInfo
*exception;
*/
(void) XSetBackground(display,draw_context,0);
(void) XSetForeground(display,draw_context,(size_t) (~0));
- (void) XSetFillStyle(display,draw_context,FillOpaqueStippled);
- (void) XSetStipple(display,draw_context,draw_info->stipple);
+ if (draw_info->stipple != (Pixmap) NULL)
+ {
+ (void) XSetFillStyle(display,draw_context,FillOpaqueStippled);
+ (void) XSetStipple(display,draw_context,draw_info->stipple);
+ }
switch (draw_info->element)
{
case PointElement:
x=0;
y=0;
(void) XParseGeometry(draw_info->geometry,&x,&y,&width,&height);
- (void) GetOneVirtualPixel(image,x,y,&draw_image->background_color,
- &image->exception);
+ (void) GetOneVirtualPixel(image,(ssize_t) x,(ssize_t) y,
+ &draw_image->background_color,&image->exception);
if (SetImageStorageClass(draw_image,DirectClass) == MagickFalse)
return(MagickFalse);
draw_image->matte=MagickTrue;
exception=(&image->exception);
+ draw_view=AcquireCacheView(draw_image);
for (y=0; y < (int) draw_image->rows; y++)
{
- register ssize_t
+ register int
x;
register PixelPacket
*restrict q;
- q=QueueAuthenticPixels(draw_image,0,y,draw_image->columns,1,exception);
+ q=QueueCacheViewAuthenticPixels(draw_view,0,(ssize_t) y,draw_image->columns,
+ 1,exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (ssize_t) draw_image->columns; x++)
+ for (x=0; x < (int) draw_image->columns; x++)
{
if (XGetPixel(draw_ximage,x,y) == 0)
{
}
q++;
}
- if (SyncAuthenticPixels(draw_image,exception) == MagickFalse)
+ if (SyncCacheViewAuthenticPixels(draw_view,exception) == MagickFalse)
break;
}
+ draw_view=DestroyCacheView(draw_view);
XDestroyImage(draw_ximage);
/*
Determine draw geometry.
/*
Composite text onto the image.
*/
+ draw_view=AcquireCacheView(draw_image);
for (y=0; y < (int) draw_image->rows; y++)
{
- register ssize_t
+ register int
x;
register PixelPacket
*restrict q;
- q=GetAuthenticPixels(draw_image,0,y,draw_image->columns,1,exception);
+ q=GetCacheViewAuthenticPixels(draw_view,0,(ssize_t) y,draw_image->columns,1,
+ exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (ssize_t) draw_image->columns; x++)
+ for (x=0; x < (int) draw_image->columns; x++)
{
if (q->opacity != (Quantum) TransparentOpacity)
SetOpacityPixelComponent(q,OpaqueOpacity);
q++;
}
- if (SyncAuthenticPixels(draw_image,exception) == MagickFalse)
+ if (SyncCacheViewAuthenticPixels(draw_view,exception) == MagickFalse)
break;
}
+ 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,x,y);
+ (void) CompositeImage(image,CopyOpacityCompositeOp,draw_image,(ssize_t) x,
+ (ssize_t) y);
else
{
matte=image->matte;
- (void) CompositeImage(image,OverCompositeOp,draw_image,x,y);
+ (void) CompositeImage(image,OverCompositeOp,draw_image,(ssize_t) x,
+ (ssize_t) y);
image->matte=matte;
}
draw_image=DestroyImage(draw_image);
Free font.
*/
if (font_info != (XFontStruct *) NULL)
- (void) XFreeFont(display,font_info);
+ {
+ (void) XFreeFont(display,font_info);
+ font_info=(XFontStruct *) NULL;
+ }
if (map_info != (XStandardColormap *) NULL)
{
/*
pixel->colors=0;
if (image != (Image *) NULL)
if (image->storage_class == PseudoClass)
- pixel->colors=image->colors;
+ pixel->colors=(ssize_t) image->colors;
packets=(unsigned int)
MagickMax((int) pixel->colors,visual_info->colormap_size)+MaxNumberPens;
if (pixel->pixels != (unsigned long *) NULL)
Initialize pixel array for images of type PseudoClass.
*/
for (i=0; i < (ssize_t) image->colors; i++)
- pixel->pixels[i]=
- XGammaPixel(map_info,image->colormap+i);
+ pixel->pixels[i]=XGammaPixel(map_info,image->colormap+i);
for (i=0; i < MaxNumberPens; i++)
pixel->pixels[image->colors+i]=pixel->pen_colors[i].pixel;
pixel->colors+=MaxNumberPens;
XrmDatabase database,const char *client_name,XResourceInfo *resource_info)
{
char
- *cwd,
+ *directory,
*resource_value;
/*
"borderColor",BorderColor);
resource_value=XGetResourceClass(database,client_name,"borderWidth",
(char *) "2");
- resource_info->border_width=(unsigned int) StringToUnsignedLong(resource_value);
+ resource_info->border_width=(unsigned int) StringToUnsignedLong(
+ resource_value);
resource_value=XGetResourceClass(database,client_name,"colormap",
(char *) "shared");
resource_info->colormap=UndefinedColormap;
resource_value=XGetResourceClass(database,client_name,"confirmEdit",
(char *) "False");
resource_info->confirm_edit=IsMagickTrue(resource_value);
- resource_value=XGetResourceClass(database,client_name,"delay",(char *) "0");
+ 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");
client_name,"geometry",(char *) NULL));
resource_value=XGetResourceClass(database,client_name,"gravity",
(char *) "Center");
- resource_info->gravity=(GravityType) ParseMagickOption(MagickGravityOptions,
+ resource_info->gravity=(GravityType) ParseCommandOption(MagickGravityOptions,
MagickFalse,resource_value);
- cwd=getcwd(resource_info->home_directory,MaxTextExtent);
+ directory=getcwd(resource_info->home_directory,MaxTextExtent);
+ (void) directory;
resource_info->icon_geometry=XGetResourceClass(database,client_name,
"iconGeometry",(char *) NULL);
resource_value=XGetResourceClass(database,client_name,"iconic",
}
if (level <= 1)
{
+ CacheView
+ *composite_view;
+
ColormapInfo
*next;
/*
Append colormap to colormap list.
*/
- p=(ColormapInfo *) AcquireAlignedMemory(1,sizeof(*p));
+ p=(ColormapInfo *) AcquireMagickMemory(sizeof(*p));
if (p == (ColormapInfo *) NULL)
return((Image *) NULL);
p->colormap=window_info[id].colormap;
composite_image->columns=(size_t) ximage->width;
composite_image->rows=(size_t) ximage->height;
exception=(&composite_image->exception);
+ composite_view=AcquireCacheView(composite_image);
switch (composite_image->storage_class)
{
case DirectClass:
(window_info[id].visual->klass == DirectColor))
for (y=0; y < (int) composite_image->rows; y++)
{
- q=QueueAuthenticPixels(composite_image,0,y,
+ q=QueueCacheViewAuthenticPixels(composite_view,0,(ssize_t) y,
composite_image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
q->blue=ScaleShortToQuantum(colors[index].blue);
q++;
}
- if (SyncAuthenticPixels(composite_image,exception) == MagickFalse)
+ if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
break;
}
else
for (y=0; y < (int) composite_image->rows; y++)
{
- q=QueueAuthenticPixels(composite_image,0,y,
+ q=QueueCacheViewAuthenticPixels(composite_view,0,(ssize_t) y,
composite_image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
q->blue=ScaleShortToQuantum((unsigned short) color);
q++;
}
- if (SyncAuthenticPixels(composite_image,exception) == MagickFalse)
+ if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
break;
}
break;
*/
for (y=0; y < (int) composite_image->rows; y++)
{
- q=QueueAuthenticPixels(composite_image,0,y,composite_image->columns,1,exception);
+ q=QueueCacheViewAuthenticPixels(composite_view,0,(ssize_t) y,
+ composite_image->columns,1,exception);
if (q == (PixelPacket *) NULL)
break;
- indexes=GetAuthenticIndexQueue(composite_image);
+ indexes=GetCacheViewAuthenticIndexQueue(composite_view);
for (x=0; x < (int) composite_image->columns; x++)
{
index=(IndexPacket) XGetPixel(ximage,x,y);
indexes[x]=index;
*q++=composite_image->colormap[(ssize_t) index];
}
- if (SyncAuthenticPixels(composite_image,exception) == MagickFalse)
+ if (SyncCacheViewAuthenticPixels(composite_view,exception) == MagickFalse)
break;
}
break;
}
}
+ composite_view=DestroyCacheView(composite_view);
XDestroyImage(ximage);
if (image == (Image *) NULL)
{
y_offset-=(int) crop_info.y;
if (y_offset < 0)
y_offset=0;
- (void) CompositeImage(image,CopyCompositeOp,composite_image,x_offset,
- y_offset);
+ (void) CompositeImage(image,CopyCompositeOp,composite_image,(ssize_t)
+ x_offset,(ssize_t) y_offset);
}
/*
Relinquish resources.
window->immutable=MagickFalse;
window->shape=MagickFalse;
window->data=0;
- window->mask=(size_t) (CWBackingStore | CWBackPixel | CWBackPixmap |
+ window->mask=(int) (CWBackingStore | CWBackPixel | CWBackPixmap |
CWBitGravity | CWBorderPixel | CWColormap | CWCursor | CWDontPropagate |
CWEventMask | CWOverrideRedirect | CWSaveUnder | CWWinGravity);
window->attributes.background_pixel=pixel->background_color.pixel;
return((Image *) NULL);
}
(void) XTranslateCoordinates(display,target,root,0,0,&x,&y,&child);
- crop_info.x=x;
- crop_info.y=y;
+ crop_info.x=(ssize_t) x;
+ crop_info.y=(ssize_t) y;
crop_info.width=(size_t) window_attributes.width;
crop_info.height=(size_t) window_attributes.height;
if (ximage_info->borders != 0)
/*
Allocate windows structure.
*/
- windows=(XWindows *) AcquireAlignedMemory(1,sizeof(*windows));
+ windows=(XWindows *) AcquireMagickMemory(sizeof(*windows));
if (windows == (XWindows *) NULL)
{
ThrowXWindowFatalException(XServerFatalError,"MemoryAllocationFailed",
matte_image=(XImage *) NULL;
if ((window->shape != MagickFalse) && (window->image != (Image *) NULL))
if ((window->image->matte != MagickFalse) &&
- ((ssize_t) width <= XDisplayWidth(display,window->screen)) &&
- ((ssize_t) height <= XDisplayHeight(display,window->screen)))
+ ((int) width <= XDisplayWidth(display,window->screen)) &&
+ ((int) height <= XDisplayHeight(display,window->screen)))
{
/*
Create matte image.
static void XMakeImageLSBFirst(const XResourceInfo *resource_info,
const XWindowInfo *window,Image *image,XImage *ximage,XImage *matte_image)
{
+ CacheView
+ *canvas_view;
+
Image
*canvas;
pixels=window->pixel_info->pixels;
q=(unsigned char *) ximage->data;
x=0;
+ canvas_view=AcquireCacheView(canvas);
if (ximage->format == XYBitmap)
{
register unsigned short
PixelIntensity(&canvas->colormap[1]);
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
+ &canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
bit=0;
byte=0;
for (x=0; x < (int) canvas->columns; x++)
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
nibble=0;
for (x=0; x < (int) canvas->columns; x++)
{
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
nibble=0;
for (x=0; x < (int) canvas->columns; x++)
{
}
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
for (x=0; x < (int) canvas->columns; x++)
{
pixel=pixels[(ssize_t) indexes[x]];
bytes_per_pixel=(unsigned int) (ximage->bits_per_pixel >> 3);
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
for (x=0; x < (int) canvas->columns; x++)
{
pixel=pixels[(ssize_t) indexes[x]];
for (y=0; y < (int) canvas->rows; y++)
{
nibble=0;
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
nibble=0;
}
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=0; x < (int) canvas->columns; x++)
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,
- &canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,
- &canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
bytes_per_pixel=(unsigned int) (ximage->bits_per_pixel >> 3);
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,
- &canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (PixelPacket *) NULL)
break;
- for (x=0; x < (ssize_t) canvas->columns; x++)
+ for (x=0; x < (int) canvas->columns; x++)
{
pixel=XGammaPixel(map_info,p);
for (k=0; k < (int) bytes_per_pixel; k++)
q=(unsigned char *) matte_image->data;
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
+ &canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
bit=0;
for (x=(int) canvas->columns-1; x >= 0; x--)
{
byte>>=1;
- if (p->opacity > (ssize_t) (QuantumRange/2))
+ if (GetOpacityPixelComponent(p) > (QuantumRange/2))
byte|=0x80;
bit++;
if (bit == 8)
q+=scanline_pad;
}
}
+ canvas_view=DestroyCacheView(canvas_view);
if (canvas != image)
canvas=DestroyImage(canvas);
}
static void XMakeImageMSBFirst(const XResourceInfo *resource_info,
const XWindowInfo *window,Image *image,XImage *ximage,XImage *matte_image)
{
+ CacheView
+ *canvas_view;
+
Image
*canvas;
pixels=window->pixel_info->pixels;
q=(unsigned char *) ximage->data;
x=0;
+ canvas_view=AcquireCacheView(canvas);
if (ximage->format == XYBitmap)
{
register unsigned short
PixelIntensity(&canvas->colormap[1]);
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
+ &canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
bit=0;
byte=0;
for (x=(int) canvas->columns-1; x >= 0; x--)
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
nibble=0;
for (x=0; x < (int) canvas->columns; x++)
{
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
nibble=0;
for (x=0; x < (int) canvas->columns; x++)
{
}
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
for (x=0; x < (int) canvas->columns; x++)
{
pixel=pixels[(ssize_t) indexes[x]];
bytes_per_pixel=(unsigned int) (ximage->bits_per_pixel >> 3);
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
- indexes=GetVirtualIndexQueue(canvas);
+ indexes=GetCacheViewVirtualIndexQueue(canvas_view);
for (x=0; x < (int) canvas->columns; x++)
{
pixel=pixels[(ssize_t) indexes[x]];
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
nibble=0;
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
nibble=0;
}
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=(int) canvas->columns-1; x >= 0; x--)
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,
- &canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
*/
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,
- &canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
if ((red_gamma != 1.0) || (green_gamma != 1.0) ||
bytes_per_pixel=(unsigned int) (ximage->bits_per_pixel >> 3);
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,
- &canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,
+ canvas->columns,1,&canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=(int) canvas->columns-1; x >= 0; x--)
q=(unsigned char *) matte_image->data;
for (y=0; y < (int) canvas->rows; y++)
{
- p=GetVirtualPixels(canvas,0,y,canvas->columns,1,&canvas->exception);
+ p=GetCacheViewVirtualPixels(canvas_view,0,(ssize_t) y,canvas->columns,1,
+ &canvas->exception);
if (p == (const PixelPacket *) NULL)
break;
bit=0;
for (x=(int) canvas->columns-1; x >= 0; x--)
{
byte<<=1;
- if (p->opacity > (ssize_t) (QuantumRange/2))
+ if (GetOpacityPixelComponent(p) > (QuantumRange/2))
byte|=0x01;
bit++;
if (bit == 8)
q+=scanline_pad;
}
}
+ canvas_view=DestroyCacheView(canvas_view);
if (canvas != image)
canvas=DestroyImage(canvas);
}
int
y;
- ssize_t
- n;
-
MagickPixelPacket
pixel;
*p,
*q;
+ ssize_t
+ n;
+
static unsigned int
previous_magnify = 0;
/*
Show center pixel color.
*/
- (void) GetOneVirtualMagickPixel(windows->image.image,windows->magnify.x,
- windows->magnify.y,&pixel,&windows->image.image->exception);
+ (void) GetOneVirtualMagickPixel(windows->image.image,(ssize_t)
+ windows->magnify.x,(ssize_t) windows->magnify.y,&pixel,
+ &windows->image.image->exception);
(void) FormatMagickString(tuple,MaxTextExtent,"%d,%d: ",
windows->magnify.x,windows->magnify.y);
(void) ConcatenateMagickString(tuple,"(",MaxTextExtent);
colormap_type=PrivateColormap;
if (colormap_type == SharedColormap)
{
+ CacheView
+ *image_view;
+
DiversityPacket
*diversity;
diversity[i].index=(unsigned short) i;
diversity[i].count=0;
}
+ image_view=AcquireCacheView(image);
for (y=0; y < (int) image->rows; y++)
{
- register ssize_t
+ register int
x;
- register PixelPacket
- *restrict q;
+ register const PixelPacket
+ *restrict p;
- q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ p=GetCacheViewAuthenticPixels(image_view,0,(ssize_t) y,
+ image->columns,1,exception);
+ if (p == (const PixelPacket *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
- for (x=(ssize_t) image->columns-1; x >= 0; x--)
+ indexes=GetCacheViewAuthenticIndexQueue(image_view);
+ for (x=(int) image->columns-1; x >= 0; x--)
diversity[(ssize_t) indexes[x]].count++;
}
+ image_view=DestroyCacheView(image_view);
/*
Sort colors by decreasing intensity.
*/
for (i=0; i < (ssize_t) image->colors; )
{
diversity[i].count<<=4; /* increase this colors popularity */
- i+=MagickMax((ssize_t) (image->colors >> 4),2);
+ i+=MagickMax((int) (image->colors >> 4),2);
}
diversity[image->colors-1].count<<=4;
qsort((void *) diversity,image->colors,sizeof(*diversity),
p=colors+image->colors;
for (i=0; i < (ssize_t) retain_colors; i++)
{
- p->pixel=(size_t) i;
+ p->pixel=(unsigned long) i;
p++;
}
(void) XQueryColors(display,
&pixel->pen_colors[i]);
pixel->pixels[image->colors+i]=pixel->pen_colors[i].pixel;
}
- pixel->colors=image->colors+MaxNumberPens;
+ pixel->colors=(ssize_t) (image->colors+MaxNumberPens);
}
colors=(XColor *) RelinquishMagickMemory(colors);
if (IsEventLogging())
size_hints=XAllocSizeHints();
if (size_hints == (XSizeHints *) NULL)
ThrowXWindowFatalException(XServerFatalError,"UnableToMakeXWindow",argv[0]);
- size_hints->flags=(ssize_t) window_info->flags;
+ size_hints->flags=(int) window_info->flags;
size_hints->x=window_info->x;
size_hints->y=window_info->y;
size_hints->width=(int) window_info->width;
window_info->id=XCreateWindow(display,parent,window_info->x,window_info->y,
(unsigned int) size_hints->width,(unsigned int) size_hints->height,
window_info->border_width,(int) window_info->depth,InputOutput,
- window_info->visual,window_info->mask,&window_info->attributes);
+ window_info->visual,(unsigned long) window_info->mask,
+ &window_info->attributes);
else
{
MagickStatusType
/*
Window already exists; change relevant attributes.
*/
- (void) XChangeWindowAttributes(display,window_info->id,window_info->mask,
- &window_info->attributes);
+ (void) XChangeWindowAttributes(display,window_info->id,(unsigned long)
+ window_info->mask,&window_info->attributes);
mask=ConfigureNotify;
while (XCheckTypedWindowEvent(display,window_info->id,(int) mask,&sans_event)) ;
window_changes.x=window_info->x;
if (id == 0)
return(XSelectWindow(display,&rectangle_info));
if (root_window == id)
- return(id);
+ return(root_window);
status=XQueryTree(display,root_window,&child,&child,&children,
&number_children);
if (status == False)