% October 2002 %
% %
% %
-% Copyright 1999-2009 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 %
#include "magick/enhance.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
+#include "magick/fx.h"
#include "magick/geometry.h"
#include "magick/identify.h"
#include "magick/image.h"
#include "magick/magick.h"
#include "magick/monitor.h"
#include "magick/monitor-private.h"
+#include "magick/morphology.h"
#include "magick/paint.h"
#include "magick/pixel.h"
#include "magick/pixel-private.h"
#include "magick/semaphore.h"
#include "magick/segment.h"
#include "magick/splay-tree.h"
+#include "magick/statistic.h"
#include "magick/string_.h"
#include "magick/threshold.h"
#include "magick/transform.h"
% AcquireCacheViewIndexes() returns the indexes associated with the specified
% view.
%
+% Deprecated, replace with:
+%
+% GetCacheViewVirtualIndexQueue(cache_view);
+%
% The format of the AcquireCacheViewIndexes method is:
%
% const IndexPacket *AcquireCacheViewIndexes(const CacheView *cache_view)
% as defined by the geometry parameters. A pointer to the pixels is returned
% if the pixels are transferred, otherwise a NULL is returned.
%
+% Deprecated, replace with:
+%
+% GetCacheViewVirtualPixels(cache_view,x,y,columns,rows,exception);
+%
% The format of the AcquireCacheViewPixels method is:
%
% const PixelPacket *AcquireCacheViewPixels(const CacheView *cache_view,
-% const long x,const long y,const unsigned long columns,
-% const unsigned long rows,ExceptionInfo *exception)
+% const ssize_t x,const ssize_t y,const size_t columns,
+% const size_t rows,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
*/
MagickExport const PixelPacket *AcquireCacheViewPixels(
- const CacheView *cache_view,const long x,const long y,
- const unsigned long columns,const unsigned long rows,ExceptionInfo *exception)
+ const CacheView *cache_view,const ssize_t x,const ssize_t y,
+ const size_t columns,const size_t rows,ExceptionInfo *exception)
{
return(GetCacheViewVirtualPixels(cache_view,x,y,columns,rows,exception));
}
% %
% %
% %
-% A c q u i r e I m a g e P i x e l s %
-% %
-% %
+% A c q u i r e I m a g e P i x e l s %
+% % % %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
% Pixels accessed via the returned pointer represent a simple array of type
% PixelPacket. If the image type is CMYK or the storage class is PseudoClass,
-% call GetAuthenticIndexQueue() after invoking GetAuthenticPixels() to access the
-% black color component or to obtain the colormap indexes (of type IndexPacket)
-% corresponding to the region.
+% call GetAuthenticIndexQueue() after invoking GetAuthenticPixels() to access
+% the black color component or to obtain the colormap indexes (of type
+% IndexPacket) corresponding to the region.
%
% If you plan to modify the pixels, use GetAuthenticPixels() instead.
%
% thread-safe. In a threaded environment, use GetCacheViewVirtualPixels() or
% GetCacheViewAuthenticPixels() instead.
%
+% Deprecated, replace with:
+%
+% GetVirtualPixels(image,x,y,columns,rows,exception);
+%
% The format of the AcquireImagePixels() method is:
%
-% const PixelPacket *AcquireImagePixels(const Image *image,const long x,
-% const long y,const unsigned long columns,const unsigned long rows,
+% const PixelPacket *AcquireImagePixels(const Image *image,const ssize_t x,
+% const ssize_t y,const size_t columns,const size_t rows,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
*/
MagickExport const PixelPacket *AcquireImagePixels(const Image *image,
- const long x,const long y,const unsigned long columns,
- const unsigned long rows,ExceptionInfo *exception)
+ const ssize_t x,const ssize_t y,const size_t columns,
+ const size_t rows,ExceptionInfo *exception)
{
return(GetVirtualPixels(image,x,y,columns,rows,exception));
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% AcquireIndexes() returns the black channel or the colormap indexes
-% associated with the last call to QueueAuthenticPixels() or GetVirtualPixels().
-% NULL is returned if the black channel or colormap indexes are not available.
+% associated with the last call to QueueAuthenticPixels() or
+% GetVirtualPixels(). NULL is returned if the black channel or colormap
+% indexes are not available.
+%
+% Deprecated, replace with:
+%
+% GetVirtualIndexQueue(image);
%
% The format of the AcquireIndexes() method is:
%
% location. The image background color is returned if an error occurs. If
% you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
%
+% Deprecated, replace with:
+%
+% GetOneCacheViewVirtualPixel(cache_view,x,y,pixel,exception);
+%
% The format of the AcquireOneCacheViewPixel method is:
%
% MagickBooleanType AcquireOneCacheViewPixel(const CacheView *cache_view,
-% const long x,const long y,PixelPacket *pixel,ExceptionInfo *exception)
+% const ssize_t x,const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
*/
MagickExport MagickBooleanType AcquireOneCacheViewPixel(
- const CacheView *cache_view,const long x,const long y,PixelPacket *pixel,
+ const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelPacket *pixel,
ExceptionInfo *exception)
{
return(GetOneCacheViewVirtualPixel(cache_view,x,y,pixel,exception));
% (x,y) location. The image background color is returned if an error occurs.
% If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
%
+% Deprecated, replace with:
+%
+% GetOneCacheViewVirtualMethodPixel(cache_view,virtual_pixel_method,
+% x,y,pixel,exception);
+%
% The format of the AcquireOneCacheViewPixel method is:
%
% MagickBooleanType AcquireOneCacheViewVirtualPixel(
% const CacheView *cache_view,
-% const VirtualPixelMethod virtual_pixel_method,const long x,
-% const long y,PixelPacket *pixel,ExceptionInfo *exception)
+% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
+% const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
*/
MagickExport MagickBooleanType AcquireOneCacheViewVirtualPixel(
const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
- const long x,const long y,PixelPacket *pixel,ExceptionInfo *exception)
+ const ssize_t x,const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception)
{
MagickBooleanType
status;
% location. The image background color is returned if an error occurs. If
% you plan to modify the pixel, use GetOnePixel() instead.
%
+% Deprecated, replace with:
+%
+% MagickPixelPacket pixel;
+% GetOneVirtualMagickPixel(image,x,y,&pixel,exception);
+%
% The format of the AcquireOneMagickPixel() method is:
%
-% MagickPixelPacket AcquireOneMagickPixel(const Image image,const long x,
-% const long y,ExceptionInfo exception)
+% MagickPixelPacket AcquireOneMagickPixel(const Image image,const ssize_t x,
+% const ssize_t y,ExceptionInfo exception)
%
% A description of each parameter follows:
%
%
*/
MagickExport MagickPixelPacket AcquireOneMagickPixel(const Image *image,
- const long x,const long y,ExceptionInfo *exception)
+ const ssize_t x,const ssize_t y,ExceptionInfo *exception)
{
MagickPixelPacket
pixel;
% The image background color is returned if an error occurs. If you plan to
% modify the pixel, use GetOnePixel() instead.
%
+% Deprecated, replace with:
+%
+% PixelPacket pixel;
+% GetOneVirtualPixel(image,x,y,&pixel,exception);
+%
% The format of the AcquireOnePixel() method is:
%
-% PixelPacket AcquireOnePixel(const Image image,const long x,
-% const long y,ExceptionInfo exception)
+% PixelPacket AcquireOnePixel(const Image image,const ssize_t x,
+% const ssize_t y,ExceptionInfo exception)
%
% A description of each parameter follows:
%
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport PixelPacket AcquireOnePixel(const Image *image,const long x,
- const long y,ExceptionInfo *exception)
+MagickExport PixelPacket AcquireOnePixel(const Image *image,const ssize_t x,
+ const ssize_t y,ExceptionInfo *exception)
{
PixelPacket
pixel;
% is returned if an error occurs. If you plan to modify the pixel, use
% GetOnePixel() instead.
%
+% Deprecated, replace with:
+%
+% PixelPacket pixel;
+% GetOneVirtualMethodPixel(image,virtual_pixel_method,x,y,&pixel,exception);
+%
% The format of the AcquireOneVirtualPixel() method is:
%
% PixelPacket AcquireOneVirtualPixel(const Image image,
-% const VirtualPixelMethod virtual_pixel_method,const long x,
-% const long y,ExceptionInfo exception)
+% const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
+% const ssize_t y,ExceptionInfo exception)
%
% A description of each parameter follows:
%
%
*/
MagickExport PixelPacket AcquireOneVirtualPixel(const Image *image,
- const VirtualPixelMethod virtual_pixel_method,const long x,const long y,
+ const VirtualPixelMethod virtual_pixel_method,const ssize_t x,const ssize_t y,
ExceptionInfo *exception)
{
PixelPacket
% AcquirePixels() returns the pixels associated with the last call to
% QueueAuthenticPixels() or GetVirtualPixels().
%
+% Deprecated, replace with:
+%
+% GetVirtualPixelQueue(image);
+%
% The format of the AcquirePixels() method is:
%
% const PixelPacket *AcquirePixels(const Image image)
% AffinityImage() replaces the colors of an image with the closest color from
% a reference image.
%
+% Deprecated, replace with:
+%
+% RemapImage(quantize_info,image,affinity_image);
+%
% The format of the AffinityImage method is:
%
% MagickBooleanType AffinityImage(const QuantizeInfo *quantize_info,
% AffinityImages() replaces the colors of a sequence of images with the
% closest color from a reference image.
%
+% Deprecated, replace with:
+%
+% RemapImages(quantize_info,images,affinity_image);
+%
% The format of the AffinityImage method is:
%
% MagickBooleanType AffinityImages(const QuantizeInfo *quantize_info,
% AllocateImage() returns a pointer to an image structure initialized to
% default values.
%
+% Deprecated, replace with:
+%
+% AcquireImage(image_info);
+%
% The format of the AllocateImage method is:
%
% Image *AllocateImage(const ImageInfo *image_info)
% it is replaced. AllocateImageColormap() returns MagickTrue if successful,
% otherwise MagickFalse if there is not enough memory.
%
+% Deprecated, replace with:
+%
+% AcquireImageColormap(image,colors);
+%
% The format of the AllocateImageColormap method is:
%
% MagickBooleanType AllocateImageColormap(Image *image,
-% const unsigned long colors)
+% const size_t colors)
%
% A description of each parameter follows:
%
%
*/
MagickExport MagickBooleanType AllocateImageColormap(Image *image,
- const unsigned long colors)
+ const size_t colors)
{
return(AcquireImageColormap(image,colors));
}
% default values. The next member of image points to the newly allocated
% image. If there is a memory shortage, next is assigned NULL.
%
+% Deprecated, replace with:
+%
+% AcquireNextImage(image_info,image);
+%
% The format of the AllocateNextImage method is:
%
% void AllocateNextImage(const ImageInfo *image_info,Image *image)
% %
% %
% %
-% A c q u i r e S t r i n g %
+% A l l o c a t e S t r i n g %
% %
% %
% %
% %
% %
% %
+% A v e r a g e I m a g e s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% AverageImages() takes a set of images and averages them together. Each
+% image in the set must have the same width and height. AverageImages()
+% returns a single image with each corresponding pixel component of each
+% image averaged. On failure, a NULL image is returned and exception
+% describes the reason for the failure.
+%
+% Deprecated, replace with:
+%
+% EvaluateImages(images,MeanEvaluateOperator,exception);
+%
+% The format of the AverageImages method is:
+%
+% Image *AverageImages(Image *images,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image sequence.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *AverageImages(const Image *images,ExceptionInfo *exception)
+{
+ return(EvaluateImages(images,MeanEvaluateOperator,exception));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% C h a n n e l I m a g e %
% %
% %
% Extract a channel from the image. A channel is a particular color component
% of each pixel in the image.
%
+% Deprecated, replace with:
+%
+% SeparateImageChannel(image,channel);
+%
% The format of the ChannelImage method is:
%
% unsigned int ChannelImage(Image *image,const ChannelType channel)
% ClipPathImage() sets the image clip mask based any clipping path information
% if it exists.
%
+% Deprecated, replace with:
+%
+% ClipImagePath(image,pathname,inside);
+%
% The format of the ClipImage method is:
%
% MagickBooleanType ClipPathImage(Image *image,const char *pathname,
%
% CloneImageAttributes() clones one or more image attributes.
%
+% Deprecated, replace with:
+%
+% CloneImageProperties(image,clone_image);
+%
% The format of the CloneImageAttributes method is:
%
% MagickBooleanType CloneImageAttributes(Image *image,
register unsigned char
*q;
- register long
+ register ssize_t
i;
assert(destination != (void *) NULL);
*/
p+=size;
q+=size;
- for (i=(long) (size-1); i >= 0; i--)
+ for (i=(ssize_t) (size-1); i >= 0; i--)
*--q=(*--p);
return(destination);
}
% CloseCacheView() closes the specified view returned by a previous call to
% OpenCacheView().
%
+% Deprecated, replace with:
+%
+% DestroyCacheView(view_info);
+%
% The format of the CloseCacheView method is:
%
% CacheView *CloseCacheView(CacheView *view_info)
%
% MagickBooleanType ColorFloodfillImage(Image *image,
% const DrawInfo *draw_info,const PixelPacket target,
-% const long x_offset,const long y_offset,const PaintMethod method)
+% const ssize_t x_offset,const ssize_t y_offset,const PaintMethod method)
%
% A description of each parameter follows:
%
ThrowBinaryException(DrawError,"SegmentStackOverflow",image->filename) \
else \
{ \
- if ((((up)+(delta)) >= 0) && (((up)+(delta)) < (long) image->rows)) \
+ if ((((up)+(delta)) >= 0) && (((up)+(delta)) < (ssize_t) image->rows)) \
{ \
s->x1=(double) (left); \
s->y1=(double) (up); \
}
MagickExport MagickBooleanType ColorFloodfillImage(Image *image,
- const DrawInfo *draw_info,const PixelPacket target,const long x_offset,
- const long y_offset,const PaintMethod method)
+ const DrawInfo *draw_info,const PixelPacket target,const ssize_t x_offset,
+ const ssize_t y_offset,const PaintMethod method)
{
Image
*floodplane_image;
- long
- offset,
- start,
- x,
- x1,
- x2,
- y;
-
MagickBooleanType
skip;
SegmentInfo
*segment_stack;
+ ssize_t
+ offset,
+ start,
+ x,
+ x1,
+ x2,
+ y;
+
/*
Check boundary conditions.
*/
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(draw_info != (DrawInfo *) NULL);
assert(draw_info->signature == MagickSignature);
- if ((x_offset < 0) || (x_offset >= (long) image->columns))
+ if ((x_offset < 0) || (x_offset >= (ssize_t) image->columns))
return(MagickFalse);
- if ((y_offset < 0) || (y_offset >= (long) image->rows))
+ if ((y_offset < 0) || (y_offset >= (ssize_t) image->rows))
return(MagickFalse);
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
while (s > segment_stack)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Pop segment off stack.
*/
s--;
- x1=(long) s->x1;
- x2=(long) s->x2;
- offset=(long) s->y2;
- y=(long) s->y1+offset;
+ x1=(ssize_t) s->x1;
+ x2=(ssize_t) s->x2;
+ offset=(ssize_t) s->y2;
+ y=(ssize_t) s->y1+offset;
/*
Recolor neighboring pixels.
*/
- p=GetVirtualPixels(image,0,y,(unsigned long) (x1+1),1,&image->exception);
- q=GetAuthenticPixels(floodplane_image,0,y,(unsigned long) (x1+1),1,
+ p=GetVirtualPixels(image,0,y,(size_t) (x1+1),1,&image->exception);
+ q=GetAuthenticPixels(floodplane_image,0,y,(size_t) (x1+1),1,
&image->exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
{
if (skip == MagickFalse)
{
- if (x < (long) image->columns)
+ if (x < (ssize_t) image->columns)
{
p=GetVirtualPixels(image,x,y,image->columns-x,1,
&image->exception);
if ((p == (const PixelPacket *) NULL) ||
(q == (PixelPacket *) NULL))
break;
- for ( ; x < (long) image->columns; x++)
+ for ( ; x < (ssize_t) image->columns; x++)
{
if (q->opacity == (Quantum) TransparentOpacity)
break;
x++;
if (x <= x2)
{
- p=GetVirtualPixels(image,x,y,(unsigned long) (x2-x+1),1,
+ p=GetVirtualPixels(image,x,y,(size_t) (x2-x+1),1,
&image->exception);
- q=GetAuthenticPixels(floodplane_image,x,y,(unsigned long) (x2-x+1),1,
+ q=GetAuthenticPixels(floodplane_image,x,y,(size_t) (x2-x+1),1,
&image->exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
start=x;
} while (x <= x2);
}
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Tile fill color onto floodplane.
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- if (p->opacity != OpaqueOpacity)
+ if (GetOpacityPixelComponent(p) != OpaqueOpacity)
{
(void) GetFillColor(draw_info,x,y,&fill_color);
MagickCompositeOver(&fill_color,(MagickRealType) fill_color.opacity,q,
}
segment_stack=(SegmentInfo *) RelinquishMagickMemory(segment_stack);
floodplane_image=DestroyImage(floodplane_image);
- return(y == (long) image->rows ? MagickTrue : MagickFalse);
+ return(y == (ssize_t) image->rows ? MagickTrue : MagickFalse);
}
\f
/*
%
% DeleteImageAttribute() deletes an attribute from the image.
%
+% Deprecated, replace with:
+%
+% DeleteImageProperty(image,key);
+%
% The format of the DeleteImageAttribute method is:
%
% MagickBooleanType DeleteImageAttribute(Image *image,const char *key)
%
% The format of the DeleteImageList method is:
%
-% unsigned int DeleteImageList(Image *images,const long offset)
+% unsigned int DeleteImageList(Image *images,const ssize_t offset)
%
% A description of each parameter follows:
%
% o offset: the position within the list.
%
*/
-MagickExport unsigned int DeleteImageList(Image *images,const long offset)
+MagickExport unsigned int DeleteImageList(Image *images,const ssize_t offset)
{
- register long
+ register ssize_t
i;
if (images->debug != MagickFalse)
% It returns MagickTrue if the entry is deleted otherwise MagickFalse if no
% entry is found in the registry that matches the id.
%
+% Deprecated, replace with:
+%
+% char key[MaxTextExtent];
+% FormatMagickString(key,MaxTextExtent,"%ld\n",id);
+% DeleteImageRegistry(key);
+%
% The format of the DeleteMagickRegistry method is:
%
-% MagickBooleanType DeleteMagickRegistry(const long id)
+% MagickBooleanType DeleteMagickRegistry(const ssize_t id)
%
% A description of each parameter follows:
%
% o id: the registry id.
%
*/
-MagickExport MagickBooleanType DeleteMagickRegistry(const long id)
+MagickExport MagickBooleanType DeleteMagickRegistry(const ssize_t id)
{
char
key[MaxTextExtent];
- (void) FormatMagickString(key,MaxTextExtent,"%ld\n",id);
+ (void) FormatMagickString(key,MaxTextExtent,"%.20g\n",(double) id);
return(DeleteImageRegistry(key));
}
\f
% %
% %
% %
++ D e s t r o y C o n s t i t u t e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DestroyConstitute() destroys the constitute component.
+%
+% The format of the DestroyConstitute method is:
+%
+% DestroyConstitute(void)
+%
+*/
+MagickExport void DestroyConstitute(void)
+{
+ ConstituteComponentTerminus();
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+ D e s t r o y M a g i c k R e g i s t r y %
% %
% %
%
% DestroyMagickRegistry() deallocates memory associated the magick registry.
%
+% Deprecated, replace with:
+%
+% RegistryComponentTerminus();
+%
% The format of the DestroyMagickRegistry method is:
%
% void DestroyMagickRegistry(void)
*/
MagickExport void DestroyMagickRegistry(void)
{
- DestroyImageRegistry();
+ RegistryComponentTerminus();
}
\f
/*
% DescribeImage() describes an image by printing its attributes to the file.
% Attributes include the image width, height, size, and others.
%
+% Deprecated, replace with:
+%
+% IdentifyImage(image,file,verbose);
+%
% The format of the DescribeImage method is:
%
% MagickBooleanType DescribeImage(Image *image,FILE *file,
%
% DestroyImages() destroys an image list.
%
+% Deprecated, replace with:
+%
+% DestroyImageList(image);
+%
% The format of the DestroyImages method is:
%
% void DestroyImages(Image *image)
%
% DestroyMagick() destroys the ImageMagick environment.
%
+% Deprecated, replace with:
+%
+% MagickCoreTerminus();
+%
% The format of the DestroyMagick function is:
%
% DestroyMagick(void)
%
% DispatchImage() extracts pixel data from an image and returns it to you.
% The method returns MagickFalse on success otherwise MagickTrue if an error is
-% encountered. The data is returned as char, short int, int, long, float,
+% encountered. The data is returned as char, short int, int, ssize_t, float,
% or double in the order specified by map.
%
% Suppose you want to extract the first scanline of a 640x480 image as
%
% DispatchImage(image,0,0,640,1,"RGB",CharPixel,pixels,exception);
%
+% Deprecated, replace with:
+%
+% ExportImagePixels(image,x_offset,y_offset,columns,rows,map,type,pixels,
+% exception);
+%
% The format of the DispatchImage method is:
%
-% unsigned int DispatchImage(const Image *image,const long x_offset,
-% const long y_offset,const unsigned long columns,
-% const unsigned long rows,const char *map,const StorageType type,
+% unsigned int DispatchImage(const Image *image,const ssize_t x_offset,
+% const ssize_t y_offset,const size_t columns,
+% const size_t rows,const char *map,const StorageType type,
% void *pixels,ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport unsigned int DispatchImage(const Image *image,const long x_offset,
- const long y_offset,const unsigned long columns,const unsigned long rows,
+MagickExport unsigned int DispatchImage(const Image *image,const ssize_t x_offset,
+ const ssize_t y_offset,const size_t columns,const size_t rows,
const char *map,const StorageType type,void *pixels,ExceptionInfo *exception)
{
unsigned int
%
% The format of the ExtractSubimageFromImageImage method is:
%
-% Image *ExtractSubimageFromImage(const Image *image,const Image *reference,
-% ExceptionInfo *exception)
+% Image *ExtractSubimageFromImage(const Image *image,
+% const Image *reference,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
*/
static double GetSimilarityMetric(const Image *image,const Image *reference,
- const long x_offset,const long y_offset,const double similarity_threshold,
- ExceptionInfo *exception)
+ const ssize_t x_offset,const ssize_t y_offset,
+ const double similarity_threshold,ExceptionInfo *exception)
{
- long
- y;
+ CacheView
+ *image_view,
+ *reference_view;
double
channels,
normalized_similarity,
similarity;
- CacheView
- *image_view,
- *reference_view;
+ ssize_t
+ y;
/*
Compute the similarity in pixels between two images.
channels++;
image_view=AcquireCacheView(image);
reference_view=AcquireCacheView(reference);
- for (y=0; y < (long) reference->rows; y++)
+ for (y=0; y < (ssize_t) reference->rows; y++)
{
register const IndexPacket
*indexes,
*p,
*q;
- register long
+ register ssize_t
x;
p=GetCacheViewVirtualPixels(image_view,x_offset,y_offset+y,
continue;
indexes=GetCacheViewVirtualIndexQueue(image_view);
reference_indexes=GetCacheViewVirtualIndexQueue(reference_view);
- for (x=0; x < (long) reference->columns; x++)
+ for (x=0; x < (ssize_t) reference->columns; x++)
{
MagickRealType
pixel;
- pixel=QuantumScale*(p->red-(double) q->red);
+ pixel=QuantumScale*(GetRedPixelComponent(p)-(double)
+ GetRedPixelComponent(q));
similarity+=pixel*pixel;
- pixel=QuantumScale*(p->green-(double) q->green);
+ pixel=QuantumScale*(GetGreenPixelComponent(p)-(double)
+ GetGreenPixelComponent(q));
similarity+=pixel*pixel;
- pixel=QuantumScale*(p->blue-(double) q->blue);
+ pixel=QuantumScale*(GetBluePixelComponent(p)-(double)
+ GetBluePixelComponent(q));
similarity+=pixel*pixel;
if ((image->matte != MagickFalse) && (reference->matte != MagickFalse))
{
- pixel=QuantumScale*(p->opacity-(double) q->opacity);
+ pixel=QuantumScale*(GetOpacityPixelComponent(p)-(double)
+ GetOpacityPixelComponent(q));
similarity+=pixel*pixel;
}
if ((image->colorspace == CMYKColorspace) &&
MagickExport Image *ExtractSubimageFromImage(Image *image,
const Image *reference,ExceptionInfo *exception)
{
- long
- y;
-
double
similarity_threshold;
RectangleInfo
offset;
+ ssize_t
+ y;
+
/*
Extract reference from image.
*/
if ((reference->columns > image->columns) || (reference->rows > image->rows))
return((Image *) NULL);
- similarity_threshold=image->columns*image->rows;
+ similarity_threshold=(double) image->columns*image->rows;
SetGeometry(reference,&offset);
-#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
- #pragma omp parallel for
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+ #pragma omp parallel for schedule(dynamic,4)
#endif
- for (y=0; y < (long) (image->rows-reference->rows); y++)
+ for (y=0; y < (ssize_t) (image->rows-reference->rows); y++)
{
double
similarity;
- register long
+ register ssize_t
x;
- for (x=0; x < (long) (image->columns-reference->columns); x++)
+ for (x=0; x < (ssize_t) (image->columns-reference->columns); x++)
{
similarity=GetSimilarityMetric(image,reference,x,y,similarity_threshold,
exception);
-#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_ExtractSubimageFromImage)
#endif
if (similarity < similarity_threshold)
%
% FlattenImages() Obsolete Function: Use MergeImageLayers() instead.
%
+% Deprecated, replace with:
+%
+% MergeImageLayers(image,FlattenLayer,exception);
+%
% The format of the FlattenImage method is:
%
% Image *FlattenImage(Image *image,ExceptionInfo *exception)
operands;
va_start(operands,format);
- FormatMagickStringList(string,MaxTextExtent,format,operands);
+ (void) FormatMagickStringList(string,MaxTextExtent,format,operands);
va_end(operands);
return;
}
register MagickRealType
distance;
- if ((fuzz == 0.0) && (p->red == q->red) && (p->green == q->green) &&
- (p->blue == q->blue))
+ if ((fuzz == 0.0) && (GetRedPixelComponent(p) == GetRedPixelComponent(q)) &&
+ (GetGreenPixelComponent(p) == GetGreenPixelComponent(q)) &&
+ (GetBluePixelComponent(p) == GetBluePixelComponent(q)))
return(MagickTrue);
- pixel.red=p->red-(MagickRealType) q->red;
+ pixel.red=GetRedPixelComponent(p)-(MagickRealType) GetRedPixelComponent(q);
distance=pixel.red*pixel.red;
if (distance > (fuzz*fuzz))
return(MagickFalse);
- pixel.green=p->green-(MagickRealType) q->green;
+ pixel.green=GetGreenPixelComponent(p)-(MagickRealType)
+ GetGreenPixelComponent(q);
distance+=pixel.green*pixel.green;
if (distance > (fuzz*fuzz))
return(MagickFalse);
- pixel.blue=p->blue-(MagickRealType) q->blue;
+ pixel.blue=GetBluePixelComponent(p)-(MagickRealType) GetBluePixelComponent(q);
distance+=pixel.blue*pixel.blue;
if (distance > (fuzz*fuzz))
return(MagickFalse);
% method is used by MatteFloodFill() and other algorithms which compare
% two opacity values.
%
+% Deprecated, replace with:
+%
+% IsOpacitySimilar(image,p,q);
+%
% The format of the FuzzyOpacityCompare method is:
%
% void FuzzyOpacityCompare(const Image *image,const PixelPacket *p,
blob=FileToBlob(path,~0,length,exception);
}
#endif
-#if defined(__WINDOWS__) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_PATH))
if (blob == (void *) NULL)
{
char
*/
if ((blob == (void *) NULL) && (IsPathAccessible(path) != MagickFalse))
blob=FileToBlob(path,~0,length,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
/*
Search Windows registry.
*/
% defined by the geometry parameters. A pointer to the pixels is returned if
% the pixels are transferred, otherwise a NULL is returned.
%
+% Deprecated, replace with:
+%
+% GetCacheViewAuthenticPixels(cache_view,x,y,columns,rows,
+% GetCacheViewException(cache_view));
+%
% The format of the GetCacheView method is:
%
-% PixelPacket *GetCacheView(CacheView *cache_view,const long x,
-% const long y,const unsigned long columns,const unsigned long rows)
+% PixelPacket *GetCacheView(CacheView *cache_view,const ssize_t x,
+% const ssize_t y,const size_t columns,const size_t rows)
%
% A description of each parameter follows:
%
% pixels.
%
*/
-MagickExport PixelPacket *GetCacheView(CacheView *cache_view,const long x,
- const long y,const unsigned long columns,const unsigned long rows)
+MagickExport PixelPacket *GetCacheView(CacheView *cache_view,const ssize_t x,
+ const ssize_t y,const size_t columns,const size_t rows)
{
PixelPacket
*pixels;
% GetCacheViewIndexes() returns the indexes associated with the specified
% view.
%
+% Deprecated, replace with:
+%
+% GetCacheViewAuthenticIndexQueue(cache_view);
+%
% The format of the GetCacheViewIndexes method is:
%
% IndexPacket *GetCacheViewIndexes(CacheView *cache_view)
% defined by the geometry parameters. A pointer to the pixels is returned if
% the pixels are transferred, otherwise a NULL is returned.
%
+% Deprecated, replace with:
+%
+% GetCacheViewAuthenticPixels(cache_view,x,y,columns,rows,
+% GetCacheViewException(cache_view));
+%
% The format of the GetCacheViewPixels method is:
%
-% PixelPacket *GetCacheViewPixels(CacheView *cache_view,const long x,
-% const long y,const unsigned long columns,const unsigned long rows)
+% PixelPacket *GetCacheViewPixels(CacheView *cache_view,const ssize_t x,
+% const ssize_t y,const size_t columns,const size_t rows)
%
% A description of each parameter follows:
%
% pixels.
%
*/
-MagickExport PixelPacket *GetCacheViewPixels(CacheView *cache_view,const long x,
- const long y,const unsigned long columns,const unsigned long rows)
+MagickExport PixelPacket *GetCacheViewPixels(CacheView *cache_view,const ssize_t x,
+ const ssize_t y,const size_t columns,const size_t rows)
{
PixelPacket
*pixels;
% GetImageClippingPathAttribute() searches the list of image attributes and
% returns a pointer to a clipping path if it exists otherwise NULL.
%
+% Deprecated, replace with:
+%
+% GetImageAttribute(image,"8BIM:1999,2998");
+%
% The format of the GetImageClippingPathAttribute method is:
%
% const ImageAttribute *GetImageClippingPathAttribute(Image *image)
% GetImageFromMagickRegistry() gets an image from the registry as defined by
% its name. If the image is not found, a NULL image is returned.
%
+% Deprecated, replace with:
+%
+% GetImageRegistry(ImageRegistryType,name,exception);
+%
% The format of the GetImageFromMagickRegistry method is:
%
-% Image *GetImageFromMagickRegistry(const char *name,long *id,
+% Image *GetImageFromMagickRegistry(const char *name,ssize_t *id,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *GetImageFromMagickRegistry(const char *name,long *id,
+MagickExport Image *GetImageFromMagickRegistry(const char *name,ssize_t *id,
ExceptionInfo *exception)
{
*id=0L;
%
% The format of the GetMagickRegistry method is:
%
-% const void *GetMagickRegistry(const long id,RegistryType *type,
+% const void *GetMagickRegistry(const ssize_t id,RegistryType *type,
% size_t *length,ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport void *GetMagickRegistry(const long id,RegistryType *type,
+MagickExport void *GetMagickRegistry(const ssize_t id,RegistryType *type,
size_t *length,ExceptionInfo *exception)
{
char
*type=UndefinedRegistryType;
*length=0;
- (void) FormatMagickString(key,MaxTextExtent,"%ld\n",id);
+ (void) FormatMagickString(key,MaxTextExtent,"%.20g\n",(double) id);
blob=(void *) GetImageRegistry(ImageRegistryType,key,exception);
if (blob != (void *) NULL)
return(blob);
% GetImageGeometry() returns a region as defined by the geometry string with
% respect to the image and its gravity.
%
+% Deprecated, replace with:
+%
+% if (size_to_fit != MagickFalse)
+% ParseRegionGeometry(image,geometry,region_info,&image->exception); else
+% ParsePageGeometry(image,geometry,region_info,&image->exception);
+%
% The format of the GetImageGeometry method is:
%
% int GetImageGeometry(Image *image,const char *geometry,
%
% GetImageList() returns an image at the specified position in the list.
%
+% Deprecated, replace with:
+%
+% CloneImage(GetImageFromList(images,(ssize_t) offset),0,0,MagickTrue,
+% exception);
+%
% The format of the GetImageList method is:
%
-% Image *GetImageList(const Image *images,const long offset,
+% Image *GetImageList(const Image *images,const ssize_t offset,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *GetImageList(const Image *images,const long offset,
+MagickExport Image *GetImageList(const Image *images,const ssize_t offset,
ExceptionInfo *exception)
{
Image
if (images->debug != MagickFalse)
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.2");
- image=CloneImage(GetImageFromList(images,(long) offset),0,0,MagickTrue,
+ image=CloneImage(GetImageFromList(images,(ssize_t) offset),0,0,MagickTrue,
exception);
return(image);
}
% GetImageListIndex() returns the position in the list of the specified
% image.
%
+% Deprecated, replace with:
+%
+% GetImageIndexInList(images);
+%
% The format of the GetImageListIndex method is:
%
-% long GetImageListIndex(const Image *images)
+% ssize_t GetImageListIndex(const Image *images)
%
% A description of each parameter follows:
%
% o images: the image list.
%
*/
-MagickExport long GetImageListIndex(const Image *images)
+MagickExport ssize_t GetImageListIndex(const Image *images)
{
if (images->debug != MagickFalse)
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.2");
%
% GetImageListSize() returns the number of images in the list.
%
+% Deprecated, replace with:
+%
+% GetImageListLength(images);
+%
% The format of the GetImageListSize method is:
%
-% unsigned long GetImageListSize(const Image *images)
+% size_t GetImageListSize(const Image *images)
%
% A description of each parameter follows:
%
% o images: the image list.
%
*/
-MagickExport unsigned long GetImageListSize(const Image *images)
+MagickExport size_t GetImageListSize(const Image *images)
{
if (images->debug != MagickFalse)
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.2");
% array has been updated, the changes must be saved back to the underlying
% image using SyncAuthenticPixels() or they may be lost.
%
+% Deprecated, replace with:
+%
+% GetAuthenticPixels(image,x,y,columns,rows,&image->exception);
+%
% The format of the GetImagePixels() method is:
%
-% PixelPacket *GetImagePixels(Image *image,const long x,const long y,
-% const unsigned long columns,const unsigned long rows)
+% PixelPacket *GetImagePixels(Image *image,const ssize_t x,const ssize_t y,
+% const size_t columns,const size_t rows)
%
% A description of each parameter follows:
%
% pixels.
%
*/
-MagickExport PixelPacket *GetImagePixels(Image *image,const long x,const long y,
- const unsigned long columns,const unsigned long rows)
+MagickExport PixelPacket *GetImagePixels(Image *image,const ssize_t x,const ssize_t y,
+ const size_t columns,const size_t rows)
{
return(GetAuthenticPixels(image,x,y,columns,rows,&image->exception));
}
% with the last call to QueueAuthenticPixels() or GetVirtualPixels(). NULL is
% returned if the black channel or colormap indexes are not available.
%
+% Deprecated, replace with:
+%
+% GetAuthenticIndexQueue(image);
+%
% The format of the GetIndexes() method is:
%
% IndexPacket *GetIndexes(const Image *image)
% geometry is modified as determined by the meta characters: %, !, <, >,
% and ~.
%
+% Deprecated, replace with:
+%
+% ParseMetaGeometry(geometry,x,y,width,height);
+%
% The format of the GetMagickGeometry method is:
%
-% unsigned int GetMagickGeometry(const char *geometry,long *x,long *y,
-% unsigned long *width,unsigned long *height)
+% unsigned int GetMagickGeometry(const char *geometry,ssize_t *x,ssize_t *y,
+% size_t *width,size_t *height)
%
% A description of each parameter follows:
%
% as determined by the geometry specification is returned here.
%
*/
-MagickExport unsigned int GetMagickGeometry(const char *geometry,long *x,
- long *y,unsigned long *width,unsigned long *height)
+MagickExport unsigned int GetMagickGeometry(const char *geometry,ssize_t *x,
+ ssize_t *y,size_t *width,size_t *height)
{
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.3");
return(ParseMetaGeometry(geometry,x,y,width,height));
%
% GetNextImage() returns the next image in a list.
%
+% Deprecated, replace with:
+%
+% GetNextImageInList(images);
+%
% The format of the GetNextImage method is:
%
% Image *GetNextImage(const Image *images)
%
% GetNextImageAttribute() gets the next image attribute.
%
+% Deprecated, replace with:
+%
+% const char *property;
+% property=GetNextImageProperty(image);
+% if (property != (const char *) NULL)
+% GetImageAttribute(image,property);
+%
% The format of the GetNextImageAttribute method is:
%
% const ImageAttribute *GetNextImageAttribute(const Image *image)
%
% GetNumberScenes() returns the number of images in the list.
%
+% Deprecated, replace with:
+%
+% GetImageListLength(image);
+%
% The format of the GetNumberScenes method is:
%
% unsigned int GetNumberScenes(const Image *images)
% GetOnePixel() returns a single pixel at the specified (x,y) location.
% The image background color is returned if an error occurs.
%
+% Deprecated, replace with:
+%
+% GetOneAuthenticPixel(image,x,y,&pixel,&image->exception);
+%
% The format of the GetOnePixel() method is:
%
-% PixelPacket GetOnePixel(const Image image,const long x,const long y)
+% PixelPacket GetOnePixel(const Image image,const ssize_t x,const ssize_t y)
%
% A description of each parameter follows:
%
% o x,y: These values define the location of the pixel to return.
%
*/
-MagickExport PixelPacket GetOnePixel(Image *image,const long x,const long y)
+MagickExport PixelPacket GetOnePixel(Image *image,const ssize_t x,const ssize_t y)
{
PixelPacket
pixel;
% GetPixels() returns the pixels associated with the last call to
% QueueAuthenticPixels() or GetAuthenticPixels().
%
+% Deprecated, replace with:
+%
+% GetAuthenticPixelQueue(image);
+%
% The format of the GetPixels() method is:
%
% PixelPacket *GetPixels(const Image image)
%
% GetPreviousImage() returns the previous image in a list.
%
+% Deprecated, replace with:
+%
+% GetPreviousImageInList(images));
+%
% The format of the GetPreviousImage method is:
%
% Image *GetPreviousImage(const Image *images)
r=HueToRGB(m1,m2,hue+1.0/3.0);
g=HueToRGB(m1,m2,hue);
b=HueToRGB(m1,m2,hue-1.0/3.0);
- *red=RoundToQuantum((MagickRealType) QuantumRange*r);
- *green=RoundToQuantum((MagickRealType) QuantumRange*g);
- *blue=RoundToQuantum((MagickRealType) QuantumRange*b);
+ *red=ClampToQuantum((MagickRealType) QuantumRange*r);
+ *green=ClampToQuantum((MagickRealType) QuantumRange*g);
+ *blue=ClampToQuantum((MagickRealType) QuantumRange*b);
}
\f
/*
%
% InitializeMagick() initializes the ImageMagick environment.
%
+% Deprecated, replace with:
+%
+% MagickCoreGenesis(path,MagickFalse);
+%
% The format of the InitializeMagick function is:
%
% InitializeMagick(const char *path)
return(delta->x*x+delta->y*y+(1.0-delta->x-delta->y)*p);
}
-static inline long NearestNeighbor(MagickRealType x)
+static inline ssize_t NearestNeighbor(MagickRealType x)
{
if (x >= 0.0)
- return((long) (x+0.5));
- return((long) (x-0.5));
+ return((ssize_t) (x+0.5));
+ return((ssize_t) (x-0.5));
}
MagickExport MagickPixelPacket InterpolatePixelColor(const Image *image,
register const PixelPacket
*p;
- register long
+ register ssize_t
i;
assert(image != (Image *) NULL);
alpha[16],
gamma;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-
- 1,4,4,exception);
+ p=GetCacheViewVirtualPixels(image_view,(ssize_t) floor(x)-1,(ssize_t)
+ floor(y)-1,4,4,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
PointInfo
delta;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-
- 1,4,4,exception);
+ p=GetCacheViewVirtualPixels(image_view,(ssize_t) floor(x)-1,(ssize_t)
+ floor(y)-1,4,4,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
PointInfo
delta;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x),(long) floor(y),2,
- 2,exception);
+ p=GetCacheViewVirtualPixels(image_view,(ssize_t) floor(x),(ssize_t)
+ floor(y),2,2,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
geometry.width=4L;
geometry.height=4L;
- geometry.x=(long) floor(x)-1L;
- geometry.y=(long) floor(y)-1L;
+ geometry.x=(ssize_t) floor(x)-1L;
+ geometry.y=(ssize_t) floor(y)-1L;
excerpt_image=ExcerptImage(image,&geometry,exception);
if (excerpt_image == (Image *) NULL)
break;
MagickPixelPacket
pixels[1];
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x),(long) floor(y),1,
- 1,exception);
+ p=GetCacheViewVirtualPixels(image_view,(ssize_t) floor(x),(ssize_t)
+ floor(y),1,1,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
delta,
luminance;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x),(long) floor(y),
- 2,2,exception);
+ p=GetCacheViewVirtualPixels(image_view,(ssize_t) floor(x),(ssize_t)
+ floor(y),2,2,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
alpha[i]=1.0;
if (image->matte != MagickFalse)
{
- alpha[i]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[i]=QuantumScale*((MagickRealType) GetAlphaPixelComponent(p));
pixels[i].red*=alpha[i];
pixels[i].green*=alpha[i];
pixels[i].blue*=alpha[i];
}
case SplineInterpolatePixel:
{
- long
- j,
- n;
-
MagickPixelPacket
pixels[16];
PointInfo
delta;
- p=GetCacheViewVirtualPixels(image_view,(long) floor(x)-1,(long) floor(y)-
- 1,4,4,exception);
+ ssize_t
+ j,
+ n;
+
+ p=GetCacheViewVirtualPixels(image_view,(ssize_t) floor(x)-1,(ssize_t)
+ floor(y)-1,4,4,exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetCacheViewVirtualIndexQueue(image_view);
alpha[n]=1.0;
if (image->matte != MagickFalse)
{
- alpha[n]=QuantumScale*((MagickRealType) QuantumRange-p->opacity);
+ alpha[n]=QuantumScale*((MagickRealType)
+ GetAlphaPixelComponent(p));
pixels[n].red*=alpha[n];
pixels[n].green*=alpha[n];
pixels[n].blue*=alpha[n];
% InterpretImageAttributes() replaces any embedded formatting characters with
% the appropriate image attribute and returns the translated text.
%
+% Deprecated, replace with:
+%
+% InterpretImageProperties(image_info,image,embed_text);
+%
% The format of the InterpretImageAttributes method is:
%
% char *InterpretImageAttributes(const ImageInfo *image_info,Image *image,
% LevelImageColor() will map the given color to "black" and "white"
% values, limearly spreading out the colors, and level values on a channel by
% channel bases, as per LevelImage(). The given colors allows you to specify
-% different level ranges for each of the color channels seperatally.
+% different level ranges for each of the color channels separately.
%
% If the boolean 'invert' is set true the image values will modifyed in the
% reverse direction. That is any existing "black" and "white" colors in the
% appropriatally. This effectivally maps a greyscale gradient into the given
% color gradient.
%
+% Deprecated, replace with:
+%
+% LevelColorsImageChannel(image,channel,black_color,white_color,invert);
+%
% The format of the LevelImageColors method is:
%
% MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
%
% LiberateSemaphoreInfo() relinquishes a semaphore.
%
+% Deprecated, replace with:
+%
+% UnlockSemaphoreInfo(*semaphore_info);
+%
% The format of the LiberateSemaphoreInfo method is:
%
% LiberateSemaphoreInfo(void **semaphore_info)
MagickExport void LiberateSemaphoreInfo(SemaphoreInfo **semaphore_info)
{
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.7");
- RelinquishSemaphoreInfo(*semaphore_info);
+ UnlockSemaphoreInfo(*semaphore_info);
}
\f
/*
%
% MagickIncarnate() initializes the ImageMagick environment.
%
+% Deprecated, replace with:
+%
+% MagickCoreGenesis(path,MagickFalse);
+%
% The format of the MagickIncarnate function is:
%
% MagickIncarnate(const char *path)
% MapImage() replaces the colors of an image with the closest color from a
% reference image.
%
+% Deprecated, replace with:
+%
+% QuantizeInfo quantize_info;
+% GetQuantizeInfo(&quantize_info);
+% quantize_info.dither=dither;
+% RemapImage(&quantize_info,image,map_image);
+%
% The format of the MapImage method is:
%
% MagickBooleanType MapImage(Image *image,const Image *map_image,
% MapImages() replaces the colors of a sequence of images with the closest
% color from a reference image.
%
+% Deprecated, replace with:
+%
+% QuantizeInfo quantize_info;
+% GetQuantizeInfo(&quantize_info);
+% quantize_info.dither=dither;
+% RemapImages(&quantize_info,images,map_image);
+%
% The format of the MapImage method is:
%
% MagickBooleanType MapImages(Image *images,Image *map_image,
% The format of the MatteFloodfillImage method is:
%
% MagickBooleanType MatteFloodfillImage(Image *image,
-% const PixelPacket target,const Quantum opacity,const long x_offset,
-% const long y_offset,const PaintMethod method)
+% const PixelPacket target,const Quantum opacity,const ssize_t x_offset,
+% const ssize_t y_offset,const PaintMethod method)
%
% A description of each parameter follows:
%
%
*/
MagickExport MagickBooleanType MatteFloodfillImage(Image *image,
- const PixelPacket target,const Quantum opacity,const long x_offset,
- const long y_offset,const PaintMethod method)
+ const PixelPacket target,const Quantum opacity,const ssize_t x_offset,
+ const ssize_t y_offset,const PaintMethod method)
{
Image
*floodplane_image;
- long
- offset,
- start,
- x,
- x1,
- x2,
- y;
-
MagickBooleanType
skip;
SegmentInfo
*segment_stack;
+ ssize_t
+ offset,
+ start,
+ x,
+ x1,
+ x2,
+ y;
+
/*
Check boundary conditions.
*/
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- if ((x_offset < 0) || (x_offset >= (long) image->columns))
+ if ((x_offset < 0) || (x_offset >= (ssize_t) image->columns))
return(MagickFalse);
- if ((y_offset < 0) || (y_offset >= (long) image->rows))
+ if ((y_offset < 0) || (y_offset >= (ssize_t) image->rows))
return(MagickFalse);
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
while (s > segment_stack)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Pop segment off stack.
*/
s--;
- x1=(long) s->x1;
- x2=(long) s->x2;
- offset=(long) s->y2;
- y=(long) s->y1+offset;
+ x1=(ssize_t) s->x1;
+ x2=(ssize_t) s->x2;
+ offset=(ssize_t) s->y2;
+ y=(ssize_t) s->y1+offset;
/*
Recolor neighboring pixels.
*/
- p=GetVirtualPixels(image,0,y,(unsigned long) (x1+1),1,&image->exception);
- q=GetAuthenticPixels(floodplane_image,0,y,(unsigned long) (x1+1),1,
+ p=GetVirtualPixels(image,0,y,(size_t) (x1+1),1,&image->exception);
+ q=GetAuthenticPixels(floodplane_image,0,y,(size_t) (x1+1),1,
&image->exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
{
if (skip == MagickFalse)
{
- if (x < (long) image->columns)
+ if (x < (ssize_t) image->columns)
{
p=GetVirtualPixels(image,x,y,image->columns-x,1,
&image->exception);
if ((p == (const PixelPacket *) NULL) ||
(q == (PixelPacket *) NULL))
break;
- for ( ; x < (long) image->columns; x++)
+ for ( ; x < (ssize_t) image->columns; x++)
{
if (q->opacity == (Quantum) TransparentOpacity)
break;
x++;
if (x <= x2)
{
- p=GetVirtualPixels(image,x,y,(unsigned long) (x2-x+1),1,
+ p=GetVirtualPixels(image,x,y,(size_t) (x2-x+1),1,
&image->exception);
- q=GetAuthenticPixels(floodplane_image,x,y,(unsigned long) (x2-x+1),1,
+ q=GetAuthenticPixels(floodplane_image,x,y,(size_t) (x2-x+1),1,
&image->exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
start=x;
} while (x <= x2);
}
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register const PixelPacket
- *__restrict p;
+ *restrict p;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
/*
Tile fill color onto floodplane.
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if ((p == (const PixelPacket *) NULL) || (q == (PixelPacket *) NULL))
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- if (p->opacity != OpaqueOpacity)
+ if (GetOpacityPixelComponent(p) != OpaqueOpacity)
q->opacity=opacity;
p++;
q++;
}
segment_stack=(SegmentInfo *) RelinquishMagickMemory(segment_stack);
floodplane_image=DestroyImage(floodplane_image);
- return(y == (long) image->rows ? MagickTrue : MagickFalse);
+ return(y == (ssize_t) image->rows ? MagickTrue : MagickFalse);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% M a x i m u m I m a g e s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MaximumImages() returns the maximum intensity of an image sequence.
+%
+% Deprecated, replace with:
+%
+% EvaluateImages(images,MinEvaluateOperator,exception);
+%
+% The format of the MaxImages method is:
+%
+% Image *MaximumImages(Image *images,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o images: the image sequence.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *MaximumImages(const Image *images,ExceptionInfo *exception)
+{
+ return(EvaluateImages(images,MinEvaluateOperator,exception));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% M i n i m u m I m a g e s %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MinimumImages() returns the minimum intensity of an image sequence.
+%
+% Deprecated, replace with:
+%
+% EvaluateImages(images,MinEvaluateOperator,exception);
+%
+% The format of the MinimumImages method is:
+%
+% Image *MinimumImages(Image *images,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o images: the image sequence.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *MinimumImages(const Image *images,ExceptionInfo *exception)
+{
+ return(EvaluateImages(images,MinEvaluateOperator,exception));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% M e d i a n F i l t e r I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MedianFilterImage() applies a digital filter that improves the quality
+% of a noisy image. Each pixel is replaced by the median in a set of
+% neighboring pixels as defined by radius.
+%
+% The algorithm was contributed by Mike Edmonds and implements an insertion
+% sort for selecting median color-channel values. For more on this algorithm
+% see "Skip Lists: A probabilistic Alternative to Balanced Trees" by William
+% Pugh in the June 1990 of Communications of the ACM.
+%
+% The format of the MedianFilterImage method is:
+%
+% Image *MedianFilterImage(const Image *image,const double radius,
+% ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o radius: the radius of the pixel neighborhood.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *MedianFilterImage(const Image *image,const double radius,
+ ExceptionInfo *exception)
+{
+ Image
+ *median_image;
+
+ median_image=StatisticImage(image,MedianStatistic,(size_t) radius,(size_t)
+ radius,exception);
+ return(median_image);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% M o d e I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ModeImage() makes each pixel the 'predominate color' of the neighborhood
+% of the specified radius.
+%
+% The format of the ModeImage method is:
+%
+% Image *ModeImage(const Image *image,const double radius,
+% ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o radius: the radius of the pixel neighborhood.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *ModeImage(const Image *image,const double radius,
+ ExceptionInfo *exception)
+{
+ Image
+ *mode_image;
+
+ mode_image=StatisticImage(image,ModeStatistic,(size_t) radius,(size_t) radius,
+ exception);
+ return(mode_image);
}
\f
/*
%
% MosaicImages() Obsolete Function: Use MergeImageLayers() instead.
%
+% Deprecated, replace with:
+%
+% MergeImageLayers(image,MosaicLayer,exception);
+%
% The format of the MosaicImage method is:
%
% Image *MosaicImages(const Image *image,ExceptionInfo *exception)
{
#define OpaqueImageTag "Opaque/Image"
- long
- y;
-
MagickBooleanType
proceed;
- register long
+ register ssize_t
i;
+ ssize_t
+ y;
+
/*
Make image color opaque.
*/
/*
Make DirectClass image opaque.
*/
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsColorSimilar(image,q,&target) != MagickFalse)
*q=fill;
}
if (SyncAuthenticPixels(image,&image->exception) == MagickFalse)
break;
- proceed=SetImageProgress(image,OpaqueImageTag,y,image->rows);
+ proceed=SetImageProgress(image,OpaqueImageTag,(MagickOffsetType) y,
+ image->rows);
if (proceed == MagickFalse)
break;
}
/*
Make PseudoClass image opaque.
*/
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
if (IsColorSimilar(image,&image->colormap[i],&target) != MagickFalse)
image->colormap[i]=fill;
}
if (fill.opacity != OpaqueOpacity)
{
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsColorSimilar(image,q,&target) != MagickFalse)
q->opacity=fill.opacity;
% OpenCacheView() opens a view into the pixel cache, using the
% VirtualPixelMethod that is defined within the given image itself.
%
+% Deprecated, replace with:
+%
+% AcquireCacheView(image);
+%
% The format of the OpenCacheView method is:
%
% CacheView *OpenCacheView(const Image *image)
% color red at intensities of 100 and 102 respectively are now
% interpreted as the same color for the purposes of the floodfill.
%
+% Deprecated, replace with:
+%
+% FloodfillPaintImage(image,channel,draw_info,target,x,y,
+% method == FloodfillMethod ? MagickFalse : MagickTrue);
+%
% The format of the PaintFloodfillImage method is:
%
% MagickBooleanType PaintFloodfillImage(Image *image,
-% const ChannelType channel,const MagickPixelPacket target,const long x,
-% const long y,const DrawInfo *draw_info,const PaintMethod method)
+% const ChannelType channel,const MagickPixelPacket target,const ssize_t x,
+% const ssize_t y,const DrawInfo *draw_info,const PaintMethod method)
%
% A description of each parameter follows:
%
%
*/
MagickExport MagickBooleanType PaintFloodfillImage(Image *image,
- const ChannelType channel,const MagickPixelPacket *target,const long x,
- const long y,const DrawInfo *draw_info,const PaintMethod method)
+ const ChannelType channel,const MagickPixelPacket *target,const ssize_t x,
+ const ssize_t y,const DrawInfo *draw_info,const PaintMethod method)
{
MagickBooleanType
status;
% For example, set fuzz to 10 and the color red at intensities of 100 and
% 102 respectively are now interpreted as the same color.
%
+% Deprecated, replace with:
+%
+% OpaquePaintImageChannel(image,DefaultChannels,target,fill,MagickFalse);
+% OpaquePaintImageChannel(image,channel,target,fill,MagickFalse);
+%
% The format of the PaintOpaqueImage method is:
%
% MagickBooleanType PaintOpaqueImage(Image *image,
% For example, set fuzz to 10 and the color red at intensities of 100 and
% 102 respectively are now interpreted as the same color.
%
+% Deprecated, replace with:
+%
+% TransparentPaintImage(image,target,opacity,MagickFalse);
+%
% The format of the PaintTransparentImage method is:
%
% MagickBooleanType PaintTransparentImage(Image *image,
% geometry is modified as determined by the meta characters: %, !, <,
% and >.
%
+% Deprecated, replace with:
+%
+% ParseMetaGeometry(geometry,x,y,width,height);
+%
% The format of the ParseImageGeometry method is:
%
-% int ParseImageGeometry(char *geometry,long *x,long *y,
-% unsigned long *width,unsigned long *height)
+% int ParseImageGeometry(char *geometry,ssize_t *x,ssize_t *y,
+% size_t *width,size_t *height)
%
% A description of each parameter follows:
%
% as determined by the geometry specification is returned here.
%
*/
-MagickExport int ParseImageGeometry(const char *geometry,long *x,long *y,
- unsigned long *width,unsigned long *height)
+MagickExport int ParseImageGeometry(const char *geometry,ssize_t *x,ssize_t *y,
+ size_t *width,size_t *height)
{
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.1");
return((int) ParseMetaGeometry(geometry,x,y,width,height));
% ParseSizeGeometry() returns a region as defined by the geometry string with
% respect to the image dimensions and aspect ratio.
%
+% Deprecated, replace with:
+%
+% ParseMetaGeometry(geometry,®ion_info->x,®ion_info->y,
+% ®ion_info->width,®ion_info->height);
+%
% The format of the ParseSizeGeometry method is:
%
% MagickStatusType ParseSizeGeometry(const Image *image,
%
% PopImageList() removes the last image in the list.
%
+% Deprecated, replace with:
+%
+% RemoveLastImageFromList(images);
+%
% The format of the PopImageList method is:
%
% Image *PopImageList(Image **images)
% PostscriptGeometry() replaces any page mneumonic with the equivalent size in
% picas.
%
+% Deprecated, replace with:
+%
+% GetPageGeometry(page);
+%
% The format of the PostscriptGeometry method is:
%
% char *PostscriptGeometry(const char *page)
%
% PushImageList() adds an image to the end of the list.
%
+% Deprecated, replace with:
+%
+% AppendImageToList(images,CloneImageList(image,exception));
+%
% The format of the PushImageList method is:
%
% unsigned int PushImageList(Image *images,const Image *image,
% distance measure is normalized to a range between 0 and 1. It is
% independent of the range of red, green, and blue values in your image.
%
+% Deprecated, replace with:
+%
+% GetImageQuantizeError(image);
%
% The format of the QuantizationError method is:
%
lower_threshold,
upper_threshold;
- long
- count,
- y;
-
RandomInfo
*random_info;
+ ssize_t
+ count,
+ y;
+
static MagickRealType
o2[4]={0.2f, 0.6f, 0.8f, 0.4f},
o3[9]={0.1f, 0.6f, 0.3f, 0.7f, 0.5f, 0.8f, 0.4f, 0.9f, 0.2f},
1.2f, 0.4f, 0.9f, 1.3f, 0.2f},
threshold=128;
- unsigned long
+ size_t
order;
/*
order=1;
lower_threshold=0;
upper_threshold=0;
- count=sscanf(thresholds,"%lf[/x%%]%lf",&lower_threshold,
+ count=(ssize_t) sscanf(thresholds,"%lf[/x%%]%lf",&lower_threshold,
&upper_threshold);
if (strchr(thresholds,'%') != (char *) NULL)
{
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
random_info=AcquireRandomInfo();
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register IndexPacket
index,
- *__restrict indexes;
+ *restrict indexes;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (q == (PixelPacket *) NULL)
LocaleCompare(channel,"intensity") == 0)
{
indexes=GetAuthenticIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
- {
- MagickRealType
- intensity;
+ for (x=0; x < (ssize_t) image->columns; x++)
+ {
+ MagickRealType
+ intensity;
- intensity=(MagickRealType) PixelIntensityToQuantum(q);
- if (order == 1)
- {
- if (intensity < lower_threshold)
- threshold=lower_threshold;
- else if (intensity > upper_threshold)
- threshold=upper_threshold;
- else
- threshold=(MagickRealType) (QuantumRange*
- GetPseudoRandomValue(random_info));
- }
- else if (order == 2)
- threshold=(MagickRealType) QuantumRange*o2[(x%2)+2*(y%2)];
- else if (order == 3)
- threshold=(MagickRealType) QuantumRange*o3[(x%3)+3*(y%3)];
- else if (order == 4)
- threshold=(MagickRealType) QuantumRange*o4[(x%4)+4*(y%4)];
- q->red=q->green=q->blue=(Quantum) (intensity <=
- threshold ? 0 : QuantumRange);
- index=(IndexPacket) (intensity <= threshold ? 0 : 1);
- *indexes++=index;
- q->red=q->green=q->blue=image->colormap[(long) index].red;
- q++;
- }
+ intensity=(MagickRealType) PixelIntensityToQuantum(q);
+ if (order == 1)
+ {
+ if (intensity < lower_threshold)
+ threshold=lower_threshold;
+ else if (intensity > upper_threshold)
+ threshold=upper_threshold;
+ else
+ threshold=(MagickRealType) (QuantumRange*
+ GetPseudoRandomValue(random_info));
+ }
+ else if (order == 2)
+ threshold=(MagickRealType) QuantumRange*o2[(x%2)+2*(y%2)];
+ else if (order == 3)
+ threshold=(MagickRealType) QuantumRange*o3[(x%3)+3*(y%3)];
+ else if (order == 4)
+ threshold=(MagickRealType) QuantumRange*o4[(x%4)+4*(y%4)];
+ index=(IndexPacket) (intensity <= threshold ? 0 : 1);
+ SetIndexPixelComponent(indexes+x,index);
+ SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
+ SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
+ SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
+ q++;
+ }
}
if (LocaleCompare(channel,"opacity") == 0 ||
LocaleCompare(channel,"all") == 0 ||
LocaleCompare(channel,"matte") == 0)
{
if (image->matte != MagickFalse)
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (order == 1)
{
threshold=(MagickRealType) QuantumRange*o3[(x%3)+3*(y%3)];
else if (order == 4)
threshold=(MagickRealType) QuantumRange*o4[(x%4)+4*(y%4)]/1.7;
- q->opacity=(Quantum) ((MagickRealType) q->opacity <= threshold ?
- 0 : QuantumRange);
+ SetOpacityPixelComponent(q,(MagickRealType) q->opacity <=
+ threshold ? 0 : QuantumRange);
q++;
}
}
% %
% %
% %
+% R e c o l o r I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% RecolorImage() apply color transformation to an image. The method permits
+% saturation changes, hue rotation, luminance to alpha, and various other
+% effects. Although variable-sized transformation matrices can be used,
+% typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
+% (or RGBA with offsets). The matrix is similar to those used by Adobe Flash
+% except offsets are in column 6 rather than 5 (in support of CMYKA images)
+% and offsets are normalized (divide Flash offset by 255).
+%
+% The format of the RecolorImage method is:
+%
+% Image *RecolorImage(const Image *image,const size_t order,
+% const double *color_matrix,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o order: the number of columns and rows in the recolor matrix.
+%
+% o color_matrix: An array of double representing the recolor matrix.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *RecolorImage(const Image *image,const size_t order,
+ const double *color_matrix,ExceptionInfo *exception)
+{
+ KernelInfo
+ *kernel_info;
+
+ Image
+ *recolor_image;
+
+ kernel_info=AcquireKernelInfo("1");
+ if (kernel_info == (KernelInfo *) NULL)
+ return((Image *) NULL);
+ kernel_info->width=order;
+ kernel_info->height=order;
+ kernel_info->values=(double *) color_matrix;
+ recolor_image=ColorMatrixImage(image,kernel_info,exception);
+ kernel_info->values=(double *) NULL;
+ kernel_info=DestroyKernelInfo(kernel_info);
+ return(recolor_image);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% R e d u c e N o i s e I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ReduceNoiseImage() smooths the contours of an image while still preserving
+% edge information. The algorithm works by replacing each pixel with its
+% neighbor closest in value. A neighbor is defined by radius. Use a radius
+% of 0 and ReduceNoise() selects a suitable radius for you.
+%
+% The format of the ReduceNoiseImage method is:
+%
+% Image *ReduceNoiseImage(const Image *image,const double radius,
+% ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o radius: the radius of the pixel neighborhood.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *ReduceNoiseImage(const Image *image,const double radius,
+ ExceptionInfo *exception)
+{
+ Image
+ *reduce_image;
+
+ reduce_image=StatisticImage(image,NonpeakStatistic,(size_t) radius,(size_t)
+ radius,exception);
+ return(reduce_image);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% R e s e t I m a g e A t t r i b u t e I t e r a t o r %
% %
% %
% in conjunction with GetNextImageAttribute() to iterate over all the values
% associated with an image.
%
+% Deprecated, replace with:
+%
+% ResetImagePropertyIterator(image);
+%
% The format of the ResetImageAttributeIterator method is:
%
% ResetImageAttributeIterator(const ImageInfo *image)
% defined by the geometry parameters. A pointer to the pixels is returned
% if the pixels are transferred, otherwise a NULL is returned.
%
+% Deprecated, replace with:
+%
+% QueueCacheViewAuthenticPixels(cache_view,x,y,columns,rows,
+% GetCacheViewException(cache_view));
+%
% The format of the SetCacheViewPixels method is:
%
-% PixelPacket *SetCacheViewPixels(CacheView *cache_view,const long x,
-% const long y,const unsigned long columns,const unsigned long rows)
+% PixelPacket *SetCacheViewPixels(CacheView *cache_view,const ssize_t x,
+% const ssize_t y,const size_t columns,const size_t rows)
%
% A description of each parameter follows:
%
% pixels.
%
*/
-MagickExport PixelPacket *SetCacheViewPixels(CacheView *cache_view,const long x,
- const long y,const unsigned long columns,const unsigned long rows)
+MagickExport PixelPacket *SetCacheViewPixels(CacheView *cache_view,const ssize_t x,
+ const ssize_t y,const size_t columns,const size_t rows)
{
PixelPacket
*pixels;
% cache.
%
*/
-MagickExport void SetCacheThreshold(const unsigned long size)
+MagickExport void SetCacheThreshold(const size_t size)
{
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.1");
(void) SetMagickResourceLimit(MemoryResource,size*1024*1024);
*/
MagickExport void SetImage(Image *image,const Quantum opacity)
{
- long
- y;
-
PixelPacket
background_color;
+ ssize_t
+ y;
+
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v6.2.0");
assert(image != (Image *) NULL);
if (image->debug != MagickFalse)
/*
Set colormapped or CMYK image.
*/
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
- *__restrict indexes;
+ *restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
*q++=background_color;
indexes=GetAuthenticIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
indexes[x]=(IndexPacket) 0;
if (SyncAuthenticPixels(image,&image->exception) == MagickFalse)
break;
/*
Set DirectClass image.
*/
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=QueueAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
*q++=background_color;
if (SyncAuthenticPixels(image,&image->exception) == MagickFalse)
break;
% attribute value. If it is not found in the list, the attribute name
% and value is added to the list.
%
+% Deprecated, replace with:
+%
+% SetImageProperty(image,key,value);
+%
% The format of the SetImageAttribute method is:
%
% MagickBooleanType SetImageAttribute(Image *image,const char *key,
% The format of the SetImageList method is:
%
% unsigned int SetImageList(Image *images,const Image *image,
-% const long offset,ExceptionInfo *exception)
+% const ssize_t offset,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
*/
MagickExport unsigned int SetImageList(Image **images,const Image *image,
- const long offset,ExceptionInfo *exception)
+ const ssize_t offset,ExceptionInfo *exception)
{
Image
*clone;
- register long
+ register ssize_t
i;
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.5.2");
% array has been updated, the changes must be saved back to the underlying
% image using SyncAuthenticPixels() or they may be lost.
%
+% Deprecated, replace with:
+%
+% QueueAuthenticPixels(image,x,y,columns,rows,&image->exception);
+%
% The format of the SetImagePixels() method is:
%
-% PixelPacket *SetImagePixels(Image *image,const long x,const long y,
-% const unsigned long columns,const unsigned long rows)
+% PixelPacket *SetImagePixels(Image *image,const ssize_t x,const ssize_t y,
+% const size_t columns,const size_t rows)
%
% A description of each parameter follows:
%
% pixels.
%
*/
-MagickExport PixelPacket *SetImagePixels(Image *image,const long x,const long y,
- const unsigned long columns,const unsigned long rows)
+MagickExport PixelPacket *SetImagePixels(Image *image,const ssize_t x,const ssize_t y,
+ const size_t columns,const size_t rows)
{
return(QueueAuthenticPixels(image,x,y,columns,rows,&image->exception));
}
%
% The format of the SetMagickRegistry method is:
%
-% long SetMagickRegistry(const RegistryType type,const void *blob,
+% ssize_t SetMagickRegistry(const RegistryType type,const void *blob,
% const size_t length,ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport long SetMagickRegistry(const RegistryType type,const void *blob,
+MagickExport ssize_t SetMagickRegistry(const RegistryType type,const void *blob,
const size_t magick_unused(length),ExceptionInfo *exception)
{
char
MagickBooleanType
status;
- static long
+ static ssize_t
id = 0;
- (void) FormatMagickString(key,MaxTextExtent,"%ld\n",id);
+ (void) FormatMagickString(key,MaxTextExtent,"%.20g\n",(double) id);
status=SetImageRegistry(type,key,blob,exception);
if (status == MagickFalse)
return(-1);
%
% ShiftImageList() removes an image from the beginning of the list.
%
+% Deprecated, replace with:
+%
+% RemoveFirstImageFromList(images);
+%
% The format of the ShiftImageList method is:
%
% Image *ShiftImageList(Image **images)
%
% SizeBlob() returns the current length of the image file or blob.
%
+% Deprecated, replace with:
+%
+% GetBlobSize(image);
+%
% The format of the SizeBlob method is:
%
% off_t SizeBlob(Image *image)
%
% The format of the SpliceImageList method is:
%
-% Image *SpliceImageList(Image *images,const long offset,
-% const unsigned long length,const Image *splices,
+% Image *SpliceImageList(Image *images,const ssize_t offset,
+% const size_t length,const Image *splices,
% ExceptionInfo *exception)
%
% A description of each parameter follows:
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *SpliceImageList(Image *images,const long offset,
- const unsigned long length,const Image *splices,ExceptionInfo *exception)
+MagickExport Image *SpliceImageList(Image *images,const ssize_t offset,
+ const size_t length,const Image *splices,ExceptionInfo *exception)
{
Image
*clone;
- register long
+ register ssize_t
i;
if (images->debug != MagickFalse)
% cache. It returns MagickTrue if the pixel region is synced, otherwise
% MagickFalse.
%
+% Deprecated, replace with:
+%
+% SyncCacheViewAuthenticPixels(cache_view,GetCacheViewException(cache_view));
+%
% The format of the SyncCacheView method is:
%
% MagickBooleanType SyncCacheView(CacheView *cache_view)
% or disk cache. It returns MagickTrue if the pixel region is flushed,
% otherwise MagickFalse.
%
+% Deprecated, replace with:
+%
+% SyncCacheViewAuthenticPixels(cache_view,GetCacheViewException(cache_view));
+%
% The format of the SyncCacheViewPixels method is:
%
% MagickBooleanType SyncCacheViewPixels(CacheView *cache_view)
% The method returns MagickTrue if the pixel region is synced, otherwise
% MagickFalse.
%
+% Deprecated, replace with:
+%
+% SyncAuthenticPixels(image,&image->exception);
+%
% The format of the SyncImagePixels() method is:
%
% MagickBooleanType SyncImagePixels(Image *image)
IndexPacket
index;
- long
+ ssize_t
y;
/*
if (!AcquireImageColormap(image,2))
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
"UnableToThresholdImage");
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
- *__restrict indexes;
+ *restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- index=(IndexPacket) ((MagickRealType)
- PixelIntensityToQuantum(q) <= threshold ? 0 : 1);
- indexes[x]=index;
- q->red=image->colormap[(long) index].red;
- q->green=image->colormap[(long) index].green;
- q->blue=image->colormap[(long) index].blue;
+ index=(IndexPacket) ((MagickRealType) PixelIntensityToQuantum(q) <=
+ threshold ? 0 : 1);
+ SetIndexPixelComponent(indexes+x,index);
+ SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
+ SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
+ SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
q++;
}
if (!SyncAuthenticPixels(image,&image->exception))
IndexPacket
index;
- long
+ ssize_t
y;
unsigned int
if (pixel.red == 0)
(void) GetImageDynamicThreshold(image,2.0,2.0,&pixel,&image->exception);
}
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
register IndexPacket
- *__restrict indexes;
+ *restrict indexes;
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
break;
indexes=GetAuthenticIndexQueue(image);
if (IsMagickGray(&pixel) != MagickFalse)
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
index=(IndexPacket) ((MagickRealType)
PixelIntensityToQuantum(q) <= pixel.red ? 0 : 1);
- indexes[x]=index;
- q->red=image->colormap[(long) index].red;
- q->green=image->colormap[(long) index].green;
- q->blue=image->colormap[(long) index].blue;
+ SetIndexPixelComponent(indexes+x,index);
+ SetRedPixelComponent(q,image->colormap[(ssize_t) index].red);
+ SetGreenPixelComponent(q,image->colormap[(ssize_t) index].green);
+ SetBluePixelComponent(q,image->colormap[(ssize_t) index].blue);
q++;
}
else
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
- q->red=(Quantum) ((MagickRealType)
- q->red <= pixel.red ? 0 : QuantumRange);
- q->green=(Quantum) ((MagickRealType)
- q->green <= pixel.green ? 0 : QuantumRange);
- q->blue=(Quantum) ((MagickRealType)
- q->blue <= pixel.blue ? 0 : QuantumRange);
- q->opacity=(Quantum) ((MagickRealType)
- q->opacity <= pixel.opacity ? 0 : QuantumRange);
+ SetRedPixelComponent(q,q->red <= pixel.red ? 0 : QuantumRange);
+ SetGreenPixelComponent(q,q->green <= pixel.green ? 0 : QuantumRange);
+ SetBluePixelComponent(q,q->blue <= pixel.blue ? 0 : QuantumRange);
+ SetOpacityPixelComponent(q,q->opacity <= pixel.opacity ? 0 :
+ QuantumRange);
q++;
}
if (!SyncAuthenticPixels(image,&image->exception))
% weights are rescaled to normalize the range of the transformed values to
% be [0..QuantumRange].
%
+% Deprecated, replace with:
+%
+% TransformImageColorspace(image,colorspace);
+%
% The format of the TransformColorspace method is:
%
% unsigned int (void) TransformColorspace(Image *image,
% TranslateText() replaces any embedded formatting characters with the
% appropriate image attribute and returns the translated text.
%
+% Deprecated, replace with:
+%
+% InterpretImageProperties(image_info,image,embed_text);
+%
% The format of the TranslateText method is:
%
% char *TranslateText(const ImageInfo *image_info,Image *image,
{
#define TransparentImageTag "Transparent/Image"
- long
- y;
-
MagickBooleanType
proceed;
+ ssize_t
+ y;
+
/*
Make image color transparent.
*/
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->matte == MagickFalse)
(void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
- for (y=0; y < (long) image->rows; y++)
+ for (y=0; y < (ssize_t) image->rows; y++)
{
- register long
+ register ssize_t
x;
register PixelPacket
- *__restrict q;
+ *restrict q;
q=GetAuthenticPixels(image,0,y,image->columns,1,&image->exception);
if (q == (PixelPacket *) NULL)
break;
- for (x=0; x < (long) image->columns; x++)
+ for (x=0; x < (ssize_t) image->columns; x++)
{
if (IsColorSimilar(image,q,&target) != MagickFalse)
q->opacity=opacity;
}
if (SyncAuthenticPixels(image,&image->exception) == MagickFalse)
break;
- proceed=SetImageProgress(image,TransparentImageTag,y,image->rows);
+ proceed=SetImageProgress(image,TransparentImageTag,(MagickOffsetType) y,
+ image->rows);
if (proceed == MagickFalse)
break;
}
%
% UnshiftImageList() adds the image to the beginning of the list.
%
+% Deprecated, replace with:
+%
+% PrependImageToList(images,CloneImageList(image,exception));
+%
% The format of the UnshiftImageList method is:
%
% unsigned int UnshiftImageList(Image *images,const Image *image,
% not range from 0 to the number of colors in the colormap an exception
% issued and 0 is returned.
%
+% Deprecated, replace with:
+%
+% ConstrainColormapIndex(image,index);
+%
% The format of the ValidateColormapIndex method is:
%
% IndexPacket ValidateColormapIndex(Image *image,const unsigned int index)
% o index: This integer is the colormap index.
%
*/
-
MagickExport IndexPacket ValidateColormapIndex(Image *image,
- const unsigned long index)
+ const size_t index)
{
if (image->debug != MagickFalse)
(void) LogMagickEvent(DeprecateEvent,GetMagickModule(),"last use: v5.4.4");
return(ConstrainColormapIndex(image,index));
}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% Z o o m I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% ZoomImage() creates a new image that is a scaled size of an existing one.
+% It allocates the memory necessary for the new Image structure and returns a
+% pointer to the new image. The Point filter gives fast pixel replication,
+% Triangle is equivalent to bi-linear interpolation, and Mitchel giver slower,
+% very high-quality results. See Graphic Gems III for details on this
+% algorithm.
+%
+% The filter member of the Image structure specifies which image filter to
+% use. Blur specifies the blur factor where > 1 is blurry, < 1 is sharp.
+%
+% The format of the ZoomImage method is:
+%
+% Image *ZoomImage(const Image *image,const size_t columns,
+% const size_t rows,ExceptionInfo *exception)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o columns: An integer that specifies the number of columns in the zoom
+% image.
+%
+% o rows: An integer that specifies the number of rows in the scaled
+% image.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+MagickExport Image *ZoomImage(const Image *image,const size_t columns,
+ const size_t rows,ExceptionInfo *exception)
+{
+ Image
+ *zoom_image;
+
+ assert(image != (const Image *) NULL);
+ assert(image->signature == MagickSignature);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ zoom_image=ResizeImage(image,columns,rows,image->filter,image->blur,
+ exception);
+ return(zoom_image);
+}
#endif