From 7574809ed0aee75f8428bff14c595507c57e50dc Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 27 Jun 2010 01:10:29 +0000 Subject: [PATCH] --- wand/deprecate.c | 1400 ++++++++++++++++++++++++++++++++++++++++++++-- wand/deprecate.h | 51 +- 2 files changed, 1397 insertions(+), 54 deletions(-) diff --git a/wand/deprecate.c b/wand/deprecate.c index c17e594ac..581ba5756 100644 --- a/wand/deprecate.c +++ b/wand/deprecate.c @@ -44,10 +44,13 @@ #include "wand/MagickWand.h" #include "wand/magick-wand-private.h" #include "wand/wand.h" +#include "magick/monitor-private.h" +#include "magick/thread-private.h" /* Define declarations. */ +#define PixelViewId "PixelView" #define ThrowWandException(severity,tag,context) \ { \ (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \ @@ -55,6 +58,42 @@ return(MagickFalse); \ } +/* + Typedef declarations. +*/ +struct _PixelView +{ + size_t + id; + + char + name[MaxTextExtent]; + + ExceptionInfo + *exception; + + MagickWand + *wand; + + CacheView + *view; + + RectangleInfo + region; + + size_t + number_threads; + + PixelWand + ***pixel_wands; + + MagickBooleanType + debug; + + size_t + signature; +}; + #if !defined(MAGICKCORE_EXCLUDE_DEPRECATED) /* @@ -62,70 +101,765 @@ % % % % % % -% M a g i c k A v e r a g e I m a g e s % +% M a g i c k A v e r a g e I m a g e s % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% MagickAverageImages() average a set of images. +% +% The format of the MagickAverageImages method is: +% +% MagickWand *MagickAverageImages(MagickWand *wand) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +*/ + +static MagickWand *CloneMagickWandFromImages(const MagickWand *wand, + Image *images) +{ + MagickWand + *clone_wand; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + clone_wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*clone_wand)); + if (clone_wand == (MagickWand *) NULL) + ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", + images->filename); + (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand)); + clone_wand->id=AcquireWandId(); + (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%.20g", + MagickWandId,(double) clone_wand->id); + clone_wand->exception=AcquireExceptionInfo(); + InheritException(clone_wand->exception,wand->exception); + clone_wand->image_info=CloneImageInfo(wand->image_info); + clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info); + clone_wand->images=images; + clone_wand->debug=IsEventLogging(); + if (clone_wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name); + clone_wand->signature=WandSignature; + return(clone_wand); +} + +WandExport MagickWand *MagickAverageImages(MagickWand *wand) +{ + Image + *average_image; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == WandSignature); + if (wand->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); + if (wand->images == (Image *) NULL) + return((MagickWand *) NULL); + average_image=EvaluateImages(wand->images,MeanEvaluateOperator, + wand->exception); + if (average_image == (Image *) NULL) + return((MagickWand *) NULL); + return(CloneMagickWandFromImages(wand,average_image)); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% C l o n e P i x e l V i e w % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% ClonePixelView() makes a copy of the specified pixel view. +% +% The format of the ClonePixelView method is: +% +% PixelView *ClonePixelView(const PixelView *pixel_view) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel view. +% +*/ +WandExport PixelView *ClonePixelView(const PixelView *pixel_view) +{ + PixelView + *clone_view; + + register ssize_t + i; + + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + if (pixel_view->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",pixel_view->name); + clone_view=(PixelView *) AcquireAlignedMemory(1,sizeof(*clone_view)); + if (clone_view == (PixelView *) NULL) + ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", + pixel_view->name); + (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view)); + clone_view->id=AcquireWandId(); + (void) FormatMagickString(clone_view->name,MaxTextExtent,"%s-%.20g", + PixelViewId,(double) clone_view->id); + 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; + for (i=0; i < (ssize_t) pixel_view->number_threads; i++) + clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **) + pixel_view->pixel_wands[i],pixel_view->region.width); + clone_view->debug=pixel_view->debug; + if (clone_view->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_view->name); + clone_view->signature=WandSignature; + return(clone_view); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% D e s t r o y P i x e l V i e w % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DestroyPixelView() deallocates memory associated with a pixel view. +% +% The format of the DestroyPixelView method is: +% +% PixelView *DestroyPixelView(PixelView *pixel_view, +% const size_t number_wands,const size_t number_threads) +% +% 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. +% +*/ + +static PixelWand ***DestroyPixelsThreadSet(PixelWand ***pixel_wands, + const size_t number_wands,const size_t number_threads) +{ + register ssize_t + i; + + assert(pixel_wands != (PixelWand ***) NULL); + for (i=0; i < (ssize_t) number_threads; i++) + if (pixel_wands[i] != (PixelWand **) NULL) + pixel_wands[i]=DestroyPixelWands(pixel_wands[i],number_wands); + pixel_wands=(PixelWand ***) RelinquishAlignedMemory(pixel_wands); + return(pixel_wands); +} + +WandExport PixelView *DestroyPixelView(PixelView *pixel_view) +{ + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + pixel_view->pixel_wands=DestroyPixelsThreadSet(pixel_view->pixel_wands, + pixel_view->region.width,pixel_view->number_threads); + pixel_view->view=DestroyCacheView(pixel_view->view); + pixel_view->exception=DestroyExceptionInfo(pixel_view->exception); + pixel_view->signature=(~WandSignature); + RelinquishWandId(pixel_view->id); + pixel_view=(PixelView *) RelinquishMagickMemory(pixel_view); + return(pixel_view); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% D u p l e x T r a n s f e r P i x e l V i e w I t e r a t o r % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DuplexTransferPixelViewIterator() iterates over three pixel 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 +% 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 is no negative offsets or widths or heights that exceed the +% image dimension are permitted. +% +% Use this pragma: +% +% #pragma omp critical +% +% to define a section of code in your callback transfer method that must be +% executed by a single thread at a time. +% +% The format of the DuplexTransferPixelViewIterator method is: +% +% MagickBooleanType DuplexTransferPixelViewIterator(PixelView *source, +% PixelView *duplex,PixelView *destination, +% DuplexTransferPixelViewMethod transfer,void *context) +% +% A description of each parameter follows: +% +% o source: the source pixel view. +% +% o duplex: the duplex pixel view. +% +% o destination: the destination pixel view. +% +% o transfer: the transfer callback method. +% +% o context: the user defined context. +% +*/ +WandExport MagickBooleanType DuplexTransferPixelViewIterator( + PixelView *source,PixelView *duplex,PixelView *destination, + DuplexTransferPixelViewMethod transfer,void *context) +{ +#define DuplexTransferPixelViewTag "PixelView/DuplexTransfer" + + ExceptionInfo + *exception; + + Image + *destination_image, + *duplex_image, + *source_image; + + MagickBooleanType + status; + + MagickOffsetType + progress; + + ssize_t + y; + + assert(source != (PixelView *) NULL); + assert(source->signature == WandSignature); + if (transfer == (DuplexTransferPixelViewMethod) NULL) + return(MagickFalse); + source_image=source->wand->images; + duplex_image=duplex->wand->images; + destination_image=destination->wand->images; + if (SetImageStorageClass(destination_image,DirectClass) == MagickFalse) + return(MagickFalse); + status=MagickTrue; + progress=0; + exception=destination->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++) + { + MagickBooleanType + sync; + + register const IndexPacket + *restrict duplex_indexes, + *restrict indexes; + + register const PixelPacket + *restrict duplex_pixels, + *restrict pixels; + + register IndexPacket + *restrict destination_indexes; + + register ssize_t + id, + x; + + 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); + if (pixels == (const PixelPacket *) NULL) + { + status=MagickFalse; + continue; + } + indexes=GetCacheViewVirtualIndexQueue(source->view); + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetQuantumColor(source->pixel_wands[id][x],pixels+x); + if (source_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetBlackQuantum(source->pixel_wands[id][x],indexes[x]); + if (source_image->storage_class == PseudoClass) + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetIndex(source->pixel_wands[id][x],indexes[x]); + duplex_pixels=GetCacheViewVirtualPixels(duplex->view,duplex->region.x,y, + duplex->region.width,1,duplex->exception); + if (duplex_pixels == (const PixelPacket *) NULL) + { + status=MagickFalse; + continue; + } + duplex_indexes=GetCacheViewVirtualIndexQueue(duplex->view); + for (x=0; x < (ssize_t) duplex->region.width; x++) + PixelSetQuantumColor(duplex->pixel_wands[id][x],duplex_pixels+x); + if (duplex_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) duplex->region.width; x++) + PixelSetBlackQuantum(duplex->pixel_wands[id][x],duplex_indexes[x]); + if (duplex_image->storage_class == PseudoClass) + for (x=0; x < (ssize_t) duplex->region.width; x++) + PixelSetIndex(duplex->pixel_wands[id][x],duplex_indexes[x]); + destination_pixels=GetCacheViewAuthenticPixels(destination->view, + destination->region.x,y,destination->region.width,1,exception); + if (destination_pixels == (PixelPacket *) NULL) + { + status=MagickFalse; + continue; + } + destination_indexes=GetCacheViewAuthenticIndexQueue(destination->view); + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelSetQuantumColor(destination->pixel_wands[id][x], + destination_pixels+x); + if (destination_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelSetBlackQuantum(destination->pixel_wands[id][x], + destination_indexes[x]); + if (destination_image->storage_class == PseudoClass) + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelSetIndex(destination->pixel_wands[id][x],destination_indexes[x]); + if (transfer(source,duplex,destination,context) == MagickFalse) + status=MagickFalse; + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelGetQuantumColor(destination->pixel_wands[id][x], + destination_pixels+x); + if (destination_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) destination->region.width; x++) + destination_indexes[x]=PixelGetBlackQuantum( + destination->pixel_wands[id][x]); + sync=SyncCacheViewAuthenticPixels(destination->view,exception); + if (sync == MagickFalse) + { + InheritException(destination->exception,GetCacheViewException( + source->view)); + status=MagickFalse; + } + if (source_image->progress_monitor != (MagickProgressMonitor) NULL) + { + MagickBooleanType + proceed; + +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp critical (MagickWand_DuplexTransferPixelViewIterator) +#endif + proceed=SetImageProgress(source_image,DuplexTransferPixelViewTag, + progress++,source->region.height); + if (proceed == MagickFalse) + status=MagickFalse; + } + } + return(status); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w E x c e p t i o n % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewException() returns the severity, reason, and description of any +% error that occurs when utilizing a pixel view. +% +% The format of the GetPixelViewException method is: +% +% char *GetPixelViewException(const PixelWand *pixel_view, +% ExceptionType *severity) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel pixel_view. +% +% o severity: the severity of the error is returned here. +% +*/ +WandExport char *GetPixelViewException(const PixelView *pixel_view, + ExceptionType *severity) +{ + char + *description; + + assert(pixel_view != (const PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + if (pixel_view->debug != MagickFalse) + (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",pixel_view->name); + assert(severity != (ExceptionType *) NULL); + *severity=pixel_view->exception->severity; + description=(char *) AcquireQuantumMemory(2UL*MaxTextExtent, + sizeof(*description)); + if (description == (char *) NULL) + ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", + pixel_view->name); + *description='\0'; + if (pixel_view->exception->reason != (char *) NULL) + (void) CopyMagickString(description,GetLocaleExceptionMessage( + pixel_view->exception->severity,pixel_view->exception->reason), + MaxTextExtent); + if (pixel_view->exception->description != (char *) NULL) + { + (void) ConcatenateMagickString(description," (",MaxTextExtent); + (void) ConcatenateMagickString(description,GetLocaleExceptionMessage( + pixel_view->exception->severity,pixel_view->exception->description), + MaxTextExtent); + (void) ConcatenateMagickString(description,")",MaxTextExtent); + } + return(description); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w H e i g h t % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewHeight() returns the pixel view height. +% +% The format of the GetPixelViewHeight method is: +% +% size_t GetPixelViewHeight(const PixelView *pixel_view) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel view. +% +*/ +WandExport size_t GetPixelViewHeight(const PixelView *pixel_view) +{ + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + return(pixel_view->region.height); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w I t e r a t o r % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewIterator() iterates over the pixel view in parallel and calls +% your get method for each scanline of the view. The pixel region 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. +% +% Use this pragma: +% +% #pragma omp critical +% +% to define a section of code in your callback get method that must be +% executed by a single thread at a time. +% +% The format of the GetPixelViewIterator method is: +% +% MagickBooleanType GetPixelViewIterator(PixelView *source, +% GetPixelViewMethod get,void *context) +% +% A description of each parameter follows: +% +% o source: the source pixel view. +% +% o get: the get callback method. +% +% o context: the user defined context. +% +*/ +WandExport MagickBooleanType GetPixelViewIterator(PixelView *source, + GetPixelViewMethod get,void *context) +{ +#define GetPixelViewTag "PixelView/Get" + + Image + *source_image; + + MagickBooleanType + status; + + MagickOffsetType + progress; + + ssize_t + y; + + assert(source != (PixelView *) NULL); + assert(source->signature == WandSignature); + if (get == (GetPixelViewMethod) NULL) + return(MagickFalse); + source_image=source->wand->images; + status=MagickTrue; + progress=0; +#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++) + { + register const IndexPacket + *indexes; + + register const PixelPacket + *pixels; + + register ssize_t + id, + x; + + if (status == MagickFalse) + continue; + id=GetOpenMPThreadId(); + pixels=GetCacheViewVirtualPixels(source->view,source->region.x,y, + source->region.width,1,source->exception); + if (pixels == (const PixelPacket *) NULL) + { + status=MagickFalse; + continue; + } + indexes=GetCacheViewVirtualIndexQueue(source->view); + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetQuantumColor(source->pixel_wands[id][x],pixels+x); + if (source_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetBlackQuantum(source->pixel_wands[id][x],indexes[x]); + if (source_image->storage_class == PseudoClass) + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetIndex(source->pixel_wands[id][x],indexes[x]); + if (get(source,context) == MagickFalse) + status=MagickFalse; + if (source_image->progress_monitor != (MagickProgressMonitor) NULL) + { + MagickBooleanType + proceed; + +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp critical (MagickWand_GetPixelViewIterator) +#endif + proceed=SetImageProgress(source_image,GetPixelViewTag,progress++, + source->region.height); + if (proceed == MagickFalse) + status=MagickFalse; + } + } + return(status); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w P i x e l s % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewPixels() returns the pixel view pixel_wands. +% +% The format of the GetPixelViewPixels method is: +% +% PixelWand *GetPixelViewPixels(const PixelView *pixel_view) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel view. +% +*/ +WandExport PixelWand **GetPixelViewPixels(const PixelView *pixel_view) +{ + ssize_t + id; + + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + id=GetOpenMPThreadId(); + return(pixel_view->pixel_wands[id]); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w W a n d % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewWand() returns the magick wand associated with the pixel view. +% +% The format of the GetPixelViewWand method is: +% +% MagickWand *GetPixelViewWand(const PixelView *pixel_view) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel view. +% +*/ +WandExport MagickWand *GetPixelViewWand(const PixelView *pixel_view) +{ + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + return(pixel_view->wand); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w W i d t h % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewWidth() returns the pixel view width. +% +% The format of the GetPixelViewWidth method is: +% +% size_t GetPixelViewWidth(const PixelView *pixel_view) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel view. +% +*/ +WandExport size_t GetPixelViewWidth(const PixelView *pixel_view) +{ + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + return(pixel_view->region.width); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w X % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewX() returns the pixel view x offset. +% +% The format of the GetPixelViewX method is: +% +% ssize_t GetPixelViewX(const PixelView *pixel_view) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel view. +% +*/ +WandExport ssize_t GetPixelViewX(const PixelView *pixel_view) +{ + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + return(pixel_view->region.x); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% G e t P i x e l V i e w Y % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetPixelViewY() returns the pixel view y offset. +% +% The format of the GetPixelViewY method is: +% +% ssize_t GetPixelViewY(const PixelView *pixel_view) +% +% A description of each parameter follows: +% +% o pixel_view: the pixel view. +% +*/ +WandExport ssize_t GetPixelViewY(const PixelView *pixel_view) +{ + assert(pixel_view != (PixelView *) NULL); + assert(pixel_view->signature == WandSignature); + return(pixel_view->region.y); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% I s P i x e l V i e w % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% MagickAverageImages() average a set of images. +% IsPixelView() returns MagickTrue if the the parameter is verified as a pixel +% view container. % -% The format of the MagickAverageImages method is: +% The format of the IsPixelView method is: % -% MagickWand *MagickAverageImages(MagickWand *wand) +% MagickBooleanType IsPixelView(const PixelView *pixel_view) % % A description of each parameter follows: % -% o wand: the magick wand. +% o pixel_view: the pixel view. % */ - -static MagickWand *CloneMagickWandFromImages(const MagickWand *wand, - Image *images) -{ - MagickWand - *clone_wand; - - assert(wand != (MagickWand *) NULL); - assert(wand->signature == WandSignature); - if (wand->debug != MagickFalse) - (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - clone_wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*clone_wand)); - if (clone_wand == (MagickWand *) NULL) - ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", - images->filename); - (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand)); - clone_wand->id=AcquireWandId(); - (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%.20g", - MagickWandId,(double) clone_wand->id); - clone_wand->exception=AcquireExceptionInfo(); - InheritException(clone_wand->exception,wand->exception); - clone_wand->image_info=CloneImageInfo(wand->image_info); - clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info); - clone_wand->images=images; - clone_wand->debug=IsEventLogging(); - if (clone_wand->debug != MagickFalse) - (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name); - clone_wand->signature=WandSignature; - return(clone_wand); -} - -WandExport MagickWand *MagickAverageImages(MagickWand *wand) +WandExport MagickBooleanType IsPixelView(const PixelView *pixel_view) { - Image - *average_image; + size_t + length; - assert(wand != (MagickWand *) NULL); - assert(wand->signature == WandSignature); - if (wand->debug != MagickFalse) - (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - if (wand->images == (Image *) NULL) - return((MagickWand *) NULL); - average_image=EvaluateImages(wand->images,MeanEvaluateOperator, - wand->exception); - if (average_image == (Image *) NULL) - return((MagickWand *) NULL); - return(CloneMagickWandFromImages(wand,average_image)); + if (pixel_view == (const PixelView *) NULL) + return(MagickFalse); + if (pixel_view->signature != WandSignature) + return(MagickFalse); + length=strlen(PixelViewId); + if (LocaleNCompare(pixel_view->name,PixelViewId,length) != 0) + return(MagickFalse); + return(MagickTrue); } /* @@ -1569,6 +2303,145 @@ WandExport unsigned char *MagickWriteImageBlob(MagickWand *wand,size_t *length) % % % % % % +% N e w P i x e l V i e w % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% NewPixelView() returns a pixel view required for all other methods in the +% Pixel View API. +% +% The format of the NewPixelView method is: +% +% PixelView *NewPixelView(MagickWand *wand) +% +% A description of each parameter follows: +% +% o wand: the wand. +% +*/ + +static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands, + const size_t number_threads) +{ + PixelWand + ***pixel_wands; + + register ssize_t + i; + + pixel_wands=(PixelWand ***) AcquireAlignedMemory(number_threads, + sizeof(*pixel_wands)); + if (pixel_wands == (PixelWand ***) NULL) + return((PixelWand ***) NULL); + (void) ResetMagickMemory(pixel_wands,0,number_threads*sizeof(*pixel_wands)); + for (i=0; i < (ssize_t) number_threads; i++) + { + pixel_wands[i]=NewPixelWands(number_wands); + if (pixel_wands[i] == (PixelWand **) NULL) + return(DestroyPixelsThreadSet(pixel_wands,number_wands,number_threads)); + } + return(pixel_wands); +} + +WandExport PixelView *NewPixelView(MagickWand *wand) +{ + PixelView + *pixel_view; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == MagickSignature); + pixel_view=(PixelView *) AcquireAlignedMemory(1,sizeof(*pixel_view)); + if (pixel_view == (PixelView *) NULL) + ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", + GetExceptionMessage(errno)); + (void) ResetMagickMemory(pixel_view,0,sizeof(*pixel_view)); + pixel_view->id=AcquireWandId(); + (void) FormatMagickString(pixel_view->name,MaxTextExtent,"%s-%.20g", + PixelViewId,(double) pixel_view->id); + pixel_view->exception=AcquireExceptionInfo(); + pixel_view->wand=wand; + pixel_view->view=AcquireCacheView(pixel_view->wand->images); + pixel_view->region.width=wand->images->columns; + pixel_view->region.height=wand->images->rows; + pixel_view->number_threads=GetOpenMPMaximumThreads(); + pixel_view->pixel_wands=AcquirePixelsThreadSet(pixel_view->region.width, + pixel_view->number_threads); + if (pixel_view->pixel_wands == (PixelWand ***) NULL) + ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", + GetExceptionMessage(errno)); + pixel_view->debug=IsEventLogging(); + pixel_view->signature=WandSignature; + return(pixel_view); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% N e w P i x e l V i e w R e g i o n % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% NewPixelViewRegion() returns a pixel view required for all other methods +% in the Pixel View API. +% +% The format of the NewPixelViewRegion method is: +% +% PixelView *NewPixelViewRegion(MagickWand *wand,const ssize_t x, +% const ssize_t y,const size_t width,const size_t height) +% +% A description of each parameter follows: +% +% o wand: the magick wand. +% +% o x,y,columns,rows: These values define the perimeter of a region of +% pixel_wands view. +% +*/ +WandExport PixelView *NewPixelViewRegion(MagickWand *wand,const ssize_t x, + const ssize_t y,const size_t width,const size_t height) +{ + PixelView + *pixel_view; + + assert(wand != (MagickWand *) NULL); + assert(wand->signature == MagickSignature); + pixel_view=(PixelView *) AcquireAlignedMemory(1,sizeof(*pixel_view)); + if (pixel_view == (PixelView *) NULL) + ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", + GetExceptionMessage(errno)); + (void) ResetMagickMemory(pixel_view,0,sizeof(*pixel_view)); + pixel_view->id=AcquireWandId(); + (void) FormatMagickString(pixel_view->name,MaxTextExtent,"%s-%.20g", + PixelViewId,(double) pixel_view->id); + pixel_view->exception=AcquireExceptionInfo(); + pixel_view->view=AcquireCacheView(pixel_view->wand->images); + pixel_view->wand=wand; + 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->pixel_wands=AcquirePixelsThreadSet(pixel_view->region.width, + pixel_view->number_threads); + if (pixel_view->pixel_wands == (PixelWand ***) NULL) + ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", + GetExceptionMessage(errno)); + pixel_view->debug=IsEventLogging(); + pixel_view->signature=WandSignature; + return(pixel_view); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % P i x e l G e t N e x t R o w % % % % % @@ -1629,4 +2502,431 @@ WandExport char *PixelIteratorGetException(const PixelIterator *iterator, { return(PixelGetIteratorException(iterator,severity)); } + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% S e t P i x e l V i e w I t e r a t o r % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% SetPixelViewIterator() iterates over the pixel view in parallel and calls +% your set method for each scanline of the view. The pixel region 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. +% +% Use this pragma: +% +% #pragma omp critical +% +% to define a section of code in your callback set method that must be +% executed by a single thread at a time. +% +% The format of the SetPixelViewIterator method is: +% +% MagickBooleanType SetPixelViewIterator(PixelView *destination, +% SetPixelViewMethod set,void *context) +% +% A description of each parameter follows: +% +% o destination: the pixel view. +% +% o set: the set callback method. +% +% o context: the user defined context. +% +*/ +WandExport MagickBooleanType SetPixelViewIterator(PixelView *destination, + SetPixelViewMethod set,void *context) +{ +#define SetPixelViewTag "PixelView/Set" + + ExceptionInfo + *exception; + + Image + *destination_image; + + MagickBooleanType + status; + + MagickOffsetType + progress; + + ssize_t + y; + + assert(destination != (PixelView *) NULL); + assert(destination->signature == WandSignature); + if (set == (SetPixelViewMethod) NULL) + return(MagickFalse); + destination_image=destination->wand->images; + if (SetImageStorageClass(destination_image,DirectClass) == MagickFalse) + return(MagickFalse); + status=MagickTrue; + progress=0; + exception=destination->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++) + { + MagickBooleanType + sync; + + register IndexPacket + *restrict indexes; + + register ssize_t + id, + x; + + register PixelPacket + *restrict pixels; + + if (status == MagickFalse) + continue; + id=GetOpenMPThreadId(); + pixels=GetCacheViewAuthenticPixels(destination->view,destination->region.x, + y,destination->region.width,1,exception); + if (pixels == (PixelPacket *) NULL) + { + InheritException(destination->exception,GetCacheViewException( + destination->view)); + status=MagickFalse; + continue; + } + indexes=GetCacheViewAuthenticIndexQueue(destination->view); + if (set(destination,context) == MagickFalse) + status=MagickFalse; + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelGetQuantumColor(destination->pixel_wands[id][x],pixels+x); + if (destination_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) destination->region.width; x++) + indexes[x]=PixelGetBlackQuantum(destination->pixel_wands[id][x]); + sync=SyncCacheViewAuthenticPixels(destination->view,exception); + if (sync == MagickFalse) + { + InheritException(destination->exception,GetCacheViewException( + destination->view)); + status=MagickFalse; + } + if (destination_image->progress_monitor != (MagickProgressMonitor) NULL) + { + MagickBooleanType + proceed; + +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp critical (MagickWand_SetPixelViewIterator) +#endif + proceed=SetImageProgress(destination_image,SetPixelViewTag,progress++, + destination->region.height); + if (proceed == MagickFalse) + status=MagickFalse; + } + } + return(status); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% T r a n s f e r P i x e l V i e w I t e r a t o r % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% TransferPixelViewIterator() iterates over two pixel 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 +% negative offsets or widths or heights that exceed the image dimension. +% However, the destination pixel view is confined to the image canvas-- that +% is no negative offsets or widths or heights that exceed the image dimension +% are permitted. +% +% Use this pragma: +% +% #pragma omp critical +% +% to define a section of code in your callback transfer method that must be +% executed by a single thread at a time. +% +% The format of the TransferPixelViewIterator method is: +% +% MagickBooleanType TransferPixelViewIterator(PixelView *source, +% PixelView *destination,TransferPixelViewMethod transfer,void *context) +% +% A description of each parameter follows: +% +% o source: the source pixel view. +% +% o destination: the destination pixel view. +% +% o transfer: the transfer callback method. +% +% o context: the user defined context. +% +*/ +WandExport MagickBooleanType TransferPixelViewIterator(PixelView *source, + PixelView *destination,TransferPixelViewMethod transfer,void *context) +{ +#define TransferPixelViewTag "PixelView/Transfer" + + ExceptionInfo + *exception; + + Image + *destination_image, + *source_image; + + MagickBooleanType + status; + + MagickOffsetType + progress; + + ssize_t + y; + + assert(source != (PixelView *) NULL); + assert(source->signature == WandSignature); + if (transfer == (TransferPixelViewMethod) NULL) + return(MagickFalse); + source_image=source->wand->images; + destination_image=destination->wand->images; + if (SetImageStorageClass(destination_image,DirectClass) == MagickFalse) + return(MagickFalse); + status=MagickTrue; + progress=0; + exception=destination->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++) + { + MagickBooleanType + sync; + + register const IndexPacket + *restrict indexes; + + register const PixelPacket + *restrict pixels; + + register IndexPacket + *restrict destination_indexes; + + register ssize_t + id, + x; + + 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); + if (pixels == (const PixelPacket *) NULL) + { + status=MagickFalse; + continue; + } + indexes=GetCacheViewVirtualIndexQueue(source->view); + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetQuantumColor(source->pixel_wands[id][x],pixels+x); + if (source_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetBlackQuantum(source->pixel_wands[id][x],indexes[x]); + if (source_image->storage_class == PseudoClass) + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetIndex(source->pixel_wands[id][x],indexes[x]); + destination_pixels=GetCacheViewAuthenticPixels(destination->view, + destination->region.x,y,destination->region.width,1,exception); + if (destination_pixels == (PixelPacket *) NULL) + { + status=MagickFalse; + continue; + } + destination_indexes=GetCacheViewAuthenticIndexQueue(destination->view); + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelSetQuantumColor(destination->pixel_wands[id][x],pixels+x); + if (destination_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelSetBlackQuantum(destination->pixel_wands[id][x],indexes[x]); + if (destination_image->storage_class == PseudoClass) + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelSetIndex(destination->pixel_wands[id][x],indexes[x]); + if (transfer(source,destination,context) == MagickFalse) + status=MagickFalse; + for (x=0; x < (ssize_t) destination->region.width; x++) + PixelGetQuantumColor(destination->pixel_wands[id][x], + destination_pixels+x); + if (destination_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) destination->region.width; x++) + destination_indexes[x]=PixelGetBlackQuantum( + destination->pixel_wands[id][x]); + sync=SyncCacheViewAuthenticPixels(destination->view,exception); + if (sync == MagickFalse) + { + InheritException(destination->exception,GetCacheViewException( + source->view)); + status=MagickFalse; + } + if (source_image->progress_monitor != (MagickProgressMonitor) NULL) + { + MagickBooleanType + proceed; + +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp critical (MagickWand_TransferPixelViewIterator) +#endif + proceed=SetImageProgress(source_image,TransferPixelViewTag,progress++, + source->region.height); + if (proceed == MagickFalse) + status=MagickFalse; + } + } + return(status); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % +% U p d a t e P i x e l V i e w I t e r a t o r % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% UpdatePixelViewIterator() iterates over the pixel view in parallel and calls +% your update method for each scanline of the view. The pixel region 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. +% +% Use this pragma: +% +% #pragma omp critical +% +% to define a section of code in your callback update method that must be +% executed by a single thread at a time. +% +% The format of the UpdatePixelViewIterator method is: +% +% MagickBooleanType UpdatePixelViewIterator(PixelView *source, +% UpdatePixelViewMethod update,void *context) +% +% A description of each parameter follows: +% +% o source: the source pixel view. +% +% o update: the update callback method. +% +% o context: the user defined context. +% +*/ +WandExport MagickBooleanType UpdatePixelViewIterator(PixelView *source, + UpdatePixelViewMethod update,void *context) +{ +#define UpdatePixelViewTag "PixelView/Update" + + ExceptionInfo + *exception; + + Image + *source_image; + + MagickBooleanType + status; + + MagickOffsetType + progress; + + ssize_t + y; + + assert(source != (PixelView *) NULL); + assert(source->signature == WandSignature); + if (update == (UpdatePixelViewMethod) NULL) + return(MagickFalse); + source_image=source->wand->images; + if (SetImageStorageClass(source_image,DirectClass) == MagickFalse) + return(MagickFalse); + status=MagickTrue; + progress=0; + exception=source->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++) + { + register IndexPacket + *restrict indexes; + + register ssize_t + id, + x; + + register PixelPacket + *restrict pixels; + + if (status == MagickFalse) + continue; + id=GetOpenMPThreadId(); + pixels=GetCacheViewAuthenticPixels(source->view,source->region.x,y, + source->region.width,1,exception); + if (pixels == (PixelPacket *) NULL) + { + InheritException(source->exception,GetCacheViewException( + source->view)); + status=MagickFalse; + continue; + } + indexes=GetCacheViewAuthenticIndexQueue(source->view); + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetQuantumColor(source->pixel_wands[id][x],pixels+x); + if (source_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) source->region.width; x++) + PixelSetBlackQuantum(source->pixel_wands[id][x],indexes[x]); + if (update(source,context) == MagickFalse) + status=MagickFalse; + for (x=0; x < (ssize_t) source->region.width; x++) + PixelGetQuantumColor(source->pixel_wands[id][x],pixels+x); + if (source_image->colorspace == CMYKColorspace) + for (x=0; x < (ssize_t) source->region.width; x++) + indexes[x]=PixelGetBlackQuantum(source->pixel_wands[id][x]); + if (SyncCacheViewAuthenticPixels(source->view,exception) == MagickFalse) + { + InheritException(source->exception,GetCacheViewException(source->view)); + status=MagickFalse; + } + if (source_image->progress_monitor != (MagickProgressMonitor) NULL) + { + MagickBooleanType + proceed; + +#if defined(MAGICKCORE_OPENMP_SUPPORT) + #pragma omp critical (MagickWand_UpdatePixelViewIterator) +#endif + proceed=SetImageProgress(source_image,UpdatePixelViewTag,progress++, + source->region.height); + if (proceed == MagickFalse) + status=MagickFalse; + } + } + return(status); +} #endif diff --git a/wand/deprecate.h b/wand/deprecate.h index 91e136a97..c1a5a560d 100644 --- a/wand/deprecate.h +++ b/wand/deprecate.h @@ -32,6 +32,21 @@ extern "C" { typedef struct _DrawingWand *DrawContext; +typedef struct _PixelView + PixelView; + +typedef MagickBooleanType + (*DuplexTransferPixelViewMethod)(const PixelView *,const PixelView *, + PixelView *,void *), + (*GetPixelViewMethod)(const PixelView *,void *), + (*SetPixelViewMethod)(PixelView *,void *), + (*TransferPixelViewMethod)(const PixelView *,PixelView *,void *), + (*UpdatePixelViewMethod)(PixelView *,void *); + +extern WandExport char + *GetPixelViewException(const PixelView *,ExceptionType *) + magick_attribute((deprecated)); + extern WandExport double DrawGetFillAlpha(const DrawingWand *) magick_attribute((deprecated)), DrawGetStrokeAlpha(const DrawingWand *) magick_attribute((deprecated)); @@ -50,6 +65,11 @@ extern WandExport ssize_t MagickGetImageIndex(MagickWand *) magick_attribute((deprecated)); extern WandExport MagickBooleanType + DuplexTransferPixelViewIterator(PixelView *,PixelView *,PixelView *, + DuplexTransferPixelViewMethod,void *) magick_attribute((deprecated)), + GetPixelViewIterator(PixelView *,GetPixelViewMethod,void *) + magick_attribute((deprecated)), + IsPixelView(const PixelView *) magick_attribute((deprecated)), MagickClipPathImage(MagickWand *,const char *,const MagickBooleanType) magick_attribute((deprecated)), MagickColorFloodfillImage(MagickWand *,const PixelWand *,const double, @@ -92,13 +112,20 @@ extern WandExport MagickBooleanType const size_t,const char *,const StorageType,const void *) magick_attribute((deprecated)), MagickTransparentImage(MagickWand *,const PixelWand *,const double, - const double) magick_attribute((deprecated)); + const double) magick_attribute((deprecated)), + SetPixelViewIterator(PixelView *,SetPixelViewMethod,void *) + magick_attribute((deprecated)), + TransferPixelViewIterator(PixelView *,PixelView *,TransferPixelViewMethod, + void *) magick_attribute((deprecated)), + UpdatePixelViewIterator(PixelView *,UpdatePixelViewMethod,void *) + magick_attribute((deprecated)); extern WandExport MagickWand - *MagickAverageImages(MagickWand *), + *GetPixelViewWand(const PixelView *) magick_attribute((deprecated)), + *MagickAverageImages(MagickWand *) magick_attribute((deprecated)), *MagickFlattenImages(MagickWand *) magick_attribute((deprecated)), - *MagickMaximumImages(MagickWand *), - *MagickMinimumImages(MagickWand *), + *MagickMaximumImages(MagickWand *) magick_attribute((deprecated)), + *MagickMinimumImages(MagickWand *) magick_attribute((deprecated)), *MagickMosaicImages(MagickWand *) magick_attribute((deprecated)), *MagickRegionOfInterestImage(MagickWand *,const size_t,const size_t, const ssize_t,const ssize_t) magick_attribute((deprecated)); @@ -106,9 +133,25 @@ extern WandExport MagickWand extern WandExport MagickSizeType MagickGetImageSize(MagickWand *) magick_attribute((deprecated)); +extern WandExport PixelView + *ClonePixelView(const PixelView *) magick_attribute((deprecated)), + *DestroyPixelView(PixelView *) magick_attribute((deprecated)), + *NewPixelView(MagickWand *) magick_attribute((deprecated)), + *NewPixelViewRegion(MagickWand *,const ssize_t,const ssize_t,const size_t, + const size_t) magick_attribute((deprecated)); + extern WandExport PixelWand + **GetPixelViewPixels(const PixelView *) magick_attribute((deprecated)), **PixelGetNextRow(PixelIterator *) magick_attribute((deprecated)); +extern WandExport size_t + GetPixelViewHeight(const PixelView *) magick_attribute((deprecated)), + GetPixelViewWidth(const PixelView *) magick_attribute((deprecated)); + +extern WandExport ssize_t + GetPixelViewX(const PixelView *) magick_attribute((deprecated)), + GetPixelViewY(const PixelView *) magick_attribute((deprecated)); + extern WandExport unsigned char *MagickWriteImageBlob(MagickWand *,size_t *) magick_attribute((deprecated)); -- 2.40.0