% July 1992 %
% %
% %
-% Copyright 1999-2009 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 declarations.
*/
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/client.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
-#include "magick/utility.h"
-#include "magick/xwindow-private.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/client.h"
+#include "MagickCore/colormap.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/utility.h"
+#include "MagickCore/xwindow-private.h"
#if defined(MAGICKCORE_DPS_DELEGATE)
#include <DPS/dpsXclient.h>
#include <DPS/dpsXpreview.h>
static Image *ReadDPSImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
+ const char
+ *client_name;
+
Display
*display;
sans,
status;
- long
- x,
- y;
-
Pixmap
pixmap;
- register IndexPacket
- *indexes;
-
- register long
+ register ssize_t
i;
- register PixelPacket
+ register Quantum
*q;
- register unsigned long
+ register size_t
pixel;
Screen
*screen;
+ ssize_t
+ x,
+ y;
+
XColor
*colors;
/*
Open image file.
*/
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
return((Image *) NULL);
/*
Get user defaults from X resource database.
*/
- resource_database=XGetResourceDatabase(display,GetClientName());
- XGetResourceInfo(image_info,resource_database,GetClientName(),&resource_info);
+ client_name=GetClientName();
+ resource_database=XGetResourceDatabase(display,client_name);
+ XGetResourceInfo(image_info,resource_database,client_name,&resource_info);
/*
Allocate standard colormap.
*/
*/
screen=ScreenOfDisplay(display,visual_info->screen);
pixels_per_point=XDPSPixelsPerPoint(screen);
- if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0))
- pixels_per_point=MagickMin(image->x_resolution,image->y_resolution)/
+ if ((image->resolution.x != 0.0) && (image->resolution.y != 0.0))
+ pixels_per_point=MagickMin(image->resolution.x,image->resolution.y)/
DefaultResolution;
status=XDPSCreatePixmapForEPSF((DPSContext) NULL,screen,
GetBlobFileHandle(image),visual_info->depth,pixels_per_point,&pixmap,
if ((visual_info->klass != DirectColor) && (visual_info->klass != TrueColor))
for (i=0; i < visual_info->colormap_size; i++)
{
- colors[i].pixel=(unsigned long) i;
+ colors[i].pixel=(size_t) i;
colors[i].pad=0;
}
else
{
- unsigned long
+ size_t
blue,
blue_bit,
green,
*/
if ((visual_info->klass != TrueColor) && (visual_info->klass != DirectColor))
image->storage_class=PseudoClass;
- image->columns=(unsigned long) dps_image->width;
- image->rows=(unsigned long) dps_image->height;
+ image->columns=(size_t) dps_image->width;
+ image->rows=(size_t) dps_image->height;
if (image_info->ping != MagickFalse)
{
(void) CloseBlob(image);
case DirectClass:
default:
{
- register unsigned long
+ register size_t
color,
index;
- unsigned long
+ size_t
blue_mask,
blue_shift,
green_mask,
*/
if ((visual_info->colormap_size > 0) &&
(visual_info->klass == DirectColor))
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=XGetPixel(dps_image,x,y);
index=(pixel >> red_shift) & red_mask;
- q->red=ScaleShortToQuantum(colors[index].red);
+ SetPixelRed(image,ScaleShortToQuantum(colors[index].red),q);
index=(pixel >> green_shift) & green_mask;
- q->green=ScaleShortToQuantum(colors[index].green);
+ SetPixelGreen(image,ScaleShortToQuantum(colors[index].green),q);
index=(pixel >> blue_shift) & blue_mask;
- q->blue=ScaleShortToQuantum(colors[index].blue);
- q++;
+ SetPixelBlue(image,ScaleShortToQuantum(colors[index].blue),q);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
break;
}
else
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
pixel=XGetPixel(dps_image,x,y);
color=(pixel >> red_shift) & red_mask;
color=(color*65535L)/red_mask;
- q->red=ScaleShortToQuantum((unsigned short) color);
+ SetPixelRed(image,ScaleShortToQuantum((unsigned short) color),q);
color=(pixel >> green_shift) & green_mask;
color=(color*65535L)/green_mask;
- q->green=ScaleShortToQuantum((unsigned short) color);
+ SetPixelGreen(image,ScaleShortToQuantum((unsigned short) color),q);
color=(pixel >> blue_shift) & blue_mask;
color=(color*65535L)/blue_mask;
- q->blue=ScaleShortToQuantum((unsigned short) color);
- q++;
+ SetPixelBlue(image,ScaleShortToQuantum((unsigned short) color),q);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
/*
Create colormap.
*/
- if (AcquireImageColormap(image,(unsigned long) visual_info->colormap_size) == MagickFalse)
+ if (AcquireImageColormap(image,(size_t) visual_info->colormap_size,exception) == MagickFalse)
{
image=DestroyImage(image);
colors=(XColor *) RelinquishMagickMemory(colors);
(XFontStruct *) NULL,&resource_info,(XWindowInfo *) NULL);
return((Image *) NULL);
}
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
image->colormap[colors[i].pixel].red=ScaleShortToQuantum(colors[i].red);
image->colormap[colors[i].pixel].green=
/*
Convert X image to PseudoClass packets.
*/
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
- indexes[x]=(unsigned short) XGetPixel(dps_image,x,y);
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ SetPixelIndex(image,(unsigned short) XGetPixel(dps_image,x,y),q);
+ q+=GetPixelChannels(image);
+ }
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)
colors=(XColor *) RelinquishMagickMemory(colors);
XDestroyImage(dps_image);
if (image->storage_class == PseudoClass)
- (void) SyncImage(image);
+ (void) SyncImage(image,exception);
/*
Rasterize matte image.
*/
{
image->storage_class=DirectClass;
image->matte=MagickTrue;
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- q->opacity=OpaqueOpacity;
+ SetPixelAlpha(image,OpaqueAlpha,q);
if (XGetPixel(matte_image,x,y) == 0)
- q->opacity=TransparentOpacity;
- q++;
+ SetPixelAlpha(image,TransparentAlpha,q);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
%
% The format of the RegisterDPSImage method is:
%
-% unsigned long RegisterDPSImage(void)
+% size_t RegisterDPSImage(void)
%
*/
-ModuleExport unsigned long RegisterDPSImage(void)
+ModuleExport size_t RegisterDPSImage(void)
{
MagickInfo
*entry;