WandExport WandView *NewWandView(MagickWand *wand) { ExceptionInfo *exception; WandView *wand_view; assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); wand_view=(WandView *) AcquireMagickMemory(sizeof(*wand_view)); if (wand_view == (WandView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); (void) ResetMagickMemory(wand_view,0,sizeof(*wand_view)); wand_view->id=AcquireWandId(); (void) FormatLocaleString(wand_view->name,MaxTextExtent,"%s-%.20g", WandViewId,(double) wand_view->id); wand_view->description=ConstantString("WandView"); wand_view->wand=wand; exception=AcquireExceptionInfo(); wand_view->view=AcquireVirtualCacheView(wand_view->wand->images,exception); wand_view->extent.width=wand->images->columns; wand_view->extent.height=wand->images->rows; wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width); wand_view->exception=exception; if (wand_view->pixel_wands == (PixelWand ***) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); wand_view->debug=IsEventLogging(); wand_view->signature=WandSignature; return(wand_view); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % N e w M a g i c k W a n d % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % NewMagickWand() returns a wand required for all other methods in the API. % A fatal exception is thrown if there is not enough memory to allocate the % wand. Use DestroyMagickWand() to dispose of the wand when it is no longer % needed. % % The format of the NewMagickWand method is: % % MagickWand *NewMagickWand(void) % */ WandExport MagickWand *NewMagickWand(void) { const char *quantum; MagickWand *wand; size_t depth; depth=MAGICKCORE_QUANTUM_DEPTH; quantum=GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand)); if (wand == (MagickWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); (void) ResetMagickMemory(wand,0,sizeof(*wand)); wand->id=AcquireWandId(); (void) FormatLocaleString(wand->name,MaxTextExtent,"%s-%.20g",MagickWandId, (double) wand->id); wand->images=NewImageList(); wand->image_info=AcquireImageInfo(); wand->exception=AcquireExceptionInfo(); wand->debug=IsEventLogging(); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); wand->signature=WandSignature; return(wand); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % N e w W a n d V i e w E x t e n t % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % NewWandViewExtent() returns a wand view required for all other methods % in the Wand View API. % % The format of the NewWandViewExtent method is: % % WandView *NewWandViewExtent(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 extent of % pixel_wands view. % */ WandExport WandView *NewWandViewExtent(MagickWand *wand,const ssize_t x, const ssize_t y,const size_t width,const size_t height) { WandView *wand_view; assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); wand_view=(WandView *) AcquireMagickMemory(sizeof(*wand_view)); if (wand_view == (WandView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); (void) ResetMagickMemory(wand_view,0,sizeof(*wand_view)); wand_view->id=AcquireWandId(); (void) FormatLocaleString(wand_view->name,MaxTextExtent,"%s-%.20g", WandViewId,(double) wand_view->id); wand_view->description=ConstantString("WandView"); wand_view->view=AcquireCacheView(wand_view->wand->images); wand_view->wand=wand; wand_view->extent.width=width; wand_view->extent.height=height; wand_view->extent.x=x; wand_view->extent.y=y; wand_view->number_threads=GetOpenMPMaximumThreads(); wand_view->exception=AcquireExceptionInfo(); wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width, wand_view->number_threads); if (wand_view->pixel_wands == (PixelWand ***) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); wand_view->debug=IsEventLogging(); wand_view->signature=WandSignature; return(wand_view); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % N e w M a g i c k W a n d % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % NewMagickWand() returns a wand required for all other methods in the API. % % The format of the NewMagickWand method is: % % MagickWand *NewMagickWand(void) % */ WandExport MagickWand *NewMagickWand(void) { const char *quantum; MagickWand *wand; unsigned long depth; depth=QuantumDepth; quantum=GetMagickQuantumDepth(&depth); if (depth != QuantumDepth) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand)); if (wand == (MagickWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", strerror(errno)); (void) ResetMagickMemory(wand,0,sizeof(*wand)); wand->id=AcquireWandId(); (void) FormatMagickString(wand->name,MaxTextExtent,"%s-%lu",MagickWandId, wand->id); GetExceptionInfo(&wand->exception); wand->image_info=CloneImageInfo((ImageInfo *) NULL); wand->quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL); wand->images=NewImageList(); wand->debug=IsEventLogging(); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); wand->signature=MagickSignature; return(wand); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % 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 long x, % const long y,const unsigned long width,const unsigned long 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 long x, const long y,const unsigned long width,const unsigned long height) { PixelView *pixel_view; assert(wand != (MagickWand *) NULL); assert(wand->signature == MagickSignature); pixel_view=(PixelView *) AcquireMagickMemory(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-%lu", PixelViewId,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); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % N e w P i x e l R e g i o n I t e r a t o r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % NewPixelRegionIterator() returns a new pixel iterator. % % The format of the NewPixelRegionIterator method is: % % PixelIterator *NewPixelRegionIterator(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 % pixels. % */ WandExport PixelIterator *NewPixelRegionIterator(MagickWand *wand, const ssize_t x,const ssize_t y,const size_t width,const size_t height) { CacheView *view; const char *quantum; ExceptionInfo *exception; Image *image; PixelIterator *iterator; size_t depth; assert(wand != (MagickWand *) NULL); depth=MAGICKCORE_QUANTUM_DEPTH; quantum=GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); if ((width == 0) || (width == 0)) ThrowWandFatalException(WandError,"ZeroRegionSize",quantum); image=GetImageFromMagickWand(wand); if (image == (Image *) NULL) return((PixelIterator *) NULL); exception=AcquireExceptionInfo(); view=AcquireVirtualCacheView(image,exception); if (view == (CacheView *) NULL) return((PixelIterator *) NULL); iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*iterator)); if (iterator == (PixelIterator *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand->name); (void) ResetMagickMemory(iterator,0,sizeof(*iterator)); iterator->id=AcquireWandId(); (void) FormatLocaleString(iterator->name,MaxTextExtent,"%s-%.20g", PixelIteratorId,(double) iterator->id); iterator->exception=exception; iterator->view=view; SetGeometry(image,&iterator->region); iterator->region.width=width; iterator->region.height=height; iterator->region.x=x; iterator->region.y=y; iterator->pixel_wands=NewPixelWands(iterator->region.width); iterator->y=0; iterator->debug=IsEventLogging(); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); iterator->signature=WandSignature; return(iterator); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % N e w P i x e l R e g i o n I t e r a t o r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % NewPixelRegionIterator() returns a new pixel iterator. % % The format of the NewPixelRegionIterator method is: % % PixelIterator NewPixelRegionIterator(MagickWand *wand,const long x, % const long y,const unsigned long columns,const unsigned long rows, % const MagickBooleanType modify) % % 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 % pixels. % */ WandExport PixelIterator *NewPixelRegionIterator(MagickWand *wand,const long x, const long y,const unsigned long columns,const unsigned long rows) { const char *quantum; Image *image; PixelIterator *iterator; unsigned long depth; ViewInfo *view; assert(wand != (MagickWand *) NULL); depth=MAGICKCORE_QUANTUM_DEPTH; quantum=GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); if ((columns == 0) || (rows == 0)) ThrowWandFatalException(WandError,"ZeroRegionSize",quantum); image=GetImageFromMagickWand(wand); if (image == (Image *) NULL) return((PixelIterator *) NULL); view=OpenCacheView(image); if (view == (ViewInfo *) NULL) return((PixelIterator *) NULL); iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*iterator)); if (iterator == (PixelIterator *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand->name); (void) ResetMagickMemory(iterator,0,sizeof(*iterator)); iterator->id=AcquireWandId(); (void) FormatMagickString(iterator->name,MaxTextExtent,"%s-%lu", PixelIteratorId,iterator->id); iterator->exception=AcquireExceptionInfo(); iterator->view=view; SetGeometry(image,&iterator->region); iterator->region.width=columns; iterator->region.height=rows; iterator->region.x=x; iterator->region.y=y; iterator->pixel_wands=NewPixelWands(iterator->region.width); iterator->y=0; iterator->debug=IsEventLogging(); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); iterator->signature=WandSignature; return(iterator); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % N e w P i x e l I t e r a t o r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % NewPixelIterator() returns a new pixel iterator. % % The format of the NewPixelIterator method is: % % PixelIterator *NewPixelIterator(MagickWand *wand) % % A description of each parameter follows: % % o wand: the magick wand. % */ WandExport PixelIterator *NewPixelIterator(MagickWand *wand) { const char *quantum; Image *image; PixelIterator *iterator; size_t depth; CacheView *view; depth=MAGICKCORE_QUANTUM_DEPTH; quantum=GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); assert(wand != (MagickWand *) NULL); image=GetImageFromMagickWand(wand); if (image == (Image *) NULL) return((PixelIterator *) NULL); view=AcquireCacheView(image); if (view == (CacheView *) NULL) return((PixelIterator *) NULL); iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*iterator)); if (iterator == (PixelIterator *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); (void) ResetMagickMemory(iterator,0,sizeof(*iterator)); iterator->id=AcquireWandId(); (void) FormatMagickString(iterator->name,MaxTextExtent,"%s-%.20g", PixelIteratorId,(double) iterator->id); iterator->exception=AcquireExceptionInfo(); iterator->view=view; SetGeometry(image,&iterator->region); iterator->region.width=image->columns; iterator->region.height=image->rows; iterator->region.x=0; iterator->region.y=0; iterator->pixel_wands=NewPixelWands(iterator->region.width); iterator->y=0; iterator->debug=IsEventLogging(); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); iterator->signature=WandSignature; return(iterator); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % C l o n e M a g i c k W a n d % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % CloneMagickWand() makes an exact copy of the specified wand. % % The format of the CloneMagickWand method is: % % MagickWand *CloneMagickWand(const MagickWand *wand) % % A description of each parameter follows: % % o wand: the magick wand. % */ WandExport MagickWand *CloneMagickWand(const MagickWand *wand) { 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 *) AcquireMagickMemory(sizeof(*clone_wand)); if (clone_wand == (MagickWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand->name); (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand)); clone_wand->id=AcquireWandId(); (void) FormatLocaleString(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->images=CloneImageList(wand->images,clone_wand->exception); clone_wand->insert_before=MagickFalse; clone_wand->image_pending=MagickFalse; clone_wand->debug=IsEventLogging(); if (clone_wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name); clone_wand->signature=WandSignature; return(clone_wand); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % G e t W a n d V i e w E x c e p t i o n % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % GetWandViewException() returns the severity, reason, and description of any % error that occurs when utilizing a wand view. % % The format of the GetWandViewException method is: % % char *GetWandViewException(const WandView *wand_view, % ExceptionType *severity) % % A description of each parameter follows: % % o wand_view: the pixel wand_view. % % o severity: the severity of the error is returned here. % */ WandExport char *GetWandViewException(const WandView *wand_view, ExceptionType *severity) { char *description; assert(wand_view != (const WandView *) NULL); assert(wand_view->signature == WandSignature); if (wand_view->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand_view->name); assert(severity != (ExceptionType *) NULL); *severity=wand_view->exception->severity; description=(char *) AcquireQuantumMemory(2UL*MaxTextExtent, sizeof(*description)); if (description == (char *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand_view->name); *description='\0'; if (wand_view->exception->reason != (char *) NULL) (void) CopyMagickString(description,GetLocaleExceptionMessage( wand_view->exception->severity,wand_view->exception->reason), MaxTextExtent); if (wand_view->exception->description != (char *) NULL) { (void) ConcatenateMagickString(description," (",MaxTextExtent); (void) ConcatenateMagickString(description,GetLocaleExceptionMessage( wand_view->exception->severity,wand_view->exception->description), MaxTextExtent); (void) ConcatenateMagickString(description,")",MaxTextExtent); } return(description); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % C l o n e M a g i c k W a n d % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % CloneMagickWand() makes an exact copy of the specified wand. % % The format of the CloneMagickWand method is: % % MagickWand *CloneMagickWand(const MagickWand *wand) % % A description of each parameter follows: % % o wand: The magick wand. % */ WandExport MagickWand *CloneMagickWand(const MagickWand *wand) { 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 *) AcquireMagickMemory(sizeof(*clone_wand)); if (clone_wand == (MagickWand *) NULL) { char *message; message=GetExceptionMessage(errno); ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", message); message=DestroyString(message); } (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand)); clone_wand->id=AcquireWandId(); (void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu", MagickWandId,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=CloneImageList(wand->images,clone_wand->exception); clone_wand->debug=IsEventLogging(); if (clone_wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name); clone_wand->signature=WandSignature; return(clone_wand); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % C l o n e P i x e l I t e r a t o r % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ClonePixelIterator() makes an exact copy of the specified iterator. % % The format of the ClonePixelIterator method is: % % PixelIterator *ClonePixelIterator(const PixelIterator *iterator) % % A description of each parameter follows: % % o iterator: the magick iterator. % */ WandExport PixelIterator *ClonePixelIterator(const PixelIterator *iterator) { PixelIterator *clone_iterator; assert(iterator != (PixelIterator *) NULL); assert(iterator->signature == WandSignature); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); clone_iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*clone_iterator)); if (clone_iterator == (PixelIterator *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", iterator->name); (void) ResetMagickMemory(clone_iterator,0,sizeof(*clone_iterator)); clone_iterator->id=AcquireWandId(); (void) FormatMagickString(clone_iterator->name,MaxTextExtent,"%s-%lu", PixelIteratorId,clone_iterator->id); clone_iterator->exception=AcquireExceptionInfo(); InheritException(clone_iterator->exception,iterator->exception); clone_iterator->view=CloneCacheView(iterator->view); clone_iterator->region=iterator->region; clone_iterator->active=iterator->active; clone_iterator->y=iterator->y; clone_iterator->pixel_wands=ClonePixelWands((const PixelWand **) iterator->pixel_wands,iterator->region.width); clone_iterator->debug=iterator->debug; if (clone_iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", clone_iterator->name); clone_iterator->signature=WandSignature; return(clone_iterator); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % C l o n e W a n d V i e w % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % CloneWandView() makes a copy of the specified wand view. % % The format of the CloneWandView method is: % % WandView *CloneWandView(const WandView *wand_view) % % A description of each parameter follows: % % o wand_view: the wand view. % */ WandExport WandView *CloneWandView(const WandView *wand_view) { WandView *clone_view; register ssize_t i; assert(wand_view != (WandView *) NULL); assert(wand_view->signature == WandSignature); if (wand_view->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand_view->name); clone_view=(WandView *) AcquireMagickMemory(sizeof(*clone_view)); if (clone_view == (WandView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand_view->name); (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view)); clone_view->id=AcquireWandId(); (void) FormatLocaleString(clone_view->name,MaxTextExtent,"%s-%.20g", WandViewId,(double) clone_view->id); clone_view->description=ConstantString(wand_view->description); clone_view->view=CloneCacheView(wand_view->view); clone_view->extent=wand_view->extent; clone_view->number_threads=wand_view->number_threads; clone_view->exception=AcquireExceptionInfo(); InheritException(clone_view->exception,wand_view->exception); for (i=0; i < (ssize_t) wand_view->number_threads; i++) clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **) wand_view->pixel_wands[i],wand_view->extent.width); clone_view->debug=wand_view->debug; if (clone_view->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_view->name); clone_view->signature=WandSignature; return(clone_view); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % 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 long 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 *) AcquireMagickMemory(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-%lu",PixelViewId, 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 < (long) 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); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % P i x e l G e t I t e r a t o r E x c e p t i o n % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % PixelGetIteratorException() returns the severity, reason, and description of % any error that occurs when using other methods in this API. % % The format of the PixelGetIteratorException method is: % % char *PixelGetIteratorException(const PixelIterator *iterator, % ExceptionType *severity) % % A description of each parameter follows: % % o iterator: the pixel iterator. % % o severity: the severity of the error is returned here. % */ WandExport char *PixelGetIteratorException(const PixelIterator *iterator, ExceptionType *severity) { char *description; assert(iterator != (const PixelIterator *) NULL); assert(iterator->signature == MagickWandSignature); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); assert(severity != (ExceptionType *) NULL); *severity=iterator->exception->severity; description=(char *) AcquireQuantumMemory(2UL*MagickPathExtent, sizeof(*description)); if (description == (char *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", iterator->name); *description='\0'; if (iterator->exception->reason != (char *) NULL) (void) CopyMagickString(description,GetLocaleExceptionMessage( iterator->exception->severity,iterator->exception->reason),MagickPathExtent); if (iterator->exception->description != (char *) NULL) { (void) ConcatenateMagickString(description," (",MagickPathExtent); (void) ConcatenateMagickString(description,GetLocaleExceptionMessage( iterator->exception->severity,iterator->exception->description), MagickPathExtent); (void) ConcatenateMagickString(description,")",MagickPathExtent); } return(description); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % + A c q u i r e W a n d C L I % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % AcquireMagickCLI() creates a new CLI wand (an expanded form of Magick % Wand). The given image_info and exception is included as is if provided. % % Use DestroyMagickCLI() to dispose of the CLI wand when it is no longer % needed. % % The format of the NewMagickWand method is: % % MagickCLI *AcquireMagickCLI(ImageInfo *image_info, % ExceptionInfo *exception) % */ WandExport MagickCLI *AcquireMagickCLI(ImageInfo *image_info, ExceptionInfo *exception) { MagickCLI *cli_wand; /* precaution - as per NewMagickWand() */ { size_t depth = MAGICKCORE_QUANTUM_DEPTH; const char *quantum = GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); } /* allocate memory for MgaickCLI */ cli_wand=(MagickCLI *) AcquireMagickMemory(sizeof(*cli_wand)); if (cli_wand == (MagickCLI *) NULL) { ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); return((MagickCLI *)NULL); } /* Initialize Wand Part of MagickCLI FUTURE: this is a repeat of code from NewMagickWand() However some parts may be given fro man external source! */ cli_wand->wand.id=AcquireWandId(); (void) FormatLocaleString(cli_wand->wand.name,MaxTextExtent, "%s-%.20g","MagickWandCLI", (double) cli_wand->wand.id); cli_wand->wand.images=NewImageList(); if ( image_info == (ImageInfo *)NULL) cli_wand->wand.image_info=AcquireImageInfo(); else cli_wand->wand.image_info=image_info; if ( exception == (ExceptionInfo *)NULL) cli_wand->wand.exception=AcquireExceptionInfo(); else cli_wand->wand.exception=exception; cli_wand->wand.debug=IsEventLogging(); cli_wand->wand.signature=WandSignature; /* Initialize CLI Part of MagickCLI */ cli_wand->draw_info=CloneDrawInfo(cli_wand->wand.image_info,(DrawInfo *) NULL); cli_wand->quantize_info=AcquireQuantizeInfo(cli_wand->wand.image_info); cli_wand->process_flags=MagickCommandOptionFlags; /* assume "magick" CLI */ cli_wand->command=(const OptionInfo *)NULL; /* no option at this time */ cli_wand->image_list_stack=(Stack *)NULL; cli_wand->image_info_stack=(Stack *)NULL; /* default exception location... EG: sprintf(locaiton, filename, line, column); */ cli_wand->location="from \"%s\""; /* location format using arguments: */ /* filename, line, column */ cli_wand->filename="unknown"; /* script filename, unknown source */ cli_wand->line=0; /* line from script OR CLI argument */ cli_wand->column=0; /* column from script */ cli_wand->signature=WandSignature; if (IfMagickTrue(cli_wand->wand.debug)) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",cli_wand->wand.name); return(cli_wand); }