*/
struct _ImageView
{
- ExceptionInfo
- *exception;
+ char
+ *description;
+
+ RectangleInfo
+ extent;
Image
*image;
CacheView
*view;
- RectangleInfo
- region;
-
size_t
number_threads;
+ ExceptionInfo
+ *exception;
+
MagickBooleanType
debug;
if (clone_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
- clone_view->exception=AcquireExceptionInfo();
- InheritException(clone_view->exception,image_view->exception);
+ clone_view->description=ConstantString(image_view->description);
+ clone_view->extent=image_view->extent;
clone_view->view=CloneCacheView(image_view->view);
- clone_view->region=image_view->region;
clone_view->number_threads=image_view->number_threads;
+ clone_view->exception=AcquireExceptionInfo();
+ InheritException(clone_view->exception,image_view->exception);
clone_view->debug=image_view->debug;
clone_view->signature=MagickSignature;
return(clone_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);
%
% 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 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
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;
}
% %
% %
% %
-% 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 %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetImageViewHeight() returns the image view height.
+% GetImageViewExtent() returns the image view extent.
%
-% The format of the GetImageViewHeight method is:
+% The format of the GetImageViewExtent method is:
%
-% size_t GetImageViewHeight(const ImageView *image_view)
+% RectangleInfo GetImageViewExtent(const ImageView *image_view)
%
% A description of each parameter follows:
%
% o image_view: the image view.
%
*/
-MagickExport size_t GetImageViewHeight(const ImageView *image_view)
+MagickExport RectangleInfo GetImageViewExtent(const ImageView *image_view)
{
assert(image_view != (ImageView *) NULL);
assert(image_view->signature == MagickSignature);
- return(image_view->region.height);
+ return(image_view->extent);
}
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% GetImageViewIterator() iterates over the image view in parallel and calls
-% your get method for each scanline of the view. The pixel region is
+% 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
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 i d t h %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% GetImageViewWidth() returns the image view width.
-%
-% The format of the GetImageViewWidth method is:
-%
-% size_t GetImageViewWidth(const ImageView *image_view)
-%
-% A description of each parameter follows:
-%
-% o image_view: the image view.
-%
-*/
-MagickExport size_t GetImageViewWidth(const ImageView *image_view)
-{
- assert(image_view != (ImageView *) NULL);
- assert(image_view->signature == MagickSignature);
- return(image_view->region.width);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
-% G e t I m a g e V i e w X %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% GetImageViewX() returns the image view x offset.
-%
-% The format of the GetImageViewX method is:
-%
-% ssize_t GetImageViewX(const ImageView *image_view)
-%
-% A description of each parameter follows:
-%
-% o image_view: the image view.
-%
-*/
-MagickExport ssize_t GetImageViewX(const ImageView *image_view)
-{
- assert(image_view != (ImageView *) NULL);
- assert(image_view->signature == MagickSignature);
- return(image_view->region.x);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
-% G e t I m a g e V i e w Y %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% GetImageViewY() returns the image view y offset.
-%
-% The format of the GetImageViewY method is:
-%
-% ssize_t GetImageViewY(const ImageView *image_view)
-%
-% A description of each parameter follows:
-%
-% o image_view: the image view.
-%
-*/
-MagickExport ssize_t GetImageViewY(const ImageView *image_view)
-{
- assert(image_view != (ImageView *) NULL);
- assert(image_view->signature == MagickSignature);
- return(image_view->region.y);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% I s I m a g e V i e w %
% %
% %
if (image_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(image_view,0,sizeof(*image_view));
- image_view->exception=AcquireExceptionInfo();
+ image_view->description=ConstantString("ImageView");
image_view->image=image;
image_view->view=AcquireCacheView(image_view->image);
- image_view->region.width=image->columns;
- image_view->region.height=image->rows;
+ 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);
%
% 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.
%
*/
if (image_view == (ImageView *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(image_view,0,sizeof(*image_view));
- image_view->exception=AcquireExceptionInfo();
+ image_view->description=ConstantString("ImageView");
image_view->view=AcquireCacheView(image_view->image);
image_view->image=image;
- image_view->region.width=width;
- image_view->region.height=height;
- image_view->region.x=x;
- image_view->region.y=y;
+ 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);
% %
% %
% %
+% 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
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% S e t I m a g e V i e w I t e r a t o r %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% SetImageViewIterator() iterates over the image view in parallel and calls
-% your set method for each scanline of the view. The pixel region is
+% 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
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 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 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
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 image view in parallel and calls
-% your update method for each scanline of the view. The pixel region is
+% 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
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 PixelPacket
*restrict pixels;
- register ssize_t
- id;
-
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));
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;
}