*/
struct _ImageView
{
- ExceptionInfo
- *exception;
+ char
+ *description;
+
+ RectangleInfo
+ extent;
Image
*image;
CacheView
*view;
- RectangleInfo
- region;
-
size_t
number_threads;
+ ExceptionInfo
+ *exception;
+
MagickBooleanType
debug;
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% CloneImageView() makes a copy of the specified pixel view.
+% CloneImageView() makes a copy of the specified image view.
%
% The format of the CloneImageView method is:
%
-% ImageView *CloneImageView(const ImageView *pixel_view)
+% ImageView *CloneImageView(const ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
+% o image_view: the image view.
%
*/
-MagickExport ImageView *CloneImageView(const ImageView *pixel_view)
+MagickExport ImageView *CloneImageView(const ImageView *image_view)
{
ImageView
*clone_view;
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
clone_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*clone_view));
if (clone_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
+ clone_view->description=ConstantString(image_view->description);
+ clone_view->extent=image_view->extent;
+ clone_view->view=CloneCacheView(image_view->view);
+ clone_view->number_threads=image_view->number_threads;
clone_view->exception=AcquireExceptionInfo();
- InheritException(clone_view->exception,pixel_view->exception);
- clone_view->view=CloneCacheView(pixel_view->view);
- clone_view->region=pixel_view->region;
- clone_view->number_threads=pixel_view->number_threads;
- clone_view->debug=pixel_view->debug;
+ InheritException(clone_view->exception,image_view->exception);
+ clone_view->debug=image_view->debug;
clone_view->signature=MagickSignature;
return(clone_view);
}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% DestroyImageView() deallocates memory associated with a pixel view.
+% DestroyImageView() deallocates memory associated with a image view.
%
% The format of the DestroyImageView method is:
%
-% ImageView *DestroyImageView(ImageView *pixel_view,
-% const size_t number_wands,const size_t number_threads)
+% ImageView *DestroyImageView(ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
-%
-% o number_wand: the number of pixel wands.
-%
-% o number_threads: number of threads.
+% o image_view: the image view.
%
*/
-MagickExport ImageView *DestroyImageView(ImageView *pixel_view)
+MagickExport ImageView *DestroyImageView(ImageView *image_view)
{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- pixel_view->view=DestroyCacheView(pixel_view->view);
- pixel_view->exception=DestroyExceptionInfo(pixel_view->exception);
- pixel_view->signature=(~MagickSignature);
- pixel_view=(ImageView *) RelinquishMagickMemory(pixel_view);
- return(pixel_view);
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ if (image_view->description != (char *) NULL)
+ image_view->description=DestroyString(image_view->description);
+ image_view->view=DestroyCacheView(image_view->view);
+ image_view->exception=DestroyExceptionInfo(image_view->exception);
+ image_view->signature=(~MagickSignature);
+ image_view=(ImageView *) RelinquishMagickMemory(image_view);
+ return(image_view);
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% DuplexTransferImageViewIterator() iterates over three pixel views in
+% DuplexTransferImageViewIterator() iterates over three image views in
% parallel and calls your transfer method for each scanline of the view. The
-% source and duplex pixel region is not confined to the image canvas-- that is
+% source and duplex pixel extent is not confined to the image canvas-- that is
% you can include negative offsets or widths or heights that exceed the image
-% dimension. However, the destination pixel view is confined to the image
+% dimension. However, the destination image view is confined to the image
% canvas-- that is no negative offsets or widths or heights that exceed the
% image dimension are permitted.
%
+% The callback signature is:
+%
+% MagickBooleanType DuplexTransferImageViewMethod(const ImageView *source,
+% const ImageView *duplex,ImageView *destination,const ssize_t y,
+% const int thread_id,void *context)
+%
% Use this pragma if the view is not single threaded:
%
% #pragma omp critical
%
% A description of each parameter follows:
%
-% o source: the source pixel view.
+% o source: the source image view.
%
-% o duplex: the duplex pixel view.
+% o duplex: the duplex image view.
%
-% o destination: the destination pixel view.
+% o destination: the destination image view.
%
% o transfer: the transfer callback method.
%
ImageView *source,ImageView *duplex,ImageView *destination,
DuplexTransferImageViewMethod transfer,void *context)
{
-#define DuplexTransferImageViewTag "ImageView/DuplexTransfer"
-
ExceptionInfo
*exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,1) shared(progress,status)
#endif
- for (y=source->region.y; y < (ssize_t) source->region.height; y++)
+ for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
+ int
+ id;
+
MagickBooleanType
sync;
register IndexPacket
*restrict destination_indexes;
- register ssize_t
- id;
-
register PixelPacket
*restrict destination_pixels;
if (status == MagickFalse)
continue;
id=GetOpenMPThreadId();
- pixels=GetCacheViewVirtualPixels(source->view,source->region.x,y,
- source->region.width,1,source->exception);
+ pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y,
+ source->extent.width,1,source->exception);
if (pixels == (const PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewVirtualIndexQueue(source->view);
- duplex_pixels=GetCacheViewVirtualPixels(duplex->view,duplex->region.x,y,
- duplex->region.width,1,duplex->exception);
+ duplex_pixels=GetCacheViewVirtualPixels(duplex->view,duplex->extent.x,y,
+ duplex->extent.width,1,duplex->exception);
if (duplex_pixels == (const PixelPacket *) NULL)
{
status=MagickFalse;
}
duplex_indexes=GetCacheViewVirtualIndexQueue(duplex->view);
destination_pixels=GetCacheViewAuthenticPixels(destination->view,
- destination->region.x,y,destination->region.width,1,exception);
+ destination->extent.x,y,destination->extent.width,1,exception);
if (destination_pixels == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
destination_indexes=GetCacheViewAuthenticIndexQueue(destination->view);
- if (transfer(source,duplex,destination,context) == MagickFalse)
+ if (transfer(source,duplex,destination,y,id,context) == MagickFalse)
status=MagickFalse;
sync=SyncCacheViewAuthenticPixels(destination->view,exception);
if (sync == MagickFalse)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_DuplexTransferImageViewIterator)
#endif
- proceed=SetImageProgress(source_image,DuplexTransferImageViewTag,
- progress++,source->region.height);
+ proceed=SetImageProgress(source_image,source->description,progress++,
+ source->extent.height);
if (proceed == MagickFalse)
status=MagickFalse;
}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetImageViewPixels() returns the pixel view authentic indexes.
+% GetImageViewAuthenticIndexes() returns the image view authentic indexes.
%
% The format of the GetImageViewAuthenticPixels method is:
%
-% IndexPacket *GetImageViewAuthenticIndexes(const ImageView *pixel_view)
+% IndexPacket *GetImageViewAuthenticIndexes(const ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
+% o image_view: the image view.
%
*/
MagickExport IndexPacket *GetImageViewAuthenticIndexes(
- const ImageView *pixel_view)
+ const ImageView *image_view)
{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(GetCacheViewAuthenticIndexQueue(pixel_view->view));
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ return(GetCacheViewAuthenticIndexQueue(image_view->view));
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetImageViewPixels() returns the pixel view authentic pixels.
+% GetImageViewAuthenticPixels() returns the image view authentic pixels.
%
% The format of the GetImageViewAuthenticPixels method is:
%
-% PixelPacket *GetImageViewAuthenticPixels(const ImageView *pixel_view)
+% PixelPacket *GetImageViewAuthenticPixels(const ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
+% o image_view: the image view.
%
*/
MagickExport PixelPacket *GetImageViewAuthenticPixels(
- const ImageView *pixel_view)
+ const ImageView *image_view)
{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(GetCacheViewAuthenticPixelQueue(pixel_view->view));
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ return(GetCacheViewAuthenticPixelQueue(image_view->view));
}
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetImageViewException() returns the severity, reason, and description of any
-% error that occurs when utilizing a pixel view.
+% error that occurs when utilizing a image view.
%
% The format of the GetImageViewException method is:
%
-% char *GetImageViewException(const PixelImage *pixel_view,
+% char *GetImageViewException(const PixelImage *image_view,
% ExceptionType *severity)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel pixel_view.
+% o image_view: the pixel image_view.
%
% o severity: the severity of the error is returned here.
%
*/
-MagickExport char *GetImageViewException(const ImageView *pixel_view,
+MagickExport char *GetImageViewException(const ImageView *image_view,
ExceptionType *severity)
{
char
*description;
- assert(pixel_view != (const ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
+ assert(image_view != (const ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
assert(severity != (ExceptionType *) NULL);
- *severity=pixel_view->exception->severity;
+ *severity=image_view->exception->severity;
description=(char *) AcquireQuantumMemory(2UL*MaxTextExtent,
sizeof(*description));
if (description == (char *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
*description='\0';
- if (pixel_view->exception->reason != (char *) NULL)
+ if (image_view->exception->reason != (char *) NULL)
(void) CopyMagickString(description,GetLocaleExceptionMessage(
- pixel_view->exception->severity,pixel_view->exception->reason),
+ image_view->exception->severity,image_view->exception->reason),
MaxTextExtent);
- if (pixel_view->exception->description != (char *) NULL)
+ if (image_view->exception->description != (char *) NULL)
{
(void) ConcatenateMagickString(description," (",MaxTextExtent);
(void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
- pixel_view->exception->severity,pixel_view->exception->description),
+ image_view->exception->severity,image_view->exception->description),
MaxTextExtent);
(void) ConcatenateMagickString(description,")",MaxTextExtent);
}
% %
% %
% %
-% G e t I m a g e V i e w H e i g h t %
+% G e t I m a g e V i e w E x t e n t %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% GetImageViewExtent() returns the image view extent.
+%
+% The format of the GetImageViewExtent method is:
+%
+% RectangleInfo GetImageViewExtent(const ImageView *image_view)
+%
+% A description of each parameter follows:
+%
+% o image_view: the image view.
+%
+*/
+MagickExport RectangleInfo GetImageViewExtent(const ImageView *image_view)
+{
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ return(image_view->extent);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% G e t I m a g e V i e w I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetImageViewHeight() returns the pixel view height.
+% GetImageViewImage() returns the image associated with the image view.
%
-% The format of the GetImageViewHeight method is:
+% The format of the GetImageViewImage method is:
%
-% size_t GetImageViewHeight(const ImageView *pixel_view)
+% MagickCore *GetImageViewImage(const ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
+% o image_view: the image view.
%
*/
-MagickExport size_t GetImageViewHeight(const ImageView *pixel_view)
+MagickExport Image *GetImageViewImage(const ImageView *image_view)
{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(pixel_view->region.height);
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ return(image_view->image);
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetImageViewIterator() iterates over the pixel view in parallel and calls
-% your get method for each scanline of the view. The pixel region is
+% GetImageViewIterator() iterates over the image view in parallel and calls
+% your get method for each scanline of the view. The pixel extent is
% not confined to the image canvas-- that is you can include negative offsets
% or widths or heights that exceed the image dimension. Any updates to
% the pixels in your callback are ignored.
%
+% The callback signature is:
+%
+% MagickBooleanType GetImageViewMethod(const ImageView *source,
+% const ssize_t y,const int thread_id,void *context)
+%
% Use this pragma if the view is not single threaded:
%
% #pragma omp critical
%
% A description of each parameter follows:
%
-% o source: the source pixel view.
+% o source: the source image view.
%
% o get: the get callback method.
%
MagickExport MagickBooleanType GetImageViewIterator(ImageView *source,
GetImageViewMethod get,void *context)
{
-#define GetImageViewTag "ImageView/Get"
-
Image
*source_image;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,1) shared(progress,status)
#endif
- for (y=source->region.y; y < (ssize_t) source->region.height; y++)
+ for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
+ int
+ id;
+
register const IndexPacket
*indexes;
register const PixelPacket
*pixels;
- register ssize_t
- id;
-
if (status == MagickFalse)
continue;
id=GetOpenMPThreadId();
- pixels=GetCacheViewVirtualPixels(source->view,source->region.x,y,
- source->region.width,1,source->exception);
+ pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y,
+ source->extent.width,1,source->exception);
if (pixels == (const PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
indexes=GetCacheViewVirtualIndexQueue(source->view);
- if (get(source,context) == MagickFalse)
+ if (get(source,y,id,context) == MagickFalse)
status=MagickFalse;
if (source_image->progress_monitor != (MagickProgressMonitor) NULL)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_GetImageViewIterator)
#endif
- proceed=SetImageProgress(source_image,GetImageViewTag,progress++,
- source->region.height);
+ proceed=SetImageProgress(source_image,source->description,progress++,
+ source->extent.height);
if (proceed == MagickFalse)
status=MagickFalse;
}
% %
% %
% %
-% G e t I m a g e V i e w W a n d %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% GetImageViewImage() returns the magick wand associated with the pixel view.
-%
-% The format of the GetImageViewImage method is:
-%
-% MagickCore *GetImageViewImage(const ImageView *pixel_view)
-%
-% A description of each parameter follows:
-%
-% o pixel_view: the pixel view.
-%
-*/
-MagickExport Image *GetImageViewImage(const ImageView *pixel_view)
-{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(pixel_view->image);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% G e t I m a g e V i e w V i r t u a l I n d e x e s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetImageViewPixels() returns the pixel view virtual indexes.
+% GetImageViewVirtualIndexes() returns the image view virtual indexes.
%
-% The format of the GetImageViewVirtualPixels method is:
+% The format of the GetImageViewVirtualIndexes method is:
%
% const IndexPacket *GetImageViewVirtualIndexes(
-% const ImageView *pixel_view)
+% const ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
+% o image_view: the image view.
%
*/
MagickExport const IndexPacket *GetImageViewVirtualIndexes(
- const ImageView *pixel_view)
+ const ImageView *image_view)
{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(GetCacheViewVirtualIndexQueue(pixel_view->view));
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ return(GetCacheViewVirtualIndexQueue(image_view->view));
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetImageViewPixels() returns the pixel view virtual pixels.
+% GetImageViewVirtualPixels() returns the image view virtual pixels.
%
% The format of the GetImageViewVirtualPixels method is:
%
-% const PixelPacket *GetImageViewVirtualPixels(const ImageView *pixel_view)
+% const PixelPacket *GetImageViewVirtualPixels(const ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
+% o image_view: the image view.
%
*/
MagickExport const PixelPacket *GetImageViewVirtualPixels(
- const ImageView *pixel_view)
-{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(GetCacheViewVirtualPixelQueue(pixel_view->view));
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
-% G e t I m a g e V i e w W i d t h %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% GetImageViewWidth() returns the pixel view width.
-%
-% The format of the GetImageViewWidth method is:
-%
-% size_t GetImageViewWidth(const ImageView *pixel_view)
-%
-% A description of each parameter follows:
-%
-% o pixel_view: the pixel view.
-%
-*/
-MagickExport size_t GetImageViewWidth(const ImageView *pixel_view)
-{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(pixel_view->region.width);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
-% G e t I m a g e V i e w X %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% GetImageViewX() returns the pixel view x offset.
-%
-% The format of the GetImageViewX method is:
-%
-% ssize_t GetImageViewX(const ImageView *pixel_view)
-%
-% A description of each parameter follows:
-%
-% o pixel_view: the pixel view.
-%
-*/
-MagickExport ssize_t GetImageViewX(const ImageView *pixel_view)
-{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(pixel_view->region.x);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
-% G e t I m a g e V i e w Y %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% GetImageViewY() returns the pixel view y offset.
-%
-% The format of the GetImageViewY method is:
-%
-% ssize_t GetImageViewY(const ImageView *pixel_view)
-%
-% A description of each parameter follows:
-%
-% o pixel_view: the pixel view.
-%
-*/
-MagickExport ssize_t GetImageViewY(const ImageView *pixel_view)
+ const ImageView *image_view)
{
- assert(pixel_view != (ImageView *) NULL);
- assert(pixel_view->signature == MagickSignature);
- return(pixel_view->region.y);
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ return(GetCacheViewVirtualPixelQueue(image_view->view));
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% IsImageView() returns MagickTrue if the the parameter is verified as a pixel
-% view container.
+% IsImageView() returns MagickTrue if the the parameter is verified as a image
+% view object.
%
% The format of the IsImageView method is:
%
-% MagickBooleanType IsImageView(const ImageView *pixel_view)
+% MagickBooleanType IsImageView(const ImageView *image_view)
%
% A description of each parameter follows:
%
-% o pixel_view: the pixel view.
+% o image_view: the image view.
%
*/
-MagickExport MagickBooleanType IsImageView(const ImageView *pixel_view)
+MagickExport MagickBooleanType IsImageView(const ImageView *image_view)
{
- if (pixel_view == (const ImageView *) NULL)
+ if (image_view == (const ImageView *) NULL)
return(MagickFalse);
- if (pixel_view->signature != MagickSignature)
+ if (image_view->signature != MagickSignature)
return(MagickFalse);
return(MagickTrue);
}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% NewImageView() returns a pixel view required for all other methods in the
-% Pixel View API.
+% NewImageView() returns a image view required for all other methods in the
+% Image View API.
%
% The format of the NewImageView method is:
%
MagickExport ImageView *NewImageView(Image *image)
{
ImageView
- *pixel_view;
+ *image_view;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
- pixel_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*pixel_view));
- if (pixel_view == (ImageView *) NULL)
+ image_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*image_view));
+ if (image_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
- (void) ResetMagickMemory(pixel_view,0,sizeof(*pixel_view));
- pixel_view->exception=AcquireExceptionInfo();
- pixel_view->image=image;
- pixel_view->view=AcquireCacheView(pixel_view->image);
- pixel_view->region.width=image->columns;
- pixel_view->region.height=image->rows;
- pixel_view->number_threads=GetOpenMPMaximumThreads();
- pixel_view->debug=IsEventLogging();
- pixel_view->signature=MagickSignature;
- return(pixel_view);
+ (void) ResetMagickMemory(image_view,0,sizeof(*image_view));
+ image_view->description=ConstantString("ImageView");
+ image_view->image=image;
+ image_view->view=AcquireCacheView(image_view->image);
+ image_view->extent.width=image->columns;
+ image_view->extent.height=image->rows;
+ image_view->extent.x=0;
+ image_view->extent.y=0;
+ image_view->number_threads=GetOpenMPMaximumThreads();
+ image_view->exception=AcquireExceptionInfo();
+ image_view->debug=IsEventLogging();
+ image_view->signature=MagickSignature;
+ return(image_view);
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% NewImageViewRegion() returns a pixel view required for all other methods
-% in the Pixel View API.
+% NewImageViewRegion() returns a image view required for all other methods
+% in the Image View API.
%
% The format of the NewImageViewRegion method is:
%
%
% o wand: the magick wand.
%
-% o x,y,columns,rows: These values define the perimeter of a region of
+% o x,y,columns,rows: These values define the perimeter of a extent of
% pixel_wands view.
%
*/
const ssize_t y,const size_t width,const size_t height)
{
ImageView
- *pixel_view;
+ *image_view;
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
- pixel_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*pixel_view));
- if (pixel_view == (ImageView *) NULL)
+ image_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*image_view));
+ if (image_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
- (void) ResetMagickMemory(pixel_view,0,sizeof(*pixel_view));
- pixel_view->exception=AcquireExceptionInfo();
- pixel_view->view=AcquireCacheView(pixel_view->image);
- pixel_view->image=image;
- pixel_view->region.width=width;
- pixel_view->region.height=height;
- pixel_view->region.x=x;
- pixel_view->region.y=y;
- pixel_view->number_threads=GetOpenMPMaximumThreads();
- pixel_view->debug=IsEventLogging();
- pixel_view->signature=MagickSignature;
- return(pixel_view);
+ (void) ResetMagickMemory(image_view,0,sizeof(*image_view));
+ image_view->description=ConstantString("ImageView");
+ image_view->view=AcquireCacheView(image_view->image);
+ image_view->image=image;
+ image_view->extent.width=width;
+ image_view->extent.height=height;
+ image_view->extent.x=x;
+ image_view->extent.y=y;
+ image_view->number_threads=GetOpenMPMaximumThreads();
+ image_view->exception=AcquireExceptionInfo();
+ image_view->debug=IsEventLogging();
+ image_view->signature=MagickSignature;
+ return(image_view);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% S e t I m a g e V i e w D e s c r i p t i o n %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% SetImageViewDescription() associates a description with an image view.
+%
+% The format of the SetImageViewDescription method is:
+%
+% void SetImageViewDescription(ImageView *image_view,
+% const char *description)
+%
+% A description of each parameter follows:
+%
+% o image_view: the image view.
+%
+% o description: the image view description.
+%
+*/
+MagickExport void SetImageViewDescription(ImageView *image_view,
+ const char *description)
+{
+ assert(image_view != (ImageView *) NULL);
+ assert(image_view->signature == MagickSignature);
+ image_view->description=ConstantString(description);
}
\f
/*
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% SetImageViewIterator() iterates over the pixel view in parallel and calls
-% your set method for each scanline of the view. The pixel region is
+% SetImageViewIterator() iterates over the image view in parallel and calls
+% your set method for each scanline of the view. The pixel extent is
% confined to the image canvas-- that is no negative offsets or widths or
% heights that exceed the image dimension. The pixels are initiallly
% undefined and any settings you make in the callback method are automagically
% synced back to your image.
%
+% The callback signature is:
+%
+% MagickBooleanType SetImageViewMethod(ImageView *destination,
+% const ssize_t y,const int thread_id,void *context)
+%
% Use this pragma if the view is not single threaded:
%
% #pragma omp critical
%
% A description of each parameter follows:
%
-% o destination: the pixel view.
+% o destination: the image view.
%
% o set: the set callback method.
%
MagickExport MagickBooleanType SetImageViewIterator(ImageView *destination,
SetImageViewMethod set,void *context)
{
-#define SetImageViewTag "ImageView/Set"
-
ExceptionInfo
*exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,1) shared(progress,status)
#endif
- for (y=destination->region.y; y < (ssize_t) destination->region.height; y++)
+ for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++)
{
+ int
+ id;
+
MagickBooleanType
sync;
register IndexPacket
*restrict indexes;
- register ssize_t
- id;
-
register PixelPacket
*restrict pixels;
if (status == MagickFalse)
continue;
id=GetOpenMPThreadId();
- pixels=GetCacheViewAuthenticPixels(destination->view,destination->region.x,
- y,destination->region.width,1,exception);
+ pixels=GetCacheViewAuthenticPixels(destination->view,destination->extent.x,
+ y,destination->extent.width,1,exception);
if (pixels == (PixelPacket *) NULL)
{
InheritException(destination->exception,GetCacheViewException(
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(destination->view);
- if (set(destination,context) == MagickFalse)
+ if (set(destination,y,id,context) == MagickFalse)
status=MagickFalse;
sync=SyncCacheViewAuthenticPixels(destination->view,exception);
if (sync == MagickFalse)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_SetImageViewIterator)
#endif
- proceed=SetImageProgress(destination_image,SetImageViewTag,progress++,
- destination->region.height);
+ proceed=SetImageProgress(destination_image,destination->description,
+ progress++,destination->extent.height);
if (proceed == MagickFalse)
status=MagickFalse;
}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% TransferImageViewIterator() iterates over two pixel views in parallel and
+% TransferImageViewIterator() iterates over two image views in parallel and
% calls your transfer method for each scanline of the view. The source pixel
-% region is not confined to the image canvas-- that is you can include
+% extent is not confined to the image canvas-- that is you can include
% negative offsets or widths or heights that exceed the image dimension.
-% However, the destination pixel view is confined to the image canvas-- that
+% However, the destination image view is confined to the image canvas-- that
% is no negative offsets or widths or heights that exceed the image dimension
% are permitted.
%
+% The callback signature is:
+%
+% MagickBooleanType TransferImageViewMethod(const ImageView *source,
+% ImageView *destination,const ssize_t y,const int thread_id,
+% void *context)
+%
% Use this pragma if the view is not single threaded:
%
% #pragma omp critical
%
% A description of each parameter follows:
%
-% o source: the source pixel view.
+% o source: the source image view.
%
-% o destination: the destination pixel view.
+% o destination: the destination image view.
%
% o transfer: the transfer callback method.
%
MagickExport MagickBooleanType TransferImageViewIterator(ImageView *source,
ImageView *destination,TransferImageViewMethod transfer,void *context)
{
-#define TransferImageViewTag "ImageView/Transfer"
-
ExceptionInfo
*exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,1) shared(progress,status)
#endif
- for (y=source->region.y; y < (ssize_t) source->region.height; y++)
+ for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
+ int
+ id;
+
MagickBooleanType
sync;
register IndexPacket
*restrict destination_indexes;
- register ssize_t
- id;
-
register PixelPacket
*restrict destination_pixels;
if (status == MagickFalse)
continue;
id=GetOpenMPThreadId();
- pixels=GetCacheViewVirtualPixels(source->view,source->region.x,y,
- source->region.width,1,source->exception);
+ pixels=GetCacheViewVirtualPixels(source->view,source->extent.x,y,
+ source->extent.width,1,source->exception);
if (pixels == (const PixelPacket *) NULL)
{
status=MagickFalse;
}
indexes=GetCacheViewVirtualIndexQueue(source->view);
destination_pixels=GetCacheViewAuthenticPixels(destination->view,
- destination->region.x,y,destination->region.width,1,exception);
+ destination->extent.x,y,destination->extent.width,1,exception);
if (destination_pixels == (PixelPacket *) NULL)
{
status=MagickFalse;
continue;
}
destination_indexes=GetCacheViewAuthenticIndexQueue(destination->view);
- if (transfer(source,destination,context) == MagickFalse)
+ if (transfer(source,destination,y,id,context) == MagickFalse)
status=MagickFalse;
sync=SyncCacheViewAuthenticPixels(destination->view,exception);
if (sync == MagickFalse)
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_TransferImageViewIterator)
#endif
- proceed=SetImageProgress(source_image,TransferImageViewTag,progress++,
- source->region.height);
+ proceed=SetImageProgress(source_image,source->description,progress++,
+ source->extent.height);
if (proceed == MagickFalse)
status=MagickFalse;
}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% UpdateImageViewIterator() iterates over the pixel view in parallel and calls
-% your update method for each scanline of the view. The pixel region is
+% UpdateImageViewIterator() iterates over the image view in parallel and calls
+% your update method for each scanline of the view. The pixel extent is
% confined to the image canvas-- that is no negative offsets or widths or
% heights that exceed the image dimension are permitted. Updates to pixels
% in your callback are automagically synced back to the image.
%
+% The callback signature is:
+%
+% MagickBooleanType UpdateImageViewMethod(ImageView *source,
+% const ssize_t y,const int thread_id,void *context)
+%
% Use this pragma if the view is not single threaded:
%
% #pragma omp critical
%
% A description of each parameter follows:
%
-% o source: the source pixel view.
+% o source: the source image view.
%
% o update: the update callback method.
%
MagickExport MagickBooleanType UpdateImageViewIterator(ImageView *source,
UpdateImageViewMethod update,void *context)
{
-#define UpdateImageViewTag "ImageView/Update"
-
ExceptionInfo
*exception;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static,1) shared(progress,status)
#endif
- for (y=source->region.y; y < (ssize_t) source->region.height; y++)
+ for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
{
+ int
+ id;
+
register IndexPacket
*restrict indexes;
- register ssize_t
- id;
-
register PixelPacket
*restrict pixels;
if (status == MagickFalse)
continue;
id=GetOpenMPThreadId();
- pixels=GetCacheViewAuthenticPixels(source->view,source->region.x,y,
- source->region.width,1,exception);
+ pixels=GetCacheViewAuthenticPixels(source->view,source->extent.x,y,
+ source->extent.width,1,exception);
if (pixels == (PixelPacket *) NULL)
{
- InheritException(source->exception,GetCacheViewException(
- source->view));
+ InheritException(source->exception,GetCacheViewException(source->view));
status=MagickFalse;
continue;
}
indexes=GetCacheViewAuthenticIndexQueue(source->view);
- if (update(source,context) == MagickFalse)
+ if (update(source,y,id,context) == MagickFalse)
status=MagickFalse;
if (SyncCacheViewAuthenticPixels(source->view,exception) == MagickFalse)
{
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp critical (MagickCore_UpdateImageViewIterator)
#endif
- proceed=SetImageProgress(source_image,UpdateImageViewTag,progress++,
- source->region.height);
+ proceed=SetImageProgress(source_image,source->description,progress++,
+ source->extent.height);
if (proceed == MagickFalse)
status=MagickFalse;
}